Browse Source

Add pypy package.

Jelmer Vernooij 10 years ago
parent
commit
cb9badab82
6 changed files with 62 additions and 13 deletions
  1. 7 0
      debian/changelog
  2. 19 1
      debian/control
  3. 13 0
      debian/patches/02_unpure_pypy
  4. 1 0
      debian/patches/series
  5. 21 11
      debian/rules
  6. 1 1
      setup.py

+ 7 - 0
debian/changelog

@@ -1,3 +1,10 @@
+dulwich (0.9.8-2) UNRELEASED; urgency=medium
+
+  * Add pypy package.
+  * Add patch 02_unpure_pypy to enable C bindings in pypy.
+
+ -- Jelmer Vernooij <jelmer@debian.org>  Sun, 30 Nov 2014 17:56:46 +0000
+
 dulwich (0.9.8-1) unstable; urgency=medium
 dulwich (0.9.8-1) unstable; urgency=medium
 
 
   * New upstream release.
   * New upstream release.

+ 19 - 1
debian/control

@@ -3,7 +3,7 @@ Section: python
 Priority: optional
 Priority: optional
 Maintainer: Jelmer Vernooij <jelmer@debian.org>
 Maintainer: Jelmer Vernooij <jelmer@debian.org>
 Homepage: http://samba.org/~jelmer/dulwich
 Homepage: http://samba.org/~jelmer/dulwich
-Build-Depends: python-all-dev (>= 2.6.6-3), python-all-dbg (>= 2.6.6-3), debhelper (>= 9), python-unittest2, git (>= 1:1.7.0.4-2) | git-core, python-fastimport (>= 0.9.0~bzr293)
+Build-Depends: python-all-dev (>= 2.6.6-3), python-all-dbg (>= 2.6.6-3), debhelper (>= 9), python-unittest2, git (>= 1:1.7.0.4-2) | git-core, python-fastimport (>= 0.9.0~bzr293), pypy-dev, dh-python
 Standards-Version: 3.9.6
 Standards-Version: 3.9.6
 X-Python-Version: >= 2.7
 X-Python-Version: >= 2.7
 Vcs-Git: git://anonscm.debian.org/users/jelmer/dulwich.git -b unstable
 Vcs-Git: git://anonscm.debian.org/users/jelmer/dulwich.git -b unstable
@@ -26,6 +26,8 @@ Description: Python Git library
  All functionality is available in pure Python, but for improved performance
  All functionality is available in pure Python, but for improved performance
  replacements of some modules written in C are also available. This package
  replacements of some modules written in C are also available. This package
  includes the high performance versions.
  includes the high performance versions.
+ .
+ This package contains the module built for Python version 2.x.
 
 
 Package: python-dulwich-dbg
 Package: python-dulwich-dbg
 Architecture: any
 Architecture: any
@@ -44,3 +46,19 @@ Description: Python Git library - Debug Extension
  includes the high performance versions.
  includes the high performance versions.
  .
  .
  This package contains the extensions built for the Python debug interpreter.
  This package contains the extensions built for the Python debug interpreter.
+
+Package: pypy-dulwich
+Architecture: any
+Provides: ${pypy:Provides}
+Depends: ${pypy:Depends}, ${misc:Depends}, ${shlibs:Depends}
+Description: Python Git library - pypy module
+ Dulwich is a Python implementation of the file formats and protocols
+ used by the Git version control system. It can currently read from and write
+ to existing Git repositories and implements the protocol for pushing and
+ receiving packs from remote servers.
+ .
+ All functionality is available in pure Python, but for improved performance
+ replacements of some modules written in C are also available. This package
+ includes the high performance versions.
+ .
+ This package contains the module built for pypy.

+ 13 - 0
debian/patches/02_unpure_pypy

@@ -0,0 +1,13 @@
+diff --git a/setup.py b/setup.py
+index 89be710..226abfa 100755
+--- a/setup.py
++++ b/setup.py
+@@ -24,7 +24,7 @@ class DulwichDistribution(Distribution):
+             return True
+ 
+     def has_ext_modules(self):
+-        return not self.pure and not '__pypy__' in sys.modules
++        return not self.pure
+ 
+     global_options = Distribution.global_options + [
+         ('pure', None, "use pure Python code instead of C "

+ 1 - 0
debian/patches/series

@@ -1 +1,2 @@
 01_setup_cfg
 01_setup_cfg
+02_unpure_pypy

+ 21 - 11
debian/rules

@@ -6,7 +6,7 @@ CXXFLAGS:=$(shell dpkg-buildflags --get CXXFLAGS)
 LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS)
 LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS)
 
 
 # Get the supported Python versions
 # Get the supported Python versions
-PYVERS = $(shell pyversions -r -v)
+PYTHONS = $(shell pyversions -r) pypy
 # Get the default Python version
 # Get the default Python version
 PYVERSION = $(shell pyversions -d -v)
 PYVERSION = $(shell pyversions -d -v)
 
 
@@ -15,23 +15,33 @@ pythonpath = $$(ls -d $(CURDIR)/build/lib.*-$(1))
 pythonpath_dbg = $$(ls -d $(CURDIR)/build/lib_d.*-$(1) 2>/dev/null || ls -d $(CURDIR)/build/lib.*$(1)-pydebug)
 pythonpath_dbg = $$(ls -d $(CURDIR)/build/lib_d.*-$(1) 2>/dev/null || ls -d $(CURDIR)/build/lib.*$(1)-pydebug)
 
 
 %:
 %:
-	dh $* --with python2 --buildsystem=python_distutils
+	dh $* --with python2,pypy --buildsystem=python_distutils
+
+override_dh_auto_build:
+	dh_auto_build
+	pypy setup.py build -b build-pypy
+
+override_dh_auto_test:
+ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
+	$(MAKE) check
+	PYTHONPATH=$(shell echo $(CURDIR)/build-pypy/lib*) pypy -m unittest dulwich.tests.test_suite
+endif
 
 
 override_dh_auto_install:
 override_dh_auto_install:
-	dh_auto_install --destdir=debian/tmp
+	dh_auto_install
+	pypy setup.py build -b build-pypy install --root debian/tmp --install-layout deb
+	rm -rf debian/tmp/usr/lib/pypy/bin
 	# Install everything excluding the *_d.so debug extensions to python-dulwich
 	# Install everything excluding the *_d.so debug extensions to python-dulwich
-	dh_install -X"*_d.so" "debian/tmp/*" -p python-dulwich
+	dh_install -X"*_d.so" "debian/tmp/usr/lib/python*/*-packages" -p python-dulwich
 	# Install the debug extensions to python-dulwich-dbg
 	# Install the debug extensions to python-dulwich-dbg
 	dh_install "debian/tmp/usr/lib/python*/*-packages/dulwich/*_d.so" -p python-dulwich-dbg
 	dh_install "debian/tmp/usr/lib/python*/*-packages/dulwich/*_d.so" -p python-dulwich-dbg
+	# Install the pypy files to pypy-dulwich
+	dh_install "debian/tmp/usr/lib/pypy/" -p pypy-dulwich
 
 
 override_dh_installdocs:
 override_dh_installdocs:
-	dh_installdocs --link-doc=python-dulwich
-	dh_installdocs -ppython-dulwich docs/tutorial  -X.gitignore -XMakefile
-
-override_dh_auto_test:
-ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
-	$(MAKE) check
-endif
+	dh_installdocs -ppython-dulwich-dbg --link-doc=python-dulwich
+	dh_installdocs -ppython-dulwich docs/tutorial -X.gitignore -XMakefile
+	dh_installdocs -ppypy-dulwich docs/tutorial -X.gitignore -XMakefile
 
 
 override_dh_strip:
 override_dh_strip:
 ifeq (,$(filter nostrip,$(DEB_BUILD_OPTIONS)))
 ifeq (,$(filter nostrip,$(DEB_BUILD_OPTIONS)))

+ 1 - 1
setup.py

@@ -24,7 +24,7 @@ class DulwichDistribution(Distribution):
             return True
             return True
 
 
     def has_ext_modules(self):
     def has_ext_modules(self):
-        return not self.pure and not '__pypy__' in sys.modules
+        return not self.pure
 
 
     global_options = Distribution.global_options + [
     global_options = Distribution.global_options + [
         ('pure', None, "use pure Python code instead of C "
         ('pure', None, "use pure Python code instead of C "