1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
Description: Fix build sequence for Debian
This fix allows performing setup actions such as cleaning without importing
printcore dependencies.
.
It restricts the Cython call to build-time and not every time the setup.py
file is called.
Forwarded: not-needed
Author: Rock Storm <rockstorm@gmx.com>
--- a/setup.py
+++ b/setup.py
@@ -19,18 +19,22 @@
import glob
from setuptools import setup
from setuptools import find_packages
+from setuptools import extension
+from setuptools.command.build_ext import build_ext as build_ext_orig
try:
from Cython.Build import cythonize
- extensions = cythonize("printrun/gcoder_line.pyx")
- from Cython.Distutils import build_ext
+ # extensions = cythonize("printrun/gcoder_line.pyx")
+ # from Cython.Distutils import build_ext
+ extensions = [extension.Extension("printrun.gcoder_line",
+ ["printrun/gcoder_line.c"])]
except ImportError as e:
print("WARNING: Failed to cythonize: %s" % e)
# Debug helper: uncomment these:
# import traceback
# traceback.print_exc()
extensions = None
- build_ext = None
+ # build_ext = None
with open('README.md') as f:
@@ -64,6 +68,15 @@
data_files.append((f'share/{locale}', glob.glob(f'{locale}/*.mo')))
+class build_ext (build_ext_orig):
+
+ def run(self):
+ try:
+ cythonize("printrun/gcoder_line.pyx")
+ except NameError as e:
+ print("WARNING: Failed to cythonize: %s" % e)
+ super().run()
+
setup(
name="Printrun",
version=__version__,
@@ -79,7 +92,8 @@
ext_modules=extensions,
python_requires=">=3.6",
install_requires=install_requires,
- setup_requires=["Cython"],
+ # setup_requires=["Cython"],
+ cmdclass = {"build_ext": build_ext},
classifiers=[
"Environment :: X11 Applications :: GTK",
"Intended Audience :: End Users/Desktop",
|