[Bio] / ReleaseTools / RTPath.sh Repository:
ViewVC logotype

Annotation of /ReleaseTools/RTPath.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (view) (download) (as text)

1 : efrank 1.1 #############################################################################
2 :     #
3 :     # The goal is to set various path env variables to control search order
4 :     # under the release tools.
5 :     #
6 :     # USAGE:
7 :     # o run from inside a work directory
8 :     # o Have RTDIST, RTCURRENT defined. Also, RTSITEOVERRIDE, if needed
9 :     #
10 :     # source RTPATH
11 :     #
12 :     #
13 :     # DETAILS:
14 :     #
15 :     # We care about:
16 :     #
17 :     # path affects locating release programs, tools
18 :     # PYTHONPATH affects loading of built code
19 :     # LD_LIBRARY_PATH as for PYTHONPATH.** Not used yet, thank heavens
20 :     #
21 :     # The search order is as follows, and this defines levels of overrides
22 :     #
23 :     # 1. working directory
24 :     # 2. site overrides not implemented yet.
25 :     # 3. base release
26 :     #
27 :     # Thus, anything checked out (in case its modified) wins out over
28 :     # everything. Anything in site-level config comes next. This allows the
29 :     # site to do config that is perhaps more tricky than
30 :     # a typical user cares to know about. Finally comes base release, allowing
31 :     # us to ship releases with reasonable defaults (or examples).
32 :     #
33 :     # Site overrides work by keying off of RTSITEOVERRIDE environment variable.
34 :     # That's just a path that points to the overrides. We look in there for
35 :     # a subdirectory with the current release name (RTCURRENT).
36 :     #
37 :     # So, the end result is something like
38 :     #
39 :     # ${PWD}/${RTARCH}/bin:${RTSITEOVERRIDE}/${RTCURRENT}/${RTARCH}/bin:
40 :     # ${RTDIST}/releases/${RTCURRENT}/${RTARCH}/bin
41 :     #
42 :     # or with bin->lib, as needed.
43 :     #
44 :     # HISTORY:
45 :     # 06Feb04 efrank first version
46 :     #
47 :     # BUGS
48 :     # o We don't want the paths to get longer and longer if RTPath is called
49 :     # multiple times, e.g., if you change to a new working directory. We
50 :     # have a KLUDGE for the moment: we stick RTMARKER as a literal into
51 :     # the path to sandwhich what we put there. We then use that to locate
52 :     # our stuff later when we need to modify it. Not robust at all.
53 :     #
54 :     #############################################################################
55 :    
56 :     # PYTHONPATH affects loading of built code
57 :     # LD_LIBRARY_PATH as for PYTHONPATH.** Not used yet, thank heavens
58 :    
59 :    
60 : efrank 1.2
61 : efrank 1.1 #
62 :     # precompute a few directory names.
63 :     #
64 :    
65 :     workdir=${PWD}/${RTARCH}
66 :    
67 :     reldir=${RTDIST}/releases/${RTCURRENT}/${RTARCH}
68 :    
69 :     if [ "" != "$RTSITEOVERRIDE" ]; then
70 :     overridedir=${RTSITEOVERRIDE}/${RTCURRENT}/${RTARCH}
71 :     overridedirbin=$overridedir/bin
72 :     overridedirlib=$overridedir/lib
73 :     else
74 :     set overridedir=""
75 :     set overridedirbin=""
76 :     set overridedirlib=""
77 :     fi
78 :    
79 :     #
80 :     # path
81 :     #
82 : efrank 1.2
83 :     if [ "`echo $PATH | grep RTMARKER`" != "" ]; then
84 : efrank 1.1 #RTMARKER sandwhich there...change out the filling
85 : efrank 1.2 PATH=`echo $PATH | sed "s%RTMARKER.*RTMARKER%RTMARKER:${workdir}/bin:${overridedirbin}:${reldir}/bin:RTMARKER%g"`
86 : efrank 1.1 else
87 :     #No MARKER...our first time, then
88 : efrank 1.2 PATH=$PATH:`echo RTMARKER:${workdir}/bin:${overridedirbin}:${reldir}/bin:RTMARKER`
89 : efrank 1.1 fi
90 :    
91 :     #
92 :     # PYTHONPATH
93 :     #
94 :    
95 : efrank 1.2 if [ "" = "$PYTHONPATH" ]; then
96 :     PYTHONPATH=`echo RTMARKER:${workdir}/lib:${overridedirlib}:${reldir}/lib:RTMARKER`
97 : efrank 1.1
98 : efrank 1.2 elif [ "`echo $PYTHONPATH | grep RTMARKER`" != "" ]; then
99 :     PYTHONPATH=`echo $PYTHONPATH | sed "s%RTMARKER.*RTMARKER%RTMARKER:${workdir}/lib:${overridedirlib}:${reldir}/lib:RTMARKER%g"`
100 : efrank 1.1
101 :     else
102 : efrank 1.2 PYTHONPATH=${PYTHONPATH}:`echo RTMARKER:${workdir}/lib:${overridedirlib}:${reldir}/lib:RTMARKER`
103 : efrank 1.1
104 : efrank 1.2 fi
105 : efrank 1.1
106 :     #
107 :     # cleanup
108 :     #
109 :    
110 :     unset workdir
111 :     unset reldir
112 :     unset overridedir
113 :     unset overridedirbin
114 :     unset overridedirlib

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3