Package: python-setuptools
Version: 16.0-1
Severity: normal

I know setuptools/pip/etc are in flux, so this may be premature.

To work around bugs in the (older) version of Pip that sid currently has
(#786440), I uninstalled python-pip and python-wheel, and installed the
current pip directly from source. Then I attempted to build a wheel
for one package ('pip wheel zope.interface'). I got an error from the
system-installed setuptools:

    File "/usr/lib/python2.7/dist-packages/setuptools/command/install_lib.py", 
line 129, in pf
      if new_suffix and self.multiarch and dst.endswith(ext_suffix) and not 
dst.endswith(new_suffix):
  NameError: free variable 'new_suffix' referenced before assignment in 
enclosing scope

It appears that the debian-specific patching of install_lib.py (from
debian/patches/multiarch-extname.diff) has a bug:

@@ -97,12 +112,24 @@ class install_lib(orig.install_lib):

         outfiles = []

+        if self.multiarch:
+            import sysconfig
+            ext_suffix = sysconfig.get_config_var ('EXT_SUFFIX')
+            if ext_suffix.endswith(_multiarch + ext_suffix[-3:]):
+                new_suffix = None
+            else:
+                new_suffix = "%s-%s%s" % (ext_suffix[:-3], self.multiarch, 
ext_suffix[-3:])
+
         def pf(src, dst):
             if dst in exclude:
                 log.warn("Skipping installation of %s (namespace package)",
                          dst)
                 return False

+            if new_suffix and self.multiarch and dst.endswith(ext_suffix) and 
not dst.endswith(new_suffix):
+                dst = dst.replace(ext_suffix, new_suffix)
+                log.info("renaming extension to %s", os.path.basename(dst))
+

If self.multiarch is ever False, then the 'if new_suffix..' line inside
pf() will reference the non-existent 'new_suffix'.

I'd suggest swapping the conditions in that line:

  if self.multiarch and new_suffix and ...

so that the test will be short-circuited in the non-multiarch case.
Patching it this way seems to allow me to build wheels again.


Steps To Reproduce:
 dpkg --purge python-pip python-wheel
 apt-get install python-setuptools
 curl https://bootstrap.pypa.io/get-pip.py | sudo python
 pip wheel zope.interface
Expected:
 a zope.interface .whl file in the current directory
Got Instead:
 the exception described above

cheers,
 -Brian



-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages python-setuptools depends on:
ii  python-pkg-resources  16.0-1
pn  python:any            <none>

python-setuptools recommends no packages.

python-setuptools suggests no packages.

-- no debconf information


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to