The branch, master has been updated
       via  72d9359... python: Remove sys.path line rather than updating it 
when installing to python system path.
      from  ff0f8bd... s3:winbind Make the normal client exit message a bit 
more understandable

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 72d93599d95cd8bb57823fd0d4934ca4373d162c
Author: Jelmer Vernooij <jel...@samba.org>
Date:   Sun Dec 27 17:30:59 2009 +0100

    python: Remove sys.path line rather than updating it when installing to 
python system path.

-----------------------------------------------------------------------

Summary of changes:
 source4/Makefile              |    2 +-
 source4/script/installmisc.sh |   40 +++++++++++++++++++++++++++-------------
 2 files changed, 28 insertions(+), 14 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/Makefile b/source4/Makefile
index 6a99ea3..0da1ee2 100644
--- a/source4/Makefile
+++ b/source4/Makefile
@@ -243,7 +243,7 @@ installman:: manpages installdirs
        @$(SHELL) $(srcdir)/script/installman.sh $(DESTDIR)$(mandir) $(MANPAGES)
 
 installmisc:: installdirs
-       @$(SHELL) $(srcdir)/script/installmisc.sh $(srcdir) 
$(DESTDIR)$(setupdir) $(DESTDIR)$(bindir) $(DESTDIR)$(sbindir) $(pythondir)
+       @$(SHELL) $(srcdir)/script/installmisc.sh "$(DESTDIR)" $(srcdir) 
$(DESTDIR)$(setupdir) $(DESTDIR)$(bindir) $(DESTDIR)$(sbindir) $(pythondir) 
$(PYTHON)
 
 installpc:: installdirs
        @$(SHELL) $(srcdir)/script/installpc.sh $(builddir) 
$(DESTDIR)$(pkgconfigdir) $(PC_FILES)
diff --git a/source4/script/installmisc.sh b/source4/script/installmisc.sh
index cb61862..c25b052 100755
--- a/source4/script/installmisc.sh
+++ b/source4/script/installmisc.sh
@@ -1,28 +1,42 @@
 #!/bin/sh
 # install miscellaneous files
 
-[ $# -eq 5 ] || {
-    echo "Usage: installmisc.sh SRCDIR SETUPDIR BINDDIR SBINDDIR PYTHONDIR"
+[ $# -eq 7 ] || {
+    echo "Usage: installmisc.sh DESTDIR SRCDIR SETUPDIR BINDDIR SBINDDIR 
PYTHONDIR PYTHON"
     exit 1
 }
 
-SRCDIR="$1"
-SETUPDIR="$2"
-BINDIR="$3"
-SBINDIR="$4"
-PYTHONDIR="$5"
+DESTDIR="$1"
+SRCDIR="$2"
+SETUPDIR="$3"
+BINDIR="$4"
+SBINDIR="$5"
+PYTHONDIR="$6"
+PYTHON="$7"
 
 cd $SRCDIR || exit 1
 
+if $PYTHON -c "import sys; sys.exit('$PYTHONDIR' in sys.path)"; then
+       PYTHON_PATH_NEEDS_FIXING=yes
+       echo "sys.path in python scripts will be updated to include $PYTHONDIR"
+else
+       PYTHON_PATH_NEEDS_FIXING=no
+fi
+
 # fixup a python script to use the right path
 fix_python_path() {
     f="$1"
-    egrep 'sys.path.insert.*bin/python' $f > /dev/null && {
-       # old systems don't have sed -i :-(
-       sed "s|\(sys.path.insert.*\)bin/python\(.*\)$|\1$PYTHONDIR\2|g" < $f > 
$f.$$ || exit 1
-       mv -f $f.$$ $f || exit 1
-       chmod +x $f
-    }
+    if egrep 'sys.path.insert.*bin/python' $f > /dev/null; then
+        if [ "$PYTHON_PATH_NEEDS_FIXING" = "yes" ]; then
+            # old systems don't have sed -i :-(
+            sed "s|\(sys.path.insert.*\)bin/python\(.*\)$|\1$PYTHONDIR\2|g" < 
$f > $f.$$ || exit 1
+        else
+            # old systems don't have sed -i :-(
+            sed "s|\(sys.path.insert.*\)bin/python\(.*\)$||g" < $f > $f.$$ || 
exit 1
+        fi
+        mv -f $f.$$ $f || exit 1
+        chmod +x $f
+    fi
 }
 
 echo "Installing setup templates"


-- 
Samba Shared Repository

Reply via email to