aboutsummaryrefslogtreecommitdiffstats
path: root/community/py3-pyclipper
diff options
context:
space:
mode:
authorSascha Brawer <sascha@brawer.ch>2020-03-05 21:41:11 +0100
committerRasmus Thomsen <oss@cogitri.dev>2020-03-06 16:14:16 +0100
commitce0a029fd44edf4e54345bd74123eda7088c0849 (patch)
treeac6d6a1478e36ec3a4a54d9878f752234206997b /community/py3-pyclipper
parent4d57ce5b11452abe7d741a243300723723766d9c (diff)
downloadaports-ce0a029fd44edf4e54345bd74123eda7088c0849.tar.bz2
aports-ce0a029fd44edf4e54345bd74123eda7088c0849.tar.xz
community/py3-pyclipper: use clipper library from Alpine package
To save installation space, and to use the exact same implementation of polygon clipping across the system. Also taking the source code from pypi instead of github, like most other Alpine py3 packages. Other than github, pypi is putting the git release tag into the zip bundles, which is then used by Python setuptools. When setuptools is installing a package, it is checking for the version tag, and the installation fails with a warning when the version tag cannot be inferred. Before this change, the `APKBUILD` would run `git init` to work around this setuptools check. After this change, that hack is not needed anymore.
Diffstat (limited to 'community/py3-pyclipper')
-rw-r--r--community/py3-pyclipper/10-system-libs.patch38
-rw-r--r--community/py3-pyclipper/APKBUILD25
2 files changed, 57 insertions, 6 deletions
diff --git a/community/py3-pyclipper/10-system-libs.patch b/community/py3-pyclipper/10-system-libs.patch
new file mode 100644
index 0000000000..0e88d4d3b5
--- /dev/null
+++ b/community/py3-pyclipper/10-system-libs.patch
@@ -0,0 +1,38 @@
+Upstream comes with its own copy of the Clipper C++ polygon clipping
+library, which they compile into a static library that gets included
+into the Python wheel. On Alpine Linux, we prefer to use the shared
+library from package `clipper` so that the exact same implementation
+gets called across the system. Also, linking to a system-wide shared
+library reduces total installation size when Clipper gets called
+from both Python and non-Python code.
+
+--- a/setup.py
++++ b/setup.py
+@@ -23,7 +23,7 @@
+ from Cython.Distutils import build_ext
+
+ print('Development mode: Compiling Cython modules from .pyx sources.')
+- sources = ["pyclipper/pyclipper.pyx", "pyclipper/clipper.cpp"]
++ sources = ["pyclipper/pyclipper.pyx"]
+
+ from setuptools.command.sdist import sdist as _sdist
+
+@@ -40,7 +40,7 @@
+
+ else:
+ print('Distribution mode: Compiling Cython generated .cpp sources.')
+- sources = ["pyclipper/pyclipper.cpp", "pyclipper/clipper.cpp"]
++ sources = ["pyclipper/pyclipper.cpp"]
+ cmdclass = {}
+
+
+@@ -51,6 +51,9 @@
+ ext = Extension("pyclipper",
+ sources=sources,
+ language="c++",
++ include_dirs=['/usr/include/polyclipping'],
++ libraries=['polyclipping'],
++ library_dirs=['/usr/lib'],
+ # define extra macro definitions that are used by clipper
+ # Available definitions that can be used with pyclipper:
+ # use_lines, use_int32
diff --git a/community/py3-pyclipper/APKBUILD b/community/py3-pyclipper/APKBUILD
index c51d5c925c..018861afff 100644
--- a/community/py3-pyclipper/APKBUILD
+++ b/community/py3-pyclipper/APKBUILD
@@ -1,20 +1,32 @@
# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=py3-pyclipper
+_pyname=pyclipper
pkgver=1.1.0
-pkgrel=0
+# Upstream has a custom versioning scheme. Requested adopting semver.org:
+# https://github.com/fonttools/pyclipper/issues/26
+_pkgpostver="$pkgver.post3"
+pkgrel=1
pkgdesc="Cython wrapper for clipper"
url="https://github.com/fonttools/pyclipper"
arch="all"
license="MIT"
depends="python3"
-makedepends="py3-setuptools python3-dev cython"
+makedepends="py3-setuptools python3-dev cython clipper-dev"
checkdepends="py3-pytest"
-source="$pkgname-$pkgver.tar.gz::https://github.com/fonttools/pyclipper/archive/$pkgver.post2.tar.gz"
-builddir="$srcdir/pyclipper-$pkgver.post2"
+source="https://files.pythonhosted.org/packages/source/p/$_pyname/$_pyname-$_pkgpostver.zip
+ 10-system-libs.patch
+"
+builddir="$srcdir/$_pyname-$_pkgpostver"
+
+prepare() {
+ default_prepare
+ # For system-wide consistency, and to save installation space,
+ # we use the shared library from Alpine package "clipper".
+ rm pyclipper/clipper.cpp pyclipper/clipper.hpp
+}
build() {
- git init
python3 setup.py build
}
@@ -26,4 +38,5 @@ package() {
python3 setup.py install --prefix=/usr --root="$pkgdir"
}
-sha512sums="2c5044ef3a516e909a1f2e87a4824660bf02721f830a0dfb6a853eae02875b6e45a0aaaf3c3591ad7a5b6679364a366c5977f7ba1f44899f98a7c2f95f2f5061 py3-pyclipper-1.1.0.tar.gz"
+sha512sums="303be17e498f1d9fc5cdd0ce7c3e4c92c5d6dae7c7be7003402baa8403ec06951ec4805401748689e429118484cebaa6a762b8c2f4fc6ec801b4fd4a891131d9 pyclipper-1.1.0.post3.zip
+855d20489b4f7d90242ac2cb81b00b555d11925bf7c87d523a03ca3807fb1902d67a71645f7bc37f1997fd8bf779af06cb164f6de3a221149df7b69d4c2a283b 10-system-libs.patch"