Control: tag -1 + patch

Hi Matthias (2015.02.26_10:20:31_-0800)
> please could you provide a patch?

I've had a shot at this.

It was non-trivial, as python-setuptools isn't in the best shape.
There's a little brokenness in the source package, a lot of duplicated
code, and some dead code.

I get the feeling that it originally tried to be entirely
self-supported, with no external dependencies. But over time, it has
gained dependencies on dh_pythonX, without getting a whole lot of
clean-up.

I don't know what the purpose of being entirely self-supported would be.
This is an arch-indep package, that isn't involved in arch
bootstrapping. It's a build-dependency for *many* Python packages, but
otherwise I don't think it's particularly special.

Another source of complication are the version-suffixed easy_install
binaries. I think we can drop those, without anyone caring. This is a
route we've been taking in other packages, with no fallout I've seen, so
far. codesearch.debian.net shows up no direct use of them. And I'm sure
the vast majority of users use pip rather than easy_install.

So, I have two options attached.

minimal.debdiff:
 debian/changelog |    7 +++++++
 debian/control   |   26 +++++++++++++++++++++++++-
 debian/rules     |   43 ++++++++++++++++++++++++++++++++++++++++---
 3 files changed, 72 insertions(+), 4 deletions(-)

A minimal patch that adds a set of pypy binaries. This increases code
duplication, as /usr/share/python3/python.mk doesn't know anything about
pypy.

python-setuptools_17.0-1+pybuild.debdiff:
 debian/README.Debian                 |    6 -
 debian/changelog                     |   20 +++
 debian/compat                        |    2 
 debian/control                       |   45 +++----
 debian/patches/fix-python3.5.diff    |    2 
 debian/patches/install-layout.diff   |   20 ---
 debian/python-pkg-resources.install  |    1 
 debian/python-setuptools.install     |    4 
 debian/python3-pkg-resources.install |    1 
 debian/python3-setuptools.install    |    4 
 debian/rules                         |  207 ++++-------------------------------
 11 files changed, 82 insertions(+), 230 deletions(-)

python-setuptools_17.0-1+pybuild+pypy.debdiff:
 debian/changelog                  |    6 ++++++
 debian/control                    |   23 +++++++++++++++++++++++
 debian/pypy-pkg-resources.install |    1 +
 debian/pypy-setuptools.install    |    4 ++++
 debian/rules                      |   19 ++++++++++++++-----
 5 files changed, 48 insertions(+), 5 deletions(-)

Two patches that port setuptools to pybulid, and then (trivially) add
pypy binary packages. There is a large amount of unrelated cleanup in
the pybuild patch, because the alternative would be to re-implement what
I think is unnecessary cruft.

Take your pick :)

SR

-- 
Stefano Rivera
  http://tumbleweed.org.za/
  +1 415 683 3272
diff -Nru python-setuptools-17.0/debian/changelog 
python-setuptools-17.0/debian/changelog
--- python-setuptools-17.0/debian/changelog     2015-05-29 06:14:38.000000000 
-0700
+++ python-setuptools-17.0/debian/changelog     2015-07-05 20:23:16.000000000 
-0700
@@ -1,3 +1,10 @@
+python-setuptools (17.0-1+pypy) UNRELEASED; urgency=medium
+
+  * Add binary packages for pypy.
+    - Build-Depend on dh-python and pypy.
+
+ -- Stefano Rivera <stefa...@debian.org>  Sun, 05 Jul 2015 18:45:21 -0700
+
 python-setuptools (17.0-1) unstable; urgency=medium
 
   * New upstream version.
diff -Nru python-setuptools-17.0/debian/control 
python-setuptools-17.0/debian/control
--- python-setuptools-17.0/debian/control       2015-05-19 06:37:18.000000000 
-0700
+++ python-setuptools-17.0/debian/control       2015-07-05 18:46:52.000000000 
-0700
@@ -5,7 +5,9 @@
 Build-Depends-Indep: python-all-dev (>= 2.6.6-2~), python3-all-dev (>= 
3.1.2-8~),
   python3.5-dev,
   python3-sphinx,
-  python3-wheel
+  python3-wheel,
+  dh-python,
+  pypy
 Build-Depends: debhelper (>= 5.0.37.1), python3
 Standards-Version: 3.9.6
 Homepage: https://pypi.python.org/pypi/setuptools
@@ -68,6 +70,28 @@
 Description: Python3 Distutils Enhancements
  Extensions to the python-distutils for large or complex distributions.
 
+Package: pypy-pkg-resources
+Suggests: pypy-setuptools
+Architecture: all
+Depends: ${misc:Depends}, ${pypy:Depends}
+Description: Package Discovery and Resource Access using pkg_resources
+ The pkg_resources module provides an API for Python libraries to
+ access their resource files, and for extensible applications and
+ frameworks to automatically discover plugins.  It also provides
+ runtime support for using C extensions that are inside zipfile-format
+ eggs, support for merging packages that have separately-distributed
+ modules or subpackages, and APIs for managing Python's current
+ "working set" of active packages.
+
+Package: pypy-setuptools
+Architecture: all
+Depends:
+ pypy-pkg-resources (= ${binary:Version}),
+ ${misc:Depends},
+ ${pypy:Depends}
+Description: PyPy Distutils Enhancements
+ Extensions to the python-distutils for large or complex distributions.
+
 Package: python-setuptools-whl
 Architecture: all
 Depends: ${python3:Depends}, ${misc:Depends}
diff -Nru python-setuptools-17.0/debian/rules 
python-setuptools-17.0/debian/rules
--- python-setuptools-17.0/debian/rules 2015-05-19 06:16:53.000000000 -0700
+++ python-setuptools-17.0/debian/rules 2015-07-05 20:22:15.000000000 -0700
@@ -33,7 +33,7 @@
 build: build-stamp
 build-arch: build-stamp
 build-indep: build-stamp build-doc-stamp
-build-stamp: $(PYVERS:%=build-python%) $(PYVERS3:%=build-python%) 
build-doc-stamp
+build-stamp: $(PYVERS:%=build-python%) $(PYVERS3:%=build-python%) build-pypy 
build-doc-stamp
        touch $@
 build-doc-stamp:
        $(MAKE) -C docs html
@@ -43,6 +43,9 @@
 build-python%: pre-build-stamp
        python$* setup.py build
        touch $@
+build-pypy: pre-build-stamp
+       pypy setup.py build
+       touch $@
 pre-build-stamp:
        [ -d setuptools.egg-info.saved ] || cp -a setuptools.egg-info 
setuptools.egg-info.saved
        touch $@
@@ -50,7 +53,7 @@
 clean:
        dh_testdir
        dh_testroot
-       rm -f build-python* build-doc-stamp build-stamp
+       rm -f build-python* build-pypy build-doc-stamp build-stamp 
pre-build-stamp
        rm -rf build dist
        -find -name __pycache__ | xargs rm -rf
        -find -name '*.py[co]' | xargs rm -f
@@ -62,15 +65,18 @@
        fi
        dh_clean
 
-install: build install-prereq $(PYVERS:%=install-python%) 
$(PYVERS3:%=install-python%) install-wheel
+install: build install-prereq $(PYVERS:%=install-python%) 
$(PYVERS3:%=install-python%) install-pypy install-wheel
        find debian -name 'setuptools_boot.py*' | xargs -r rm -f
        find debian -name '*.py[co]' | xargs -r rm -f
        pkgs=$$(dh_listpackages); cd debian && find $$pkgs -mindepth 1 -type d 
-empty -print -delete
 
        rm -f debian/python-*/usr/bin/easy_install-3*
        rm -f debian/python3-*/usr/bin/easy_install-2*
+       rm -f debian/pypy-*/usr/bin/easy_install-2*
        mv debian/python3-setuptools/usr/bin/easy_install \
          debian/python3-setuptools/usr/bin/easy_install3
+       mv debian/pypy-setuptools/usr/bin/easy_install \
+         debian/pypy-setuptools/usr/bin/easy_install-pypy
 
        : # Replace all '#!' calls to python with $(PYTHON)
        : # and make them executable
@@ -104,6 +110,21 @@
          fi; \
        done
 
+       for i in \
+         `find debian/pypy-*/usr/lib debian/pypy-*/usr/bin -type f`; \
+       do \
+         case "$$i" in *-[0-9].[0-9]) continue; esac; \
+         sed '1s,#!.*python[^ ]*\(.*\),#! /usr/bin/pypy\1,' \
+               $$i > $$i.temp; \
+         if cmp --quiet $$i $$i.temp; then \
+           rm -f $$i.temp; \
+         else \
+           mv -f $$i.temp $$i; \
+           chmod 755 $$i; \
+           echo "fixed interpreter: $$i"; \
+         fi; \
+       done
+
 install-prereq:
        dh_testdir
        dh_testroot
@@ -124,6 +145,20 @@
        echo setuptools-$(SETUPTOOLSVER).egg-info \
          > $(call pname,$(d_setp),$*)/$(call py_libdir,$*)/setuptools.pth
 
+install-pypy:
+       dh_installdirs -A usr/bin /usr/lib/pypy/dist-packages/
+       pypy setup.py install \
+         --install-layout=deb \
+         --install-scripts=/usr/bin \
+         --root=$(CURDIR)/debian/pypy-setuptools
+
+       mv debian/pypy-setuptools/usr/lib/pypy/dist-packages/pkg_resources \
+          debian/pypy-pkg-resources/usr/lib/pypy/dist-packages
+       
+       # dh_pypy from dh-python < 1.20150705-1 falls over requires.txt
+       # and our requires.txt aren't useful
+       find debian/pypy-setuptools -name requires.txt -delete
+
 install-wheel:
        mkdir -p debian/python-setuptools-whl/usr/share/python-wheels
        python3 setup.py bdist_wheel --universal \
@@ -170,6 +205,8 @@
        cat debian/$(call pname,$(p_setp),3.4).substvars
        cat debian/$(call pname,$(p_pkgr),3.4).substvars
 
+       dh_pypy -p pypy-setuptools -p pypy-pkg-resources
+
 ##     cp $(d_setp).substvars $(d_dist).substvars
 
        ( \
diff -Nru python-setuptools-17.0/debian/changelog 
python-setuptools-17.0/debian/changelog
--- python-setuptools-17.0/debian/changelog     2015-05-29 06:14:38.000000000 
-0700
+++ python-setuptools-17.0/debian/changelog     2015-07-05 18:56:12.000000000 
-0700
@@ -1,3 +1,23 @@
+python-setuptools (17.0-1+pybuild) UNRELEASED; urgency=medium
+
+  * Port to pybuild:
+    - Build-Depend on dh-python.
+  * Bump debhelper compat to 9 (and Build-Depends to >= 9)
+  * Replace unnecessary dependencies on python*-all-dev packages with -all.
+  * Drop deprecated ${python:Versions} and ${python:Provides} substitutions.
+  * Drop constraints on packages that pre-date oldoldstable.
+  * Add Suggests: python-setuptools on python-pkg-resources, matching
+    python3-pkg-resources.
+  * Drop ancient and irrelevant README.Debian.
+  * Use dh_sphinxdoc's generated dependencies.
+  * Replace accidental /usr/share/doc/html symlink with the intended
+    /usr/share/doc/python3-setuptools/html.
+  * Drop unnecessary easy_install-X.Y binaries.
+    Users can use pythonX.Y -m easy_install, instead.
+  * Drop .pth file. No longer necessary, we don't install eggs.
+
+ -- Stefano Rivera <stefa...@debian.org>  Sun, 05 Jul 2015 09:59:51 -0700
+
 python-setuptools (17.0-1) unstable; urgency=medium
 
   * New upstream version.
diff -Nru python-setuptools-17.0/debian/compat 
python-setuptools-17.0/debian/compat
--- python-setuptools-17.0/debian/compat        2013-05-08 15:05:03.000000000 
-0700
+++ python-setuptools-17.0/debian/compat        2015-07-05 10:00:37.000000000 
-0700
@@ -1 +1 @@
-5
+9
diff -Nru python-setuptools-17.0/debian/control 
python-setuptools-17.0/debian/control
--- python-setuptools-17.0/debian/control       2015-05-19 06:37:18.000000000 
-0700
+++ python-setuptools-17.0/debian/control       2015-07-05 11:37:18.000000000 
-0700
@@ -2,20 +2,20 @@
 Section: python
 Priority: optional
 Maintainer: Matthias Klose <d...@debian.org>
-Build-Depends-Indep: python-all-dev (>= 2.6.6-2~), python3-all-dev (>= 
3.1.2-8~),
-  python3.5-dev,
-  python3-sphinx,
-  python3-wheel
-Build-Depends: debhelper (>= 5.0.37.1), python3
+Build-Depends:
+ debhelper (>= 9),
+ dh-python,
+ python-all,
+ python3-all,
+ python3-sphinx,
+ python3-wheel
 Standards-Version: 3.9.6
 Homepage: https://pypi.python.org/pypi/setuptools
 
 Package: python-pkg-resources
+Suggests: python-setuptools
 Architecture: all
-Depends: ${python:Depends}, ${misc:Depends}
-Conflicts: python-setuptools (<< 0.6c8-3)
-Provides: ${python:Provides}
-XB-Python-Version: ${python:Versions}
+Depends: ${misc:Depends}, ${python:Depends}
 Description: Package Discovery and Resource Access using pkg_resources
  The pkg_resources module provides an API for Python libraries to
  access their resource files, and for extensible applications and
@@ -27,30 +27,26 @@
 
 Package: python-setuptools
 Architecture: all
-Depends: ${python:Depends}, python-pkg-resources (= ${binary:Version}), 
${misc:Depends}
-Conflicts: python-distribute (<< 0.7)
-Replaces: python-distribute (<< 0.6.6)
-Provides: ${python:Provides}, python-distribute
-XB-Python-Version: ${python:Versions}
+Depends:
+ python-pkg-resources (= ${binary:Version}),
+ ${misc:Depends},
+ ${python:Depends}
+Provides: python-distribute
 Description: Python Distutils Enhancements
  Extensions to the python-distutils for large or complex distributions.
 
 Package: python-setuptools-doc
 Architecture: all
 Section: doc
-Depends: libjs-jquery, ${misc:Depends}
-Conflicts: python-distribute-doc
-Replaces: python-distribute-doc
+Depends: ${misc:Depends}, ${sphinxdoc:Depends}
 Description: Python Distutils Enhancements (documentation)
  Extensions to the Python distutils for large or complex distributions.
  The package contains the documentation in html format.
 
 Package: python3-pkg-resources
 Architecture: all
-Depends: ${python3:Depends}, ${misc:Depends}
-Provides: ${python3:Provides}
+Depends: ${misc:Depends}, ${python3:Depends}
 Suggests: python3-setuptools
-Conflicts: python-pkg-resources (= 0.6.10-2)
 Description: Package Discovery and Resource Access using pkg_resources
  The pkg_resources module provides an API for Python libraries to
  access their resource files, and for extensible applications and
@@ -62,15 +58,16 @@
 
 Package: python3-setuptools
 Architecture: all
-Depends: ${python3:Depends}, python3-pkg-resources (= ${binary:Version}), 
${misc:Depends}
-Provides: ${python3:Provides}
-Conflicts: python-setuptools (= 0.6.10-2), python3.5 (<< 3.5.0~a4-5)
+Depends:
+ python3-pkg-resources (= ${binary:Version}),
+ ${misc:Depends},
+ ${python3:Depends}
 Description: Python3 Distutils Enhancements
  Extensions to the python-distutils for large or complex distributions.
 
 Package: python-setuptools-whl
 Architecture: all
-Depends: ${python3:Depends}, ${misc:Depends}
+Depends: ${misc:Depends}
 Description: Python Distutils Enhancements (wheel package)
  Extensions to the python-distutils for large or complex distributions.
  .
diff -Nru python-setuptools-17.0/debian/patches/fix-python3.5.diff 
python-setuptools-17.0/debian/patches/fix-python3.5.diff
--- python-setuptools-17.0/debian/patches/fix-python3.5.diff    2015-05-19 
03:19:05.000000000 -0700
+++ python-setuptools-17.0/debian/patches/fix-python3.5.diff    2015-07-05 
11:36:51.000000000 -0700
@@ -2,7 +2,7 @@
 ===================================================================
 --- a/setup.py
 +++ b/setup.py
-@@ -155,7 +155,6 @@ setup_params = dict(
+@@ -150,7 +150,6 @@ setup_params = dict(
          Topic :: Utilities
          """).strip().splitlines(),
      extras_require={
diff -Nru python-setuptools-17.0/debian/patches/install-layout.diff 
python-setuptools-17.0/debian/patches/install-layout.diff
--- python-setuptools-17.0/debian/patches/install-layout.diff   2015-05-19 
03:01:39.000000000 -0700
+++ python-setuptools-17.0/debian/patches/install-layout.diff   2015-07-05 
11:36:20.000000000 -0700
@@ -1,23 +1,3 @@
-Index: b/setup.py
-===================================================================
---- a/setup.py
-+++ b/setup.py
-@@ -43,8 +43,13 @@ def _gen_console_scripts():
-     )
-     if any(os.environ.get(var) not in (None, "", "0") for var in var_names):
-         return
--    yield ("easy_install-{shortver} = setuptools.command.easy_install:main"
--        .format(shortver=sys.version[:3]))
-+    if 'XPYVERS' in os.environ:
-+        for version in os.environ['XPYVERS'].split():
-+            yield ("easy_install-{shortver} = 
setuptools.command.easy_install:main"
-+                   .format(shortver=sys.version[:3]))
-+    else:
-+        yield ("easy_install-{shortver} = 
setuptools.command.easy_install:main"
-+               .format(shortver=sys.version[:3]))
- 
- console_scripts = list(_gen_console_scripts())
- 
 Index: b/setuptools/command/easy_install.py
 ===================================================================
 --- a/setuptools/command/easy_install.py
diff -Nru python-setuptools-17.0/debian/python3-pkg-resources.install 
python-setuptools-17.0/debian/python3-pkg-resources.install
--- python-setuptools-17.0/debian/python3-pkg-resources.install 1969-12-31 
16:00:00.000000000 -0800
+++ python-setuptools-17.0/debian/python3-pkg-resources.install 2015-07-05 
10:59:35.000000000 -0700
@@ -0,0 +1 @@
+/usr/lib/python3.*/*-packages/pkg_resources
diff -Nru python-setuptools-17.0/debian/python3-setuptools.install 
python-setuptools-17.0/debian/python3-setuptools.install
--- python-setuptools-17.0/debian/python3-setuptools.install    1969-12-31 
16:00:00.000000000 -0800
+++ python-setuptools-17.0/debian/python3-setuptools.install    2015-07-05 
11:29:27.000000000 -0700
@@ -0,0 +1,4 @@
+/usr/lib/python3.*/*-packages/_markerlib
+/usr/lib/python3.*/*-packages/easy_install*
+/usr/lib/python3.*/*-packages/setuptools*
+/usr/bin/easy_install3
diff -Nru python-setuptools-17.0/debian/python-pkg-resources.install 
python-setuptools-17.0/debian/python-pkg-resources.install
--- python-setuptools-17.0/debian/python-pkg-resources.install  1969-12-31 
16:00:00.000000000 -0800
+++ python-setuptools-17.0/debian/python-pkg-resources.install  2015-07-05 
10:59:35.000000000 -0700
@@ -0,0 +1 @@
+/usr/lib/python2.*/*-packages/pkg_resources
diff -Nru python-setuptools-17.0/debian/python-setuptools.install 
python-setuptools-17.0/debian/python-setuptools.install
--- python-setuptools-17.0/debian/python-setuptools.install     1969-12-31 
16:00:00.000000000 -0800
+++ python-setuptools-17.0/debian/python-setuptools.install     2015-07-05 
11:19:07.000000000 -0700
@@ -0,0 +1,4 @@
+/usr/lib/python2.*/*-packages/_markerlib
+/usr/lib/python2.*/*-packages/easy_install*
+/usr/lib/python2.*/*-packages/setuptools*
+/usr/bin/easy_install
diff -Nru python-setuptools-17.0/debian/README.Debian 
python-setuptools-17.0/debian/README.Debian
--- python-setuptools-17.0/debian/README.Debian 2013-05-08 15:05:03.000000000 
-0700
+++ python-setuptools-17.0/debian/README.Debian 1969-12-31 16:00:00.000000000 
-0800
@@ -1,6 +0,0 @@
-python-setuptools for Debian
-----------------------------
-
-Snapshot, taken from the sandbox CVS.
-
- -- Matthias Klose <m...@klose.in-berlin.de>, Tue, 14 Dec 2004 12:45:14 +0100
diff -Nru python-setuptools-17.0/debian/rules 
python-setuptools-17.0/debian/rules
--- python-setuptools-17.0/debian/rules 2015-05-19 06:16:53.000000000 -0700
+++ python-setuptools-17.0/debian/rules 2015-07-05 11:32:40.000000000 -0700
@@ -1,188 +1,39 @@
 #!/usr/bin/make -f
-# -*- makefile -*-
 
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
+%:
+       dh $@ --with python2,python3,sphinxdoc --buildsystem pybuild
 
-# This has to be exported to make some magic below work.
-export DH_OPTIONS
+override_dh_auto_test:
 
-# setuptools doesn't handle translated messages
-export LC_ALL=C
-
-#PYVERS        := 2.3 2.5 $(shell pyversions -vr debian/control)
-XPYVERS        := 2.7
-PYVERS := 2.7
-PYVERS3        := 3.4 3.5
-PYVER   := $(shell python -c 'import sys; print sys.version[:3]')
-SETUPTOOLSVER=1.3.2
-export XPYVERS
-
-include /usr/share/python3/python.mk
-
-pname = $(if $(findstring 3.,$(2)),$(subst python-,python3-,$(1)),$(1))
-
-p_pkgr = python-pkg-resources
-p_setp = python-setuptools
-p_doc  = python-setuptools-doc
-
-d_pkgr = debian/$(p_pkgr)
-d_setp = debian/$(p_setp)
-d_doc  = debian/$(p_doc)
-
-build: build-stamp
-build-arch: build-stamp
-build-indep: build-stamp build-doc-stamp
-build-stamp: $(PYVERS:%=build-python%) $(PYVERS3:%=build-python%) 
build-doc-stamp
-       touch $@
-build-doc-stamp:
-       $(MAKE) -C docs html
-#      PYTHONPATH=$(CURDIR) \
-#              sh -c 'cd docs && sphinx-build -b html -d build/doctrees . 
build/html'
-       touch $@
-build-python%: pre-build-stamp
-       python$* setup.py build
-       touch $@
-pre-build-stamp:
-       [ -d setuptools.egg-info.saved ] || cp -a setuptools.egg-info 
setuptools.egg-info.saved
-       touch $@
-
-clean:
-       dh_testdir
-       dh_testroot
-       rm -f build-python* build-doc-stamp build-stamp
-       rm -rf build dist
-       -find -name __pycache__ | xargs rm -rf
-       -find -name '*.py[co]' | xargs rm -f
-       rm -rf docs/build
-       rm -f template* \(dev\).py \(dev\).tmpl
-       if [ -d setuptools.egg-info.saved ]; then \
-               rm -rf setuptools.egg-info; \
-               mv setuptools.egg-info.saved setuptools.egg-info; \
-       fi
-       dh_clean
-
-install: build install-prereq $(PYVERS:%=install-python%) 
$(PYVERS3:%=install-python%) install-wheel
-       find debian -name 'setuptools_boot.py*' | xargs -r rm -f
-       find debian -name '*.py[co]' | xargs -r rm -f
-       pkgs=$$(dh_listpackages); cd debian && find $$pkgs -mindepth 1 -type d 
-empty -print -delete
-
-       rm -f debian/python-*/usr/bin/easy_install-3*
-       rm -f debian/python3-*/usr/bin/easy_install-2*
-       mv debian/python3-setuptools/usr/bin/easy_install \
-         debian/python3-setuptools/usr/bin/easy_install3
-
-       : # Replace all '#!' calls to python with $(PYTHON)
-       : # and make them executable
-       for i in \
-         `find debian/python-*/usr/lib debian/python-*/usr/bin -type f`; \
-       do \
-         case "$$i" in *-[0-9].[0-9]) continue; esac; \
-         sed '1s,#!.*python[^ ]*\(.*\),#! /usr/bin/python\1,' \
-               $$i > $$i.temp; \
-         if cmp --quiet $$i $$i.temp; then \
-           rm -f $$i.temp; \
-         else \
-           mv -f $$i.temp $$i; \
-           chmod 755 $$i; \
-           echo "fixed interpreter: $$i"; \
-         fi; \
-       done
-
-       for i in \
-         `find debian/python3-*/usr/lib debian/python3-*/usr/bin -type f`; \
-       do \
-         case "$$i" in *-[0-9].[0-9]) continue; esac; \
-         sed '1s,#!.*python[^ ]*\(.*\),#! /usr/bin/python3\1,' \
-               $$i > $$i.temp; \
-         if cmp --quiet $$i $$i.temp; then \
-           rm -f $$i.temp; \
-         else \
-           mv -f $$i.temp $$i; \
-           chmod 755 $$i; \
-           echo "fixed interpreter: $$i"; \
-         fi; \
-       done
-
-install-prereq:
-       dh_testdir
-       dh_testroot
-       dh_clean -k
-
-install-python%:
-       dh_installdirs -A usr/bin /$(call py_libdir,$*)
-       python$* setup.py install \
-         --root=$(CURDIR)/$(call pname,$(d_setp),$*) --install-layout=deb
-
-       tar -c -f - -C $(call pname,$(d_setp),$*)/$(call py_libdir,$*) 
pkg_resources \
-         | tar -x -f - -C $(call pname,$(d_pkgr),$*)/$(call py_libdir,$*)
-       rm -rf $(call pname,$(d_setp),$*)/$(call py_libdir,$*)/pkg_resources
-
-#      mv $(call pname,$(d_setp),$*)/$(call 
py_libdir,$*)/setuptools-$(SETUPTOOLSVER).egg-info \
-#        $(call pname,$(d_setp),$*)/$(call py_libdir,$*)/setuptools.egg-info
+override_dh_auto_install:
+       dh_auto_install
 
-       echo setuptools-$(SETUPTOOLSVER).egg-info \
-         > $(call pname,$(d_setp),$*)/$(call py_libdir,$*)/setuptools.pth
+       $(MAKE) -C docs html
 
-install-wheel:
        mkdir -p debian/python-setuptools-whl/usr/share/python-wheels
        python3 setup.py bdist_wheel --universal \
                -d debian/python-setuptools-whl/usr/share/python-wheels
-       dh_installdirs -ppython-setuptools-whl usr/share
-
-binary-arch:
-
-binary-indep: build install
-       dh_testdir
-       dh_testroot
-       dh_installchangelogs -p$(p_setp) CHANGES.txt
-       dh_installchangelogs -N$(p_setp)
-       dh_installdocs -N$(p_setp) -N$(p_pkgr)
-       dh_installdocs -p$(p_pkgr) docs/pkg_resources.txt
-       dh_installdocs -p$(p_setp) -Xpkg_resources docs/*.txt
-       mkdir -p $(d_doc)/usr/share/doc/$(p_doc)
-       cp -pr docs/build/html $(d_doc)/usr/share/doc/$(p_doc)/
-       dh_sphinxdoc -p$(p_doc)
-       dh_link -p$(p_doc) \
-         /usr/share/doc/$(p_doc)/html /usr/share/doc/$(p_setp)/html \
-         /usr/share/doc/$(p_doc)/html /usr/share/doc/$(p_setp3)/html
-
-       dh_compress -i
-       dh_fixperms -i
-
-       for v in $(filter-out 3.%, $(PYVERS)); do \
-         sed -i "s/python2\../python$$v/g" $(d_setp)/usr/bin/easy_install-$$v; 
\
-       done
-#      for v in $(filter-out 2.%, $(PYVERS)); do \
-#        sed -i "s/python3\../python$$v/g" debian/$(call 
pname,$(p_setp),3.1)/usr/bin/easy_install-$$v; \
-#      done
-
-       dh_python2 -p$(p_pkgr) -p$(p_setp) #-p$(p_dist)
-       cat $(d_setp).substvars
-       ( \
-         echo 'python:Versions=2.7'; \
-         echo 'python:Provides=python2.7-setuptools'; \
-         echo 'python:Depends=python:any (>= 2.7), python:any (<< 2.8)'; \
-       ) > $(d_setp).substvars
-       cp $(d_setp).substvars $(d_pkgr).substvars
-
-       dh_python3 -p$(call pname,$(p_pkgr),3.4) -p$(call pname,$(p_setp),3.4) 
# -p$(call pname,$(p_dist),3.3)
-       cat debian/$(call pname,$(p_setp),3.4).substvars
-       cat debian/$(call pname,$(p_pkgr),3.4).substvars
-
-##     cp $(d_setp).substvars $(d_dist).substvars
-
-       ( \
-         echo 'python3:Versions=3.4, 3.5'; \
-         echo 'python3:Provides=python3.4-setuptools, python3.5-setuptools'; \
-         echo 'python3:Depends=python3:any (>= 3.4), python3:any (<< 3.6)'; \
-       ) > $(call pname,$(d_setp),3.4).substvars
-       cp $(call pname,$(d_setp),3.4).substvars $(call 
pname,$(d_pkgr),3.4).substvars
-
-       dh_installdeb -i
-       dh_gencontrol -i
-       dh_md5sums -i
-       dh_builddeb -i
 
-binary: binary-arch binary-indep
-.PHONY: build clean binary-indep binary-arch binary install
+override_dh_auto_clean:
+       dh_auto_clean
+       rm -rf .eggs docs/build
+
+override_dh_install:
+       cp debian/tmp/usr/bin/easy_install-$(shell pyversions -dv) \
+          debian/tmp/usr/bin/easy_install
+       cp debian/tmp/usr/bin/easy_install-$(shell py3versions -dv) \
+          debian/tmp/usr/bin/easy_install3
+       dh_install
+
+override_dh_installdocs:
+       dh_installdocs -p python-pkg-resources -p python3-pkg-resources \
+                      docs/pkg_resources.txt
+       dh_installdocs -p python-setuptools -p python3-setuptools \
+                      -X pkg_resources docs/*.txt
+       dh_installdocs -p python-setuptools-doc docs/build/html
+       dh_installdocs --remaining-packages
+       dh_link -p python-setuptools-doc \
+               /usr/share/doc/python-setuptools-doc/html \
+               /usr/share/doc/python-setuptools/html \
+               /usr/share/doc/python-setuptools-doc/html \
+               /usr/share/doc/python3-setuptools/html
diff -Nru python-setuptools-17.0/debian/changelog 
python-setuptools-17.0/debian/changelog
--- python-setuptools-17.0/debian/changelog     2015-07-05 18:56:12.000000000 
-0700
+++ python-setuptools-17.0/debian/changelog     2015-07-05 20:24:02.000000000 
-0700
@@ -1,3 +1,9 @@
+python-setuptools (17.0-1+pybuild+pypy) UNRELEASED; urgency=medium
+
+   * Add binary packages for pypy. Requires Build-Depends: pypy.
+
+ -- Stefano Rivera <stefa...@debian.org>  Sun, 05 Jul 2015 09:59:51 -0700
+
 python-setuptools (17.0-1+pybuild) UNRELEASED; urgency=medium
 
   * Port to pybuild:
diff -Nru python-setuptools-17.0/debian/control 
python-setuptools-17.0/debian/control
--- python-setuptools-17.0/debian/control       2015-07-05 11:37:18.000000000 
-0700
+++ python-setuptools-17.0/debian/control       2015-07-05 18:56:33.000000000 
-0700
@@ -5,6 +5,7 @@
 Build-Depends:
  debhelper (>= 9),
  dh-python,
+ pypy,
  python-all,
  python3-all,
  python3-sphinx,
@@ -65,6 +66,28 @@
 Description: Python3 Distutils Enhancements
  Extensions to the python-distutils for large or complex distributions.
 
+Package: pypy-pkg-resources
+Suggests: pypy-setuptools
+Architecture: all
+Depends: ${misc:Depends}, ${pypy:Depends}
+Description: Package Discovery and Resource Access using pkg_resources
+ The pkg_resources module provides an API for Python libraries to
+ access their resource files, and for extensible applications and
+ frameworks to automatically discover plugins.  It also provides
+ runtime support for using C extensions that are inside zipfile-format
+ eggs, support for merging packages that have separately-distributed
+ modules or subpackages, and APIs for managing Python's current
+ "working set" of active packages.
+
+Package: pypy-setuptools
+Architecture: all
+Depends:
+ pypy-pkg-resources (= ${binary:Version}),
+ ${misc:Depends},
+ ${pypy:Depends}
+Description: PyPy Distutils Enhancements
+ Extensions to the python-distutils for large or complex distributions.
+
 Package: python-setuptools-whl
 Architecture: all
 Depends: ${misc:Depends}
diff -Nru python-setuptools-17.0/debian/pypy-pkg-resources.install 
python-setuptools-17.0/debian/pypy-pkg-resources.install
--- python-setuptools-17.0/debian/pypy-pkg-resources.install    1969-12-31 
16:00:00.000000000 -0800
+++ python-setuptools-17.0/debian/pypy-pkg-resources.install    2015-07-05 
18:56:33.000000000 -0700
@@ -0,0 +1 @@
+/usr/lib/pypy/dist-packages/pkg_resources
diff -Nru python-setuptools-17.0/debian/pypy-setuptools.install 
python-setuptools-17.0/debian/pypy-setuptools.install
--- python-setuptools-17.0/debian/pypy-setuptools.install       1969-12-31 
16:00:00.000000000 -0800
+++ python-setuptools-17.0/debian/pypy-setuptools.install       2015-07-05 
18:56:33.000000000 -0700
@@ -0,0 +1,4 @@
+/usr/lib/pypy/dist-packages/_markerlib
+/usr/lib/pypy/dist-packages/easy_install*
+/usr/lib/pypy/dist-packages/setuptools*
+/usr/bin/easy_install-pypy
diff -Nru python-setuptools-17.0/debian/rules 
python-setuptools-17.0/debian/rules
--- python-setuptools-17.0/debian/rules 2015-07-05 11:32:40.000000000 -0700
+++ python-setuptools-17.0/debian/rules 2015-07-05 18:56:33.000000000 -0700
@@ -1,7 +1,7 @@
 #!/usr/bin/make -f
 
 %:
-       dh $@ --with python2,python3,sphinxdoc --buildsystem pybuild
+       dh $@ --with python2,python3,pypy,sphinxdoc --buildsystem pybuild
 
 override_dh_auto_test:
 
@@ -14,21 +14,28 @@
        python3 setup.py bdist_wheel --universal \
                -d debian/python-setuptools-whl/usr/share/python-wheels
 
+       # dh_pypy from dh-python < 1.20150705-1 falls over requires.txt
+       # and our requires.txt aren't useful
+       find debian/tmp -name requires.txt -delete
+
 override_dh_auto_clean:
        dh_auto_clean
        rm -rf .eggs docs/build
 
 override_dh_install:
-       cp debian/tmp/usr/bin/easy_install-$(shell pyversions -dv) \
-          debian/tmp/usr/bin/easy_install
-       cp debian/tmp/usr/bin/easy_install-$(shell py3versions -dv) \
+       sed -i '1 s,.*,#!/usr/bin/python,' debian/tmp/usr/bin/easy_install
+       sed '1 s/python/python3/' debian/tmp/usr/bin/easy_install > \
           debian/tmp/usr/bin/easy_install3
+       sed '1 s/python/pypy/' debian/tmp/usr/bin/easy_install > \
+          debian/tmp/usr/bin/easy_install-pypy
        dh_install
 
 override_dh_installdocs:
        dh_installdocs -p python-pkg-resources -p python3-pkg-resources \
+                      -p pypy-pkg-resources \
                       docs/pkg_resources.txt
        dh_installdocs -p python-setuptools -p python3-setuptools \
+                      -p pypy-setuptools \
                       -X pkg_resources docs/*.txt
        dh_installdocs -p python-setuptools-doc docs/build/html
        dh_installdocs --remaining-packages
@@ -36,4 +43,6 @@
                /usr/share/doc/python-setuptools-doc/html \
                /usr/share/doc/python-setuptools/html \
                /usr/share/doc/python-setuptools-doc/html \
-               /usr/share/doc/python3-setuptools/html
+               /usr/share/doc/python3-setuptools/html \
+               /usr/share/doc/python-setuptools-doc/html \
+               /usr/share/doc/pypy-setuptools/html

Reply via email to