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

Annotation of /ReleaseTools/RTPath.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (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 : efrank 1.5 reldir=${RTDIST}/releases/${baserelname}/${RTARCH}
68 :    
69 :     #if [ -f rtConfig ]; then
70 :     # . rtConfig
71 :     # reldir=${RTDIST}/releases/${baserelname}/${RTARCH}
72 :     #else
73 :     # reldir=${RTDIST}/releases/${RTCURRENT}/${RTARCH}
74 :     #fi
75 : efrank 1.1
76 :     if [ "" != "$RTSITEOVERRIDE" ]; then
77 :     overridedir=${RTSITEOVERRIDE}/${RTCURRENT}/${RTARCH}
78 :     overridedirbin=$overridedir/bin
79 :     overridedirlib=$overridedir/lib
80 :     else
81 :     set overridedir=""
82 :     set overridedirbin=""
83 :     set overridedirlib=""
84 :     fi
85 :    
86 :     #
87 :     # path
88 :     #
89 : efrank 1.2
90 :     if [ "`echo $PATH | grep RTMARKER`" != "" ]; then
91 : efrank 1.1 #RTMARKER sandwhich there...change out the filling
92 : efrank 1.2 PATH=`echo $PATH | sed "s%RTMARKER.*RTMARKER%RTMARKER:${workdir}/bin:${overridedirbin}:${reldir}/bin:RTMARKER%g"`
93 : efrank 1.1 else
94 :     #No MARKER...our first time, then
95 : efrank 1.6 PATH=`echo RTMARKER:${workdir}/bin:${overridedirbin}:${reldir}/bin:RTMARKER`:$PATH
96 : efrank 1.1 fi
97 :    
98 :     #
99 :     # PYTHONPATH
100 :     #
101 :    
102 : efrank 1.2 if [ "" = "$PYTHONPATH" ]; then
103 :     PYTHONPATH=`echo RTMARKER:${workdir}/lib:${overridedirlib}:${reldir}/lib:RTMARKER`
104 : efrank 1.1
105 : efrank 1.2 elif [ "`echo $PYTHONPATH | grep RTMARKER`" != "" ]; then
106 :     PYTHONPATH=`echo $PYTHONPATH | sed "s%RTMARKER.*RTMARKER%RTMARKER:${workdir}/lib:${overridedirlib}:${reldir}/lib:RTMARKER%g"`
107 : efrank 1.1
108 :     else
109 : efrank 1.6 PYTHONPATH=`echo RTMARKER:${workdir}/lib:${overridedirlib}:${reldir}/lib:RTMARKER`:${PYTHONPATH}
110 : efrank 1.1
111 : efrank 1.2 fi
112 : efrank 1.1
113 :     #
114 :     # cleanup
115 :     #
116 :    
117 :     unset workdir
118 :     unset reldir
119 :     unset overridedir
120 :     unset overridedirbin
121 :     unset overridedirlib

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3