[Git][debian-gis-team/python-pyproj][master] 5 commits: Use-Cython-in-setup.py-to-generate-C-code-on-the-fly.patch: Cherry-pick from upstream

Bas Couwenberg gitlab at salsa.debian.org
Wed Jul 4 15:16:16 BST 2018


Bas Couwenberg pushed to branch master at Debian GIS Project / python-pyproj


Commits:
3db7f917 by Iain Lane at 2018-07-04T13:38:31+01:00
Use-Cython-in-setup.py-to-generate-C-code-on-the-fly.patch: Cherry-pick from upstream

This makes _proj.c get regenerated during the build, which fixes FTBFS when it
is incompatible with the current python version (e.g. the shipped _proj.c
doesn't work with python 3.7)

- - - - -
70563d44 by Bas Couwenberg at 2018-07-04T15:18:05+02:00
Use-Cython-in-setup.py-to-generate-C-code-on-the-fly.patch: Cherry-pick from upstream

This makes _proj.c get regenerated during the build, which fixes FTBFS when it
is incompatible with the current python version (e.g. the shipped _proj.c
doesn't work with python 3.7)

- - - - -
7a349f5e by Bas Couwenberg at 2018-07-04T15:21:20+02:00
Use DEP-3 headers for Cython patch, specifically Origin header.

- - - - -
93593fbb by Bas Couwenberg at 2018-07-04T16:00:18+02:00
Move _proj.c out of the way before the build and restore it afterwards.

- - - - -
fb49d699 by Bas Couwenberg at 2018-07-04T16:11:23+02:00
Set distribution to unstable.

- - - - -


5 changed files:

- debian/changelog
- debian/control
- + debian/patches/Use-Cython-in-setup.py-to-generate-C-code-on-the-fly.patch
- debian/patches/series
- debian/rules


Changes:

=====================================
debian/changelog
=====================================
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,6 @@
-python-pyproj (1.9.5.1-4) UNRELEASED; urgency=medium
+python-pyproj (1.9.5.1-4) unstable; urgency=medium
 
+  [ Bas Couwenberg ]
   * Update copyright-format URL to use HTTPS.
   * Bump Standards-Version to 4.1.4, no changes.
   * Check DEB_BUILD_PROFILES for nocheck in dh_auto_test override.
@@ -8,8 +9,17 @@ python-pyproj (1.9.5.1-4) UNRELEASED; urgency=medium
   * Add module import tests to autopkgtest configuration.
   * Drop ancient X-Python{,3}-Version fields.
   * Strip trailing whitespace from control & rules files.
+  * Use DEP-3 headers for Cython patch, specifically Origin header.
+  * Move _proj.c out of the way before the build and restore it afterwards.
 
- -- Bas Couwenberg <sebastic at debian.org>  Sun, 21 Jan 2018 10:39:51 +0100
+  [ Iain Lane ]
+  * debian/patches/Use-Cython-in-setup.py-to-generate-C-code-on-the-fly.patch:
+    Cherry-pick from upstream. This makes _proj.c get regenerated during the
+    build, which fixes FTBFS when it is incompatible with the current python
+    version (e.g. the shipped _proj.c doesn't work with python 3.7).
+  * debian/control: Build-Depend on cython for the above.
+
+ -- Bas Couwenberg <sebastic at debian.org>  Wed, 04 Jul 2018 16:09:05 +0200
 
 python-pyproj (1.9.5.1-3) unstable; urgency=medium
 


=====================================
debian/control
=====================================
--- a/debian/control
+++ b/debian/control
@@ -6,6 +6,7 @@ Section: python
 Priority: optional
 Build-Depends: debhelper (>= 9),
                dh-python,
+               cython,
                python-all-dev,
                python-setuptools,
                python-numpy,


=====================================
debian/patches/Use-Cython-in-setup.py-to-generate-C-code-on-the-fly.patch
=====================================
--- /dev/null
+++ b/debian/patches/Use-Cython-in-setup.py-to-generate-C-code-on-the-fly.patch
@@ -0,0 +1,68 @@
+Description: Use Cython in setup.py to generate C code on the fly from _proj.pyx.
+Author: Micah Cochran <micahcochran at users.noreply.github.com>
+Origin: https://github.com/jswhit/pyproj/commit/fd7b5ea23d5cb0b5c45a9a9ee5bf1c0e446cf474
+
+--- a/README.md
++++ b/README.md
+@@ -1,6 +1,7 @@
+ To install:
+ 
+ * clone github repo or download source release at http://python.org/pypi/pyproj.
++* If you clone the github repo, (Cython)[http://cython.org/] is a dependency.
+ * python setup.py build
+ * python setup.py install (with sudo if necessary).
+ 
+--- a/setup.py
++++ b/setup.py
+@@ -2,6 +2,15 @@ import sys, os, glob, subprocess, shutil
+ from distutils import ccompiler, sysconfig
+ from setuptools import setup, Extension
+ 
++USE_CYTHON = False
++
++# is this a repository
++if not os.path.isfile("_proj.c"):
++    # no _proj.c, repository
++    USE_CYTHON = True
++
++ext = '.pyx' if USE_CYTHON else '.c'
++
+ proj_dir = os.environ.get('PROJ_DIR')
+ 
+ # if PROJ_DIR env var is set, build against
+@@ -20,7 +29,7 @@ if proj_dir is not None:
+         incdirs.append(os.path.join(proj_dir,'include'))
+ 
+     pyprojext =\
+-    Extension("pyproj._proj",["_proj.c"],include_dirs=incdirs,library_dirs=libdirs,\
++    Extension("pyproj._proj",["_proj"+ext],include_dirs=incdirs,library_dirs=libdirs,\
+     runtime_library_dirs=libdirs,libraries=libraries)
+ 
+     extensions = [pyprojext]
+@@ -48,7 +57,7 @@ else:
+     #macros.append(('HAVE_STRERROR',1))
+     # for win32 threads
+     #macros.append(('MUTEX_win32',1))
+-    extensions = [Extension("pyproj._proj",deps+['_proj.c'],
++    extensions = [Extension("pyproj._proj",deps+['_proj'+ext],
+                   include_dirs=['src'],define_macros=macros)]
+ 
+     # create binary datum shift grid files.
+@@ -75,6 +84,17 @@ else:
+     datafiles = [os.path.join('data',os.path.basename(f)) for f in datafiles]
+     package_data = {'pyproj':datafiles}
+ 
++# use Cython to generate the C code (_proj.c) from _proj.pyx
++if USE_CYTHON:
++    try:
++        from Cython.Build import cythonize
++    except ImportError:
++        sys.stderr.write("\n\n_proj.c does not exist in a repository copy.\n"
++                         "ImportError: Cython must be installed in order to generate _proj.c\n"
++                         "\tto install Cython run `pip install cython`\n")
++        sys.exit(1)
++
++    extensions = cythonize(extensions)
+ 
+ packages          = ['pyproj']
+ package_dirs       = {'':'lib'}


=====================================
debian/patches/series
=====================================
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 01-use_proj-data_instead_of_embedded.patch
 02-pyproj_datadir.patch
 international-typo.patch
+Use-Cython-in-setup.py-to-generate-C-code-on-the-fly.patch


=====================================
debian/rules
=====================================
--- a/debian/rules
+++ b/debian/rules
@@ -29,6 +29,16 @@ override_dh_clean:
 	         nad2bin nad2bin.o \
 	         src/pj_malloc.o
 
+override_dh_auto_configure:
+	mv -v $(CURDIR)/_proj.c $(CURDIR)/_proj.c.bak
+
+	dh_auto_configure
+
+override_dh_auto_build:
+	dh_auto_build
+
+	mv -v $(CURDIR)/_proj.c.bak $(CURDIR)/_proj.c
+
 override_dh_auto_test:
 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
 	PYBUILD_SYSTEM=custom \



View it on GitLab: https://salsa.debian.org/debian-gis-team/python-pyproj/compare/55465e51917a0774303451347196648a38672edf...fb49d69911fe7721e0f5b737862b4c91ae44f128

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/python-pyproj/compare/55465e51917a0774303451347196648a38672edf...fb49d69911fe7721e0f5b737862b4c91ae44f128
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20180704/c889dcc7/attachment-0001.html>


More information about the Pkg-grass-devel mailing list