1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-25 12:15:32 +03:00
aports/community/py3-pyclipper/10-system-libs.patch
Sascha Brawer ce0a029fd4 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.
2020-03-06 16:14:16 +01:00

38 lines
1.4 KiB
Diff

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