[python-fabio] 30/31: run cython during the build

Frédéric-Emmanuel Picca picca at moszumanska.debian.org
Fri Dec 27 19:05:50 UTC 2013


This is an automated email from the git hooks/post-receive script.

picca pushed a commit to branch master
in repository python-fabio.

commit 7c6498757aabeee043a4ca079e7a52ab31a8697c
Author: Picca Frédéric-Emmanuel <picca at debian.org>
Date:   Fri Dec 27 19:36:58 2013 +0100

    run cython during the build
---
 debian/changelog                                   |  3 ++
 debian/control                                     |  4 +-
 ...arded-upstream-cythonize-during-the-build.patch | 58 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 debian/rules                                       |  3 +-
 5 files changed, 67 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index b0eb51b..ee0b4e9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,9 @@ python-fabio (0.1.3-2) UNRELEASED; urgency=medium
     - Add the python-fabio-dbg package
     - Add the python-fabio-doc package
     - Team maintained under debian-science
+    - Build-Depends: add cython
+  * debian/patch
+    + 0001-forwarded-upstream-cythonize-during-the-build.patch (new)
 
  -- Picca Frédéric-Emmanuel <picca at debian.org>  Fri, 27 Dec 2013 09:46:21 +0100
 
diff --git a/debian/control b/debian/control
index 9c7bc48..f81bb2c 100644
--- a/debian/control
+++ b/debian/control
@@ -4,7 +4,9 @@ Uploaders: Jerome Kieffer <jerome.kieffer at esrf.fr>,
            Picca Frédéric-Emmanuel <picca at debian.org>
 Section: science
 Priority: extra
-Build-Depends: debhelper (>= 9),
+Build-Depends: cython,
+               cython-dbg,
+               debhelper (>= 9),
                python-all-dev,
                python-all-dbg,
                python-numpy,
diff --git a/debian/patches/0001-forwarded-upstream-cythonize-during-the-build.patch b/debian/patches/0001-forwarded-upstream-cythonize-during-the-build.patch
new file mode 100644
index 0000000..3857ad6
--- /dev/null
+++ b/debian/patches/0001-forwarded-upstream-cythonize-during-the-build.patch
@@ -0,0 +1,58 @@
+From: =?utf-8?q?Picca_Fr=C3=A9d=C3=A9ric-Emmanuel?= <picca at debian.org>
+Date: Fri, 27 Dec 2013 18:47:46 +0100
+Subject: forwarded upstream cythonize during the build
+
+---
+ setup.py | 20 ++++++++++++++++----
+ 1 file changed, 16 insertions(+), 4 deletions(-)
+
+diff --git a/setup.py b/setup.py
+index ebae18c..b38be00 100644
+--- a/setup.py
++++ b/setup.py
+@@ -13,21 +13,33 @@ except ImportError:
+ from distutils.core import Extension, Command
+ from numpy.distutils.misc_util import get_numpy_include_dirs
+ 
+-
++# Check for Cython and use it if it is available
++USE_CYTHON = False
++ext = '.c'
++try:
++    from Cython.Build import cythonize
++    USE_CYTHON = True
++    ext = ".pyx"
++except ImportError:
++    pass
+ 
+ cf_backend = Extension('cf_io', include_dirs=get_numpy_include_dirs(),
+       sources=['src/cf_iomodule.c', 'src/columnfile.c'])
+ 
+ byteOffset_backend = Extension("byte_offset",
+                        include_dirs=get_numpy_include_dirs(),
+-                           sources=['src/byte_offset.c'])
++                               sources=['src/byte_offset' + ext])
+ 
+ mar345_backend = Extension('mar345_IO',
+                            include_dirs=get_numpy_include_dirs(),
+-                           sources=['src/mar345_IO.c',
++                           sources=['src/mar345_IO' + ext,
+                                     'src/ccp4_pack.c',
+                                       ])
+ 
++extensions = [cf_backend, byteOffset_backend, mar345_backend]
++if USE_CYTHON:
++    extensions = cythonize(extensions)
++
+ version = [eval(l.split("=")[1])
+            for l in open(op.join(op.dirname(op.abspath(__file__)), "fabio-src", "__init__.py"))
+            if l.strip().startswith("version")][0]
+@@ -87,7 +99,7 @@ setup(name='fabio',
+       url="http://fable.wiki.sourceforge.net/fabio",
+       download_url="http://sourceforge.net/projects/fable/files/fabio/0.1.2",
+       ext_package="fabio",
+-      ext_modules=[mar345_backend, cf_backend, byteOffset_backend],
++      ext_modules=extensions,
+       packages=["fabio"],
+       package_dir={"fabio": "fabio-src" },
+       test_suite="test",
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..6363ec5
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+0001-forwarded-upstream-cythonize-during-the-build.patch
diff --git a/debian/rules b/debian/rules
index 1737aaa..ecde429 100755
--- a/debian/rules
+++ b/debian/rules
@@ -6,11 +6,12 @@ PY2VERS = $(shell pyversions -r -v)
 	dh $@ --with python2,sphinxdoc
 
 override_dh_clean:
+        # remove the cython generated files distributed by upstream
+	rm -f $(patsubst %.pyx,%.c,$(wildcard src/*.pyx))
 	rm -rf build/sphinx
 	rm -rf *.egg-info
 	dh_clean
 
-
 override_dh_auto_build-indep:
 	dh_auto_build
 	# build the documentation

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/python-fabio.git



More information about the debian-science-commits mailing list