[Checkins] SVN: zc.buildout/trunk/ fixed usage of 'relative_paths' keyword parameter on Windows

Andreas Jung andreas at andreas-jung.com
Thu Jun 18 06:54:24 EDT 2009


Log message for revision 101123:
  fixed usage of 'relative_paths' keyword parameter on Windows
  

Changed:
  U   zc.buildout/trunk/CHANGES.txt
  U   zc.buildout/trunk/src/zc/buildout/easy_install.py
  U   zc.buildout/trunk/src/zc/buildout/easy_install.txt
  U   zc.buildout/trunk/src/zc/buildout/testing.py
  U   zc.buildout/trunk/src/zc/buildout/tests.py

-=-
Modified: zc.buildout/trunk/CHANGES.txt
===================================================================
--- zc.buildout/trunk/CHANGES.txt	2009-06-18 09:20:49 UTC (rev 101122)
+++ zc.buildout/trunk/CHANGES.txt	2009-06-18 10:54:24 UTC (rev 101123)
@@ -14,7 +14,9 @@
   tear down as it might disturb other packages reusing buildout's
   testing infrastructure.
 
+- fixed usage of 'relative_paths' keyword parameter on Windows
 
+
 1.2.1 (2009-03-18)
 ==================
 

Modified: zc.buildout/trunk/src/zc/buildout/easy_install.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/easy_install.py	2009-06-18 09:20:49 UTC (rev 101122)
+++ zc.buildout/trunk/src/zc/buildout/easy_install.py	2009-06-18 10:54:24 UTC (rev 101123)
@@ -967,9 +967,10 @@
 
 def _relative_path_and_setup(sname, path, relative_paths):
     if relative_paths:
-        sname = os.path.abspath(sname)
+        relative_paths = os.path.normcase(relative_paths)
+        sname = os.path.normcase(os.path.abspath(sname))
         spath = ',\n  '.join(
-            [_relativitize(path_item, sname, relative_paths)
+            [_relativitize(os.path.normcase(path_item), sname, relative_paths)
              for path_item in path]
             )
         rpsetup = relative_paths_setup

Modified: zc.buildout/trunk/src/zc/buildout/easy_install.txt
===================================================================
--- zc.buildout/trunk/src/zc/buildout/easy_install.txt	2009-06-18 09:20:49 UTC (rev 101122)
+++ zc.buildout/trunk/src/zc/buildout/easy_install.txt	2009-06-18 10:54:24 UTC (rev 101123)
@@ -717,9 +717,10 @@
 We can pass a keyword argument, extra paths, to cause additional paths
 to be included in the a generated script:
 
+    >>> foo = tmpdir('foo')
     >>> scripts = zc.buildout.easy_install.scripts(
     ...    ['demo'], ws, sys.executable, bin, dict(demo='run'),
-    ...    extra_paths=['/foo/bar'])
+    ...    extra_paths=[foo])
 
     >>> cat(bin, 'run') # doctest: +NORMALIZE_WHITESPACE
     #!/usr/local/bin/python2.4
@@ -728,7 +729,7 @@
     sys.path[0:0] = [
       '/sample-install/demo-0.3-py2.4.egg',
       '/sample-install/demoneeded-1.1-py2.4.egg',
-      '/foo/bar',
+      '/foo',
       ]
     <BLANKLINE>
     import eggrecipedemo
@@ -795,6 +796,7 @@
 to pass a common base directory of the scripts and eggs:
 
     >>> bo = tmpdir('bo')
+    >>> ba = tmpdir('ba')
     >>> mkdir(bo, 'eggs')
     >>> mkdir(bo, 'bin')
     >>> mkdir(bo, 'other')
@@ -805,7 +807,7 @@
 
     >>> scripts = zc.buildout.easy_install.scripts(
     ...    ['demo'], ws, sys.executable, join(bo, 'bin'), dict(demo='run'),
-    ...    extra_paths=[os.path.sep+'foo', join(bo, 'bar')],
+    ...    extra_paths=[ba, join(bo, 'bar')],
     ...    interpreter='py',
     ...    relative_paths=bo)
 
@@ -822,7 +824,7 @@
     sys.path[0:0] = [
       join(base, 'eggs/demo-0.3-pyN.N.egg'),
       join(base, 'eggs/demoneeded-1.1-pyN.N.egg'),
-      '/foo',
+      '/ba',
       join(base, 'bar'),
       ]
     <BLANKLINE>
@@ -855,7 +857,7 @@
     sys.path[0:0] = [
       join(base, 'eggs/demo-0.3-pyN.N.egg'),
       join(base, 'eggs/demoneeded-1.1-pyN.N.egg'),
-      '/foo',
+      '/ba',
       join(base, 'bar'),
       ]
     <BLANKLINE>

Modified: zc.buildout/trunk/src/zc/buildout/testing.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/testing.py	2009-06-18 09:20:49 UTC (rev 101122)
+++ zc.buildout/trunk/src/zc/buildout/testing.py	2009-06-18 10:54:24 UTC (rev 101123)
@@ -86,6 +86,8 @@
     fsync(f.fileno())
     f.close()
 
+## FIXME - check for other platforms
+MUST_CLOSE_FDS = not sys.platform.startswith('win')
 
 def system(command, input=''):
     p = subprocess.Popen(command,
@@ -93,7 +95,7 @@
                          stdin=subprocess.PIPE,
                          stdout=subprocess.PIPE,
                          stderr=subprocess.PIPE,
-                         close_fds=not is_win32)
+                         close_fds=MUST_CLOSE_FDS)
     i, o, e = (p.stdin, p.stdout, p.stderr)
     if input:
         i.write(input)
@@ -146,7 +148,7 @@
                              stdin=subprocess.PIPE,
                              stdout=subprocess.PIPE,
                              stderr=subprocess.STDOUT,
-                             close_fds=True)
+                             close_fds=MUST_CLOSE_FDS)
         i, o = (p.stdin, p.stdout)
         i.close()
         e = o.read().strip()
@@ -159,7 +161,7 @@
                              stdin=subprocess.PIPE,
                              stdout=subprocess.PIPE,
                              stderr=subprocess.STDOUT,
-                             close_fds=True)
+                             close_fds=MUST_CLOSE_FDS)
         i, o = (p.stdin, p.stdout)
         i.close()
         e = o.read().strip()
@@ -171,7 +173,7 @@
                                 stdin=subprocess.PIPE,
                                 stdout=subprocess.PIPE,
                                 stderr=subprocess.STDOUT,
-                                close_fds=True)
+                                close_fds=MUST_CLOSE_FDS)
             i, o = (p.stdin, p.stdout)
             i.close()
             e = o.read().strip()

Modified: zc.buildout/trunk/src/zc/buildout/tests.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/tests.py	2009-06-18 09:20:49 UTC (rev 101122)
+++ zc.buildout/trunk/src/zc/buildout/tests.py	2009-06-18 10:54:24 UTC (rev 101123)
@@ -2808,6 +2808,7 @@
                normalize_bang,
                (re.compile('extdemo[.]pyd'), 'extdemo.so'),
                (re.compile('[-d]  setuptools-\S+[.]egg'), 'setuptools.egg'),
+               (re.compile(r'\\[\\]?'), '/'),
                ]),
             ),
         doctest.DocTestSuite(



More information about the Checkins mailing list