Package: printrun / 1.6.0-2

2005_fix-build-sequence.patch Patch series | download
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
64
65
Description: Fix build sequence for Debian
 This fix allows performing setup actions such as cleaning without importing
 printcore dependencies.
 .
 It hardcodes version number at the setup.py script to avoid calling to
 printcore.py. 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
@@ -21,22 +21,32 @@
 from distutils.core import setup
 from distutils.command.install import install as _install
 from distutils.command.install_data import install_data as _install_data
+from distutils.command.build_ext import build_ext as _build_ext
 try:
     from Cython.Build import cythonize
-    extensions = cythonize("printrun/gcoder_line.pyx")
-    from Cython.Distutils import build_ext
+    from distutils.extension import Extension
+    extensions = [Extension("printrun.gcoder_line",
+                            ["printrun/gcoder_line.c"])]
 except ImportError, e:
     print "WARNING: Failed to cythonize: %s" % e
     # Debug helper: uncomment these:
     # import traceback
     # traceback.print_exc()
     extensions = None
-    build_ext = None
 
-from printrun.printcore import __version__ as printcore_version
+#from printrun.printcore import __version__ as printcore_version
 
 INSTALLED_FILES = "installed_files"
 
+class build_ext (_build_ext):
+
+    def run(self):
+        try:
+            cythonize("printrun/gcoder_line.pyx")
+        except NameError, e:
+            print "WARNING: Failed to cythonize: %s" % e
+        _build_ext.run(self)
+
 class install (_install):
 
     def run(self):
@@ -154,12 +164,11 @@
 
 cmdclass = {"uninstall": uninstall,
             "install": install,
-            "install_data": install_data}
-if build_ext:
-    cmdclass['build_ext'] = build_ext
+            "install_data": install_data,
+            "build_ext": build_ext}
 
 setup(name = "Printrun",
-      version = printcore_version,
+      version = "1.6.0",
       description = "Host software for 3D printers",
       author = "Kliment Yanev",
       url = "http://github.com/kliment/Printrun/",