source: trunk/project_profile.sh @ 323

Last change on this file since 323 was 322, checked in by pinsard, 11 years ago

fix for python documentation

  • Property svn:executable set to *
  • Property svn:keywords set to Id URL
File size: 7.7 KB
Line 
1#! /bin/sh
2#+
3#
4# .. program:: project_profile.sh
5#
6# ===================
7# project_profile.sh
8# ===================
9#
10#
11# SYNOPSIS
12# ========
13#
14# Online usage ::
15#
16#  $ . ./project_profile.sh -d directory -i indir -o outdir -t tempdir
17#
18# In :file:`${HOME}/.profile`, add the following line ::
19#
20#  . project_profile.sh -d directory  -i indir -o outdir -t tempdir
21#
22# DESCRIPTION
23# ===========
24#
25# .. option:: -d  <directory>
26# .. option:: -i  <indir>
27# .. option:: -o  <outdir>
28# .. option:: -t  <tempdir>
29# .. option:: -jv  jabref version
30# .. option:: -j  jabref dir
31#
32# define SUPERBIB environment
33#
34# ${PROJECT} is the base directory of tools.
35#
36# ${PROJECT_LOG} is the directory where log files  will be written.
37#
38# ${PROJECT_ID} is the directory where input files must be.
39#
40# ${PROJECT_OD}  is the directory where output files will be written.
41#
42# MANPATH++
43#
44# EXAMPLES
45# ========
46#
47# For fplod, on cratos.locean-ipsl.upmc.fr::
48#
49#  cd /usr/home/fplod/src/superbib/superbib_ws/
50#  SUPERBIB=${HOME}/superbib_ws/
51#  export SUPERBIB
52#  . ${SUPERBIB}/project_profile.sh \
53#    -d ${SUPERBIB} \
54#    -i /usr/temp/${LOGNAME}/superbib_d/ \
55#    -o /usr/temp/${LOGNAME}/superbib_d/ \
56#    -t /usr/temp/${LOGNAME}/log/ \
57#    -jv 2.6 \
58#    -j /usr/home/incas/francoise/jabref-2.6_cratos/
59#    -b ++
60#
61# TODO
62# ====
63#
64# ++ option bavarde
65#
66# ++ machine dependant
67#
68# ++ pas de MANPATH defini par defaut sur zeus
69#
70# reintegration de bibliolocean dans trunk ou projet bibliolocean a part
71#
72# doc sur jabref dir bibtool
73#
74# EVOLUTIONS
75# ==========
76#
77# $Id$
78#
79# $URL$
80#
81# - fplod 20130418T110932Z cratos.locean-ipsl.upmc.fr (Linux)
82#
83#   * add PYTHONPATH (seems to be need be sphinx-apidoc + sphinx-build)
84#
85# - fplod 20120629T120311Z cratos (Linux)
86#
87#   * path with branches/bibliolocean/src
88#
89# - fplod 20120405T085555Z cratos (Linux)
90#
91#   * rename and replace SUPERBIB by PROJECT
92#
93# - fplod 20100426T094821Z aedon.locean-ipsl.upmc.fr (Darwin)
94#
95#   * improve PATH and MANPATH modification
96#
97# - fplod 20100423T144248Z aedon.locean-ipsl.upmc.fr (Darwin)
98#
99#   * add error handling on mkdir
100#
101# - fplod 2008-10-31T11:17:24Z aedon.locean-ipsl.upmc.fr (Darwin)
102#
103#   * creation ++ pas encore en service
104#
105#-
106system=$(uname)
107case "${system}" in
108   AIX|IRIX64)
109      echo " www : no specific posix checking"
110   ;;
111   *)
112      set -o posix
113   ;;
114esac
115unset system
116#
117set -u
118#
119# as this script might be launch in .profile, command is forced.
120command=project_profile.sh
121#
122usage=" Usage : ${command} -d directory -i indir -o outdir -t tempdir -jv jabrefversion -j jabrefdir -b bibtooldir"
123#
124while [ ${#} -gt 0 ]
125do
126   case ${1} in
127      -d)
128         # directory for application choosen by user (see svn checkout command used)
129         directory=${2}
130         shift
131      ;;
132      -i)
133         # directory for inputs choosen by user
134         indir=${2}
135         shift
136      ;;
137      -o)
138         # directory for outputs choosen by user
139         outdir=${2}
140         shift
141      ;;
142      -t)
143         # directory for temporary outputs choosen by user
144         tempdir=${2}
145         shift
146      ;;
147      -jv)
148         jabrefversion=${2}
149         shift
150      ;;
151      -j)
152         jabrefdir=${2}
153         shift
154      ;;
155      -b)
156         bibtooldir=${2}
157         shift
158      ;;
159      *)
160        # other choice
161        echo "eee : unknown option ${1}"
162        echo "${usage}"
163        # nb : no exit because this file should be launched by login process
164      ;;
165   esac
166   # next flag
167   shift
168done
169unset usage
170#
171# check for ${directory}
172if [ ! -d ${directory} ]
173then
174   echo " eee : ${directory} not found"
175   # nb : no exit because this file should be launched by login process
176fi
177#
178# check for permission on directory
179if [ ! -x ${directory} ]
180then
181   echo " eee : ${directory} not reachable"
182   # nb : no exit because this file should be launched by login process
183fi
184#
185PROJECT=${directory}
186export PROJECT
187#
188# add PROJECT tools to PATH
189# if not already done
190suppath=$(echo ${PROJECT} | tr -s "/")
191echo ${PATH} | grep -q "${suppath}:"
192test_path=${?}
193if [ ${test_path} -ne 0 ]
194then
195   PATH=${suppath}:${PATH}
196   export PATH
197else
198   # option bavarde oui/non pas encore implantée ++
199   echo "${command} : iii : ${suppath} already in \${PATH}"
200fi
201unset test_path
202unset suppath
203#
204suppath=$(echo ${PROJECT}/../branches/bibliolocean/src | tr -s "/")
205echo ${PATH} | grep -q "${suppath}:"
206test_path=${?}
207if [ ${test_path} -ne 0 ]
208then
209PATH=${suppath}:${PATH}
210export PATH
211else
212# option bavarde oui/non pas encore implantée ++
213echo "${command} : iii : ${suppath} already in \${PATH}"
214fi
215unset test_path
216#
217# add PROJECT tools to PYTHONPATH
218# if not already done
219suppath=$(echo ${PROJECT}/aeres/scripts/ | tr -s "/")
220echo ${PYTHONPATH} | grep -q "${suppath}:"
221test_path=${?}
222if [ ${test_path} -ne 0 ]
223then
224   PYTHONPATH=${suppath}:${PYTHONPATH}
225   export PYTHONPATH
226else
227   # option bavarde oui/non pas encore implantée ++
228   echo "${command} : iii : ${suppath} already in \${PYTHONPATH}"
229fi
230unset test_path
231unset suppath
232#
233# add PROJECT tools to PYTHONPATH
234# if not already done
235suppath=$(echo ${PROJECT}/| tr -s "/")
236echo ${PYTHONPATH} | grep -q "${suppath}:"
237test_path=${?}
238if [ ${test_path} -ne 0 ]
239then
240   PYTHONPATH=${suppath}:${PYTHONPATH}
241   export PYTHONPATH
242else
243   # option bavarde oui/non pas encore implantée ++
244   echo "${command} : iii : ${suppath} already in \${PYTHONPATH}"
245fi
246unset test_path
247unset suppath
248#
249# add PROJECT manuals to MANPATH
250# if not already done
251suppath=$(echo ${PROJECT}/doc/manuals/man | tr -s "/")
252echo ${MANPATH} | grep -q "${suppath}:"
253test_manpath=${?}
254if [ ${test_manpath} -ne 0 ]
255then
256   MANPATH=${suppath}:${MANPATH}
257   export MANPATH
258else
259   # option bavarde oui/non pas encore implantée ++
260   echo "${command} : iii : ${suppath} already in \${MANPATH}"
261fi
262unset test_manpath
263unset suppath
264#
265PROJECT_LOG=${tempdir}
266export PROJECT_LOG
267unset tempdir
268if [ ! -d ${PROJECT_LOG} ]
269then
270   mkdir -p ${PROJECT_LOG}
271   status=${?}
272   if [ ${status} -ne 0 ]
273   then
274      echo "${command} : eee : can not create \${PROJECT_LOG}"
275      # nb : no exit because this file should be launched by login process
276   else
277      echo "${command} : iii : creation of \${PROJECT_LOG}"
278   fi
279   unset status
280fi
281# check for permission on PROJECT_LOG
282if [ ! -x ${PROJECT_LOG} ]
283then
284   echo " eee : ${PROJECT_LOG} not reachable"
285   # nb : no exit because this file should be launched by login process
286fi
287#
288# check for permission on PROJECT_LOG
289if [ ! -w ${PROJECT_LOG} ]
290then
291   echo " eee : ${PROJECT_LOG} not writable"
292   # nb : no exit because this file shouldreachable be launched by login process
293fi
294#
295EDITOR=vi
296export EDITOR
297#
298# io directories
299PROJECT_ID=${indir}
300export PROJECT_ID
301unset indir
302if [ ! -d ${PROJECT_ID} ]
303then
304   mkdir -p ${PROJECT_ID}
305   echo "${command} : iii : creation of \${PROJECT_ID}"
306fi
307# check for permission on PROJECT_ID
308if [ ! -x ${PROJECT_ID} ]
309then
310   echo " eee : ${PROJECT_ID} not reachable"
311   # nb : no exit because this file should be launched by login process
312fi
313#
314PROJECT_OD=${outdir}
315export PROJECT_OD
316unset outdir
317if [ ! -d ${PROJECT_OD} ]
318then
319    mkdir -p ${PROJECT_OD}
320    echo "${command} : iii : creation of \${PROJECT_OD}"
321fi
322# check for permission on PROJECT_OD
323if [ ! -x ${PROJECT_OD} ]
324then
325   echo " eee : ${PROJECT_OD} not reachable"
326   # nb : no exit because this file should be launched by login process
327fi
328if [ ! -w ${PROJECT_OD} ]
329then
330   echo " eee : ${PROJECT_OD} not writable"
331   # nb : no exit because this file should be launched by login process
332fi
333#
334JABREF_DIR=${jabrefdir}
335export JABREF_DIR
336unset jabref_dir
337JABREF_VERSION=${jabrefversion}
338export JABREF_VERSION
339unset jabrefversion
340#
341BIBTOOL_DIR=${bibtooldir}
342export BIBTOOL_DIR
343unset bibtooldir
344PATH=${BIBTOOL_DIR}:${PATH}
345export PATH
346#
347# end
348unset command
349# nb : no exit because this file should be launched by login process
Note: See TracBrowser for help on using the repository browser.