Hello,

I had a small headache using Buildout this morning: I had a package which
contained a C extension and which was developed in my buildout.cfg file. I
wanted to see what was the gcc call used to build this extension, but using
as much as -v as I could (I stopped at ten), I didn't see anything more.

So, I dig in the code, and there was a typo in easy_install.py, which is
fixed in fix-verbose-develop.patch (this needs a test to be updated, BTW).
The fix was trivial (replacing "==" with "="), but I think the way args is
build is now better.


I propose also another patch (uniformize-args.patch), which refactors args
construction using a list instead of a tuple, which looks smarter (why a
tuple whereas it is updated several times?).
This is not mandatory for the fix, feel free to integrate it or not.

Cheers,

Jonathan
Index: src/zc/buildout/tests.py
===================================================================
--- src/zc/buildout/tests.py    (révision 105143)
+++ src/zc/buildout/tests.py    (copie de travail)
@@ -90,7 +90,7 @@
     Installing...
     Develop: '/sample-buildout/foo'
     in: '/sample-buildout/foo'
-    ... -q develop -mxN -d /sample-buildout/develop-eggs/...
+    ... -v develop -mxN -d /sample-buildout/develop-eggs/...
 
 
     """
Index: src/zc/buildout/easy_install.py
===================================================================
--- src/zc/buildout/easy_install.py     (révision 105143)
+++ src/zc/buildout/easy_install.py     (copie de travail)
@@ -873,18 +873,16 @@
         tmp3 = tempfile.mkdtemp('build', dir=dest)
         undo.append(lambda : shutil.rmtree(tmp3))
 
-        args = [
-            zc.buildout.easy_install._safe_arg(tsetup),
-            '-q', 'develop', '-mxN',
-            '-d', _safe_arg(tmp3),
-            ]
-
+        args = [zc.buildout.easy_install._safe_arg(tsetup)]
         log_level = logger.getEffectiveLevel()
-        if log_level <= 0:
-            if log_level == 0:
-                del args[1]
-            else:
-                args[1] == '-v'
+        if log_level < 0:
+            args.append('-v')
+        elif log_level > 0:
+            args.append('-q')
+
+        args.extend(['develop', '-mxN',
+                     '-d', _safe_arg(tmp3)])
+
         if log_level < logging.DEBUG:
             logger.debug("in: %r\n%s", directory, ' '.join(args))
 
diff -u src/zc/buildout/easy_install.py src/zc/buildout/easy_install.py
--- src/zc/buildout/easy_install.py     (copie de travail)
+++ src/zc/buildout/easy_install.py     (copie de travail)
@@ -301,16 +301,16 @@
                 ws, False,
                 )[0].location
 
-            args = ('-c', _easy_install_cmd, '-mUNxd', _safe_arg(tmp))
+            args = ['-c', _easy_install_cmd, '-mUNxd', _safe_arg(tmp)]
             if self._always_unzip:
-                args += ('-Z', )
+                args.append('-Z')
             level = logger.getEffectiveLevel()
             if level > 0:
-                args += ('-q', )
+                args.append('-q')
             elif level < 0:
-                args += ('-v', )
+                args.append('-v')
 
-            args += (_safe_arg(spec), )
+            args.append(_safe_arg(spec))
 
             if level <= logging.DEBUG:
                 logger.debug('Running easy_install:\n%s "%s"\npath=%s\n',
@@ -319,13 +319,13 @@
             if is_jython:
                 extra_env = dict(os.environ, PYTHONPATH=path)
             else:
-                args += (dict(os.environ, PYTHONPATH=path), )
+                args.append(dict(os.environ, PYTHONPATH=path))
 
             sys.stdout.flush() # We want any pending output first
 
             if is_jython:
                 exit_code = subprocess.Popen(
-                [_safe_arg(self._executable)] + list(args),
+                [_safe_arg(self._executable)] + args,
                 env=extra_env).wait()
             else:
                 exit_code = os.spawnle(
_______________________________________________
Distutils-SIG maillist  -  Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to