[SCM] pyliblo/master: Convert to pybuild build system and make tests compatible with Python 3

sramacher at users.alioth.debian.org sramacher at users.alioth.debian.org
Sun Oct 5 14:36:34 UTC 2014


The following commit has been merged in the master branch:
commit 84401f3c9668e869e29adba00097a4b9734c1137
Author: Sebastian Ramacher <sramacher at debian.org>
Date:   Sun Oct 5 16:31:08 2014 +0200

    Convert to pybuild build system and make tests compatible with Python 3

diff --git a/debian/control b/debian/control
index abb72f4..dd9db56 100644
--- a/debian/control
+++ b/debian/control
@@ -8,11 +8,14 @@ Uploaders:
  Alessio Treglia <alessio at debian.org>
 Build-Depends:
  debhelper (>= 9),
+ dh-python,
  liblo-dev (>= 0.26~repack),
  python-all-dev,
  cython,
  cython3,
- python3-all-dev
+ python3-all-dev,
+ python-setuptools,
+ python3-setuptools
 Standards-Version: 3.9.6
 X-Python-Version: >= 2.5
 X-Python3-Version: >= 3.2
diff --git a/debian/patches/02-define-testsuite.patch b/debian/patches/02-define-testsuite.patch
new file mode 100644
index 0000000..6111ce9
--- /dev/null
+++ b/debian/patches/02-define-testsuite.patch
@@ -0,0 +1,30 @@
+Description: Add test_suite to setup call
+Author: Sebastian Ramacher <sramacher at debian.org>
+Last-Update: 2014-10-05
+Forwarded: https://github.com/dsacre/pyliblo/pull/5
+
+--- a/setup.py
++++ b/setup.py
+@@ -9,8 +9,10 @@
+ 
+ try:
+     from setuptools import setup, Extension
++    args = {'test_suite': 'test'}
+ except ImportError:
+     from distutils.core import setup, Extension
++    args = {}
+ 
+ 
+ if '--with-cython' in sys.argv:
+@@ -73,5 +75,6 @@
+         ]),
+     ],
+     cmdclass = cmdclass,
+-    ext_modules = ext_modules
++    ext_modules = ext_modules,
++    **args
+ )
+--- /dev/null
++++ b/test/__init__.py
+@@ -0,0 +1 @@
++# empty
diff --git a/debian/patches/03-py3.patch b/debian/patches/03-py3.patch
new file mode 100644
index 0000000..95dc1ac
--- /dev/null
+++ b/debian/patches/03-py3.patch
@@ -0,0 +1,58 @@
+Description: Make test_server_thread.py Python 3 compatible
+Author: Sebastian Ramacher <sramacher at debian.org>
+Last-Update: 2014-10-05
+Forwarded: https://github.com/dsacre/pyliblo/pull/4
+
+--- a/test/test_server_thread.py
++++ b/test/test_server_thread.py
+@@ -1,30 +1,31 @@
+ #!/usr/bin/env python
+ 
++from __future__ import print_function
+ import liblo
+ import time
+ 
+ st = liblo.ServerThread()
+-print "Created Server Thread on Port", st.get_port()
++print("Created Server Thread on Port", st.get_port())
+ 
+ def foo_cb(path, args, types):
+-    print "foo_cb():"
++    print("foo_cb():")
+     for a, t in zip(args, types):
+-        print "received argument %s of type %s" % (a, t)
++        print("received argument %s of type %s" % (a, t))
+ 
+ def bar_cb(path, args, types, src):
+-    print "bar_cb():"
+-    print "message from", src.get_url()
+-    print "typespec:", types
++    print("bar_cb():")
++    print("message from", src.get_url())
++    print("typespec:", types)
+     for a, t in zip(args, types):
+-        print "received argument %s of type %s" % (a, t)
++        print("received argument %s of type %s" % (a, t))
+ 
+ class Blah:
+     def __init__(self, x):
+         self.x = x
+     def baz_cb(self, path, args, types, src, user_data):
+-        print "baz_cb():"
+-        print args[0]
+-        print "self.x is", self.x, ", user data was", user_data
++        print("baz_cb():")
++        print(args[0])
++        print("self.x is", self.x, ", user data was", user_data)
+ 
+ st.add_method('/foo', 'ifs', foo_cb)
+ st.add_method('/bar', 'hdc', bar_cb)
+@@ -35,7 +36,7 @@
+ st.start()
+ 
+ liblo.send(st.get_port(), "/foo", 123, 456.789, "buh!")
+-liblo.send(st.get_port(), "/bar", 1234567890123456L, 666, ('c', "x"))
++liblo.send(st.get_port(), "/bar", 1234567890123456, 666, ('c', "x"))
+ 
+ time.sleep(1)
+ st.stop()
diff --git a/debian/patches/series b/debian/patches/series
index a2f90ec..a79fe6b 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,3 @@
 01-overflow.patch
+02-define-testsuite.patch
+03-py3.patch
diff --git a/debian/rules b/debian/rules
index 5c58118..1024981 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,41 +1,10 @@
 #!/usr/bin/make -f
 
-PYTHON2=$(shell pyversions -vr)
-PYTHON3=$(shell py3versions -vr)
-
 %:
-	dh $@ --with python2,python3
-
-override_dh_auto_clean:
-	dh_auto_clean
-	rm -rf build
-
-build-python%:
-	python$* setup.py build --with-cython
-
-override_dh_auto_build: $(PYTHON3:%=build-python%)
-	dh_auto_build
-
-install-python%:
-	python$* setup.py install --root=$(CURDIR)/debian/tmp --install-layout=deb
-
-override_dh_auto_install: $(PYTHON3:%=install-python%)
-	dh_auto_install
-
-ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
-DEB_HOST_ARCH=$(shell dpkg-architecture -qDEB_HOST_ARCH)
-# do not run test suite on sparc since liblo has problems with 64 bit integers
-# on sparc (see #721617)
-ifeq (,$(filter sparc,$(DEB_HOST_ARCH)))
-pythonpath = $$(ls -d $(CURDIR)/build/lib.*-$(1))
-
-test-python%:
-	PYTHONPATH=$(call pythonpath,$*) \
-		python$* -m unittest discover -s test/ -p '*.py' -v
+	dh $@ --with python2,python3 --buildsystem=pybuild
 
-override_dh_auto_test: $(PYTHON2:%=test-python%) $(PYTHON3:%=test-python%)
-endif
-endif
+override_dh_auto_build:
+	dh_auto_build -- --build-args=--with-cython
 
 override_dh_installchangelogs:
 	dh_installchangelogs NEWS

-- 
pyliblo packaging



More information about the pkg-multimedia-commits mailing list