[gnue] r9562 - trunk/gnue-common

[email protected]
Newsgroups gmane.comp.cms.gnue.cvs
Message-ID <[email protected]>
Author: reinhard
Date: 2007-05-09 10:26:30 -0500 (Wed, 09 May 2007)
New Revision: 9562

Modified:
   trunk/gnue-common/setup.py
Log:
Fixed decision whether gnue.pth is necessary for cases where --root is used.


Modified: trunk/gnue-common/setup.py
===================================================================
--- trunk/gnue-common/setup.py	2007-05-08 23:51:41 UTC (rev 9561)
+++ trunk/gnue-common/setup.py	2007-05-09 15:26:30 UTC (rev 9562)
@@ -327,16 +327,20 @@
   # Quote a path: remove --root and duplicate backslashes
   # ---------------------------------------------------------------------------
 
-  def _quote (self, path):
-    if self.root:
-      r = self.root
-      if r [-1] == os.sep:
-        r = r [:-1]
-      p = path [len(r):]
-    else:
-      p = path
-    return p.replace("\\","\\\\")
+  def __quote (self, path):
+        return self.__remove_root(path).replace("\\","\\\\")
 
+  def __remove_root (self, path):
+        p = path
+        if self.root:
+            r = self.root
+            if r [-1] == os.sep:
+                r = r [:-1]
+            p = p[len(r):]
+        if p.endswith(os.sep):
+            p = p[:-1]
+        return p
+
   # ---------------------------------------------------------------------------
   # Create gnue.pth
   # ---------------------------------------------------------------------------
@@ -344,7 +348,8 @@
   def __write_gnue_pth (self):
 
     # we need gnue.pth only if we don't install in python's search path
-    if self.install_lib not in sys.path:
+    print self.__remove_root(self.install_lib)
+    if self.__remove_root(self.install_lib) not in sys.path:
       # where to install gnue.pth
       site_dir = get_python_lib ()
       if self.root:
@@ -360,7 +365,7 @@
       print "trying to create %s" % file
       try:
         output = open (file, "w")
-        output.write (self._quote (self.install_lib))
+        output.write (self.__quote (self.install_lib))
         output.close ()
         # It worked. Turn off error message about installing into directory
         # not in path.
@@ -384,8 +389,8 @@
     output.write ("# This file was generated during installation.\n")
     output.write ("import os, sys\n")
     output.write ("\n")
-    output.write ("lib     = \"%s\"\n" % self._quote (self.install_lib))
-    output.write ("scripts = \"%s\"\n" % self._quote (self.install_scripts))
+    output.write ("lib     = \"%s\"\n" % self.__quote (self.install_lib))
+    output.write ("scripts = \"%s\"\n" % self.__quote (self.install_scripts))
     output.write ("\n")
     output.write ("############################\n")
     output.write ("# This is a workaround for McMillan packaging!!!\n")
@@ -395,8 +400,8 @@
     output.write ("  data    = os.path.join(os.path.dirname (sys.argv[0]), '..')\n")
     output.write ("  config  = os.path.join(os.path.dirname (sys.argv[0]), '..\\etc')\n")
     output.write ("else:\n")
-    output.write ("  data    = \"%s\"\n" % self._quote (self.install_data))
-    output.write ("  config  = \"%s\"\n" % self._quote (self.install_config))
+    output.write ("  data    = \"%s\"\n" % self.__quote (self.install_data))
+    output.write ("  config  = \"%s\"\n" % self.__quote (self.install_config))
     output.close ()
     # Record file
     self.__outputs.append (file)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.