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

Annotation of /ReleaseTools/RTPath.sh

Parent Directory Parent Directory | Revision Log Revision Log


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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3