Package: python-setuptools
Version: 18.4-2
Severity: normal
Tags: patch

Dear Maintainer,

while debugging a case of /usr/lib/python2.7/dist-packages erroneously
being added to easy_install.pth when runnning "setup.py install --user"
for a package of mine, I found a possible bug in a Debian patch
to python-setuptools.

The function get_site_dirs in command/easy_install.py does not return
the system dist-packages path. The reason is that the current patch in
install-layout.diff modifies the wrong section of get_site_dirs. The
current version after applying install-layout.diff reads

[...]
if sys.platform in ('os2emx', 'riscos'):
    sitedirs.append(os.path.join(prefix, "Lib", "site-packages"))
elif os.sep == '/':
    sitedirs.extend([os.path.join(prefix,
                                  "lib",
                                  "python" + sys.version[:3],
                                  "site-packages"),
                     os.path.join(prefix, "lib", "site-python")])
else:
    if sys.version[:3] in ('2.3', '2.4', '2.5'):
        sdir = "site-packages"
    else:
        sdir = "dist-packages"
    sitedirs.extend(
        [os.path.join(prefix, "local/lib", "python" + sys.version[:3], sdir),
                     os.path.join(prefix, "lib", "python" + sys.version[:3], 
sdir)]
                    )
[...]

You can see that the modifications involving dist-packages are in the block for
the case that os.sep != '/', which is presumably never executed on Debian. I
think they should rather be included in the elif block.

I tried to fix the problem and prepared a debdiff of my changes against version
18.4-2. This fixed my original problem mentioned in the first paragraph.


Best,
Philipp


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

Kernel: Linux 4.2.0-1-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: systemd (via /run/systemd/system)

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

python-setuptools recommends no packages.

Versions of packages python-setuptools suggests:
pn  python-setuptools-doc  <none>

-- no debconf information
diff -Nru python-setuptools-18.4/debian/changelog python-setuptools-18.4/debian/changelog
--- python-setuptools-18.4/debian/changelog	2015-10-24 16:41:14.000000000 +0200
+++ python-setuptools-18.4/debian/changelog	2015-11-06 21:09:35.000000000 +0100
@@ -1,3 +1,9 @@
+python-setuptools (18.4-2.1~tux1) unstable; urgency=medium
+
+  * Correct return value for get_sire_dirs to use dist-packages.
+
+ -- Philipp Edelmann <[email protected]>  Fri, 06 Nov 2015 21:06:34 +0100
+
 python-setuptools (18.4-2) unstable; urgency=medium
 
   * Don't install the SOURCES.txt egg-info file when setup.py is called
diff -Nru python-setuptools-18.4/debian/patches/install-layout.diff python-setuptools-18.4/debian/patches/install-layout.diff
--- python-setuptools-18.4/debian/patches/install-layout.diff	2015-10-24 16:19:26.000000000 +0200
+++ python-setuptools-18.4/debian/patches/install-layout.diff	2015-11-06 21:22:05.000000000 +0100
@@ -1,5 +1,3 @@
-Index: b/setuptools/command/easy_install.py
-===================================================================
 --- a/setuptools/command/easy_install.py
 +++ b/setuptools/command/easy_install.py
 @@ -134,13 +134,15 @@ class easy_install(Command):
@@ -108,25 +106,26 @@
              for attr, val in scheme.items():
                  if getattr(self, attr, None) is None:
                      setattr(self, attr, val)
-@@ -1328,9 +1372,14 @@ def get_site_dirs():
-                                               "site-packages"),
-                                  os.path.join(prefix, "lib", "site-python")])
-             else:
+@@ -1322,11 +1366,14 @@ def get_site_dirs():
+             if sys.platform in ('os2emx', 'riscos'):
+                 sitedirs.append(os.path.join(prefix, "Lib", "site-packages"))
+             elif os.sep == '/':
+-                sitedirs.extend([os.path.join(prefix,
+-                                              "lib",
+-                                              "python" + sys.version[:3],
+-                                              "site-packages"),
+-                                 os.path.join(prefix, "lib", "site-python")])
 +                if sys.version[:3] in ('2.3', '2.4', '2.5'):
 +                    sdir = "site-packages"
 +                else:
 +                    sdir = "dist-packages"
-                 sitedirs.extend(
--                    [prefix, os.path.join(prefix, "lib", "site-packages")]
--                )
++                sitedirs.extend(
 +                    [os.path.join(prefix, "local/lib", "python" + sys.version[:3], sdir),
 +                     os.path.join(prefix, "lib", "python" + sys.version[:3], sdir)]
 +                    )
-             if sys.platform == 'darwin':
-                 # for framework builds *only* we add the standard Apple
-                 # locations. Currently only per-user, but /Library and
-Index: b/setuptools/command/install_egg_info.py
-===================================================================
+             else:
+                 sitedirs.extend(
+                     [prefix, os.path.join(prefix, "lib", "site-packages")]
 --- a/setuptools/command/install_egg_info.py
 +++ b/setuptools/command/install_egg_info.py
 @@ -1,5 +1,5 @@

Attachment: signature.asc
Description: PGP signature

Reply via email to