##@cooked comments # -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 ## Configurer l'accès aux librairies python *locales* de pyulib ##@cooked nocomments # Modifier PYTHONPATH de façon que les librairies de pyulib *locales* soient # accessibles. N'utiliser ce fichier que dans le cas où la librairie pyulib # n'est pas installée sur le système. # Ce fichier doit être *sourcé*. Si ce fichier n'est pas sourcé, alors le # répertoire pyulib doit être disponible dans le répertoire du script qui inclue # ce fichier. Ceci peut-être fait avec 'ulibsync -p' ## Calculer l'emplacement de pyulib # il est possible de forcer la valeur de PYULIBDIR avec FORCED_PYULIBDIR. ceci # est utile avec bash 2.x qui ne supporte pas la variable BASH_SOURCE PYULIBDIR="$FORCED_PYULIBDIR" if [ -z "$PYULIBDIR" ]; then PYULIBDIR="${BASH_SOURCE[0]}" if [ -n "$PYULIBDIR" -a -f "$PYULIBDIR" ]; then # Fichier sourcé PYULIBDIR="$(dirname "$PYULIBDIR")/../../pyulib" else # Fichier non sourcé. Tout exprimer par rapport au script courant PYULIBDIR="$(dirname "$0")" if [ -d "$PYULIBDIR/pyulib" ]; then PYULIBDIR="$PYULIBDIR/pyulib" elif [ -d "$PYULIBDIR/lib/pyulib" ]; then PYULIBDIR="$PYULIBDIR/lib/pyulib" fi fi fi PYULIBDIR="$(cd "$PYULIBDIR" 2>/dev/null; pwd)" export PYTHONPATH="$PYULIBDIR/src${PYTHONPATH:+:$PYTHONPATH}" function pyulibsync() { # Synchroniser les librairies pyulib dans le répertoire $1 local destdir="$(abspath "${1:-.}")" local __CPNOVCS_RSYNC_ARGS=(-q --delete) [ "$destdir/pyulib" != "$PYULIBDIR" ] && cpdirnovcs "$PYULIBDIR" "$destdir/pyulib" }