summarylogtreecommitdiffstats
path: root/0001_python3_and_scons.patch
blob: a7822de058508a3adac78749942387f554ee097a (plain)
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
--- a/config/qt5/__init__.py	2019-02-09 03:42:39.000000000 -0500
+++ b/config/qt5/__init__.py	2022-03-12 12:05:18.481925020 -0500
@@ -42,7 +42,12 @@
 import SCons.Util
 
 
-class ToolQt5Warning(SCons.Warnings.Warning): pass
+def _bytes_to_str(s):
+    if isinstance(s, bytes): return s.decode()
+    return s
+
+
+class ToolQt5Warning(SCons.Warnings.SConsWarning): pass
 class GeneratedMocFileNotIncluded(ToolQt5Warning): pass
 class QtdirNotFound(ToolQt5Warning): pass
 
@@ -187,7 +192,7 @@
                 if moc_options['debug']:
                     print("scons: qt5: Scanning '%s' (header of '%s')" %
                           (h, cpp))
-                h_contents = h.get_contents()
+                h_contents = _bytes_to_str(h.get_contents())
 
                 if moc_options['gobble_comments']:
                     h_contents = self.ccomment.sub('', h_contents)
@@ -271,7 +276,7 @@
                             print("scons: qt5: Scanning '%s' (header of '%s')" %
                                   (h, cpp))
 
-                        h_contents = h.get_contents()
+                        h_contents = _bytes_to_str(h.get_contents())
                         if moc_options['gobble_comments']:
                             h_contents = self.ccomment.sub('', h_contents)
                             h_contents = self.cxxcomment.sub('', h_contents)
@@ -370,7 +375,8 @@
                 continue
 
             try:
-                cpp_contents = cpp.get_contents()
+                cpp_contents = _bytes_to_str(cpp.get_contents())
+
                 if moc_options['gobble_comments']:
                     cpp_contents = self.ccomment.sub('', cpp_contents)
                     cpp_contents = self.cxxcomment.sub('', cpp_contents)
@@ -423,6 +429,7 @@
         p = subprocess.Popen('%s -v' % moc, shell = True,
                              stdout = subprocess.PIPE, close_fds = True)
         vernumber = p.stdout.read()
+        if isinstance(vernumber, bytes): vernumber = vernumber.decode()
         vernumber = mocver_re.match(vernumber)
 
         if vernumber:
@@ -457,7 +464,7 @@
             else: result.append(itemPath)
         return result
 
-    contents = node.get_contents()
+    contents = _bytes_to_str(node.get_contents())
     includes = qrcinclude_re.findall(contents)
     qrcpath = os.path.dirname(node.path)
     dirs = [included for included in includes if
@@ -751,7 +758,7 @@
         QT5_MOCDEFPREFIX = '-D',
         QT5_MOCDEFSUFFIX = '',
         QT5_MOCDEFINES = '${_defines(QT5_MOCDEFPREFIX, CPPDEFINES, '
-        'QT5_MOCDEFSUFFIX, __env__)}',
+        'QT5_MOCDEFSUFFIX, __env__, TARGET, SOURCE)}',
         QT5_MOCCPPPATH = [],
         QT5_MOCINCFLAGS = '$( ${_concat(QT5_MOCINCPREFIX, QT5_MOCCPPPATH, '
         'INCSUFFIX, __env__, RDirs)} $)',
@@ -932,7 +939,7 @@
         except: pass
 
     debugSuffix = ''
-    if sys.platform in ["darwin", "linux2"] and not crosscompiling :
+    if sys.platform in ["darwin", "linux2", "linux"] and not crosscompiling :
         if debug : debugSuffix = '_debug'
         for module in modules :
             if module not in pclessModules : continue
--- a/SConstruct	2019-02-09 03:42:39.000000000 -0500
+++ b/SConstruct	2022-03-12 12:03:04.921922687 -0500
@@ -48,7 +48,7 @@
     lines += os.popen('svn status -v cbang').readlines()
     lines = filter(lambda l: len(l) and l[0] in 'MA ', lines)
     files = map(lambda l: l.split()[-1], lines)
-    files = filter(lambda f: not os.path.isdir(f), files)
+    files = list(filter(lambda f: not os.path.isdir(f), files))
 
     tar = env.TarBZ2Dist('camotics', files)
     Alias('dist', tar)
@@ -129,7 +129,7 @@
 src = []
 for subdir in ['', 'ast', 'parse', 'interp', 'machine', 'plan', 'plan/bbctrl']:
     src += Glob('src/gcode/%s/*.cpp' % subdir)
-src = map(lambda path: re.sub(r'^src/', 'build/', str(path)), src)
+src = list(map(lambda path: re.sub(r'^src/', 'build/', str(path)), src))
 lib = env.Library('build/libGCode', src)
 libGCode = lib
 env.Prepend(LIBS = lib)
@@ -137,14 +137,14 @@
 
 # libSTL
 src = Glob('src/stl/*.cpp')
-src = map(lambda path: re.sub(r'^src/', 'build/', str(path)), src)
+src = list(map(lambda path: re.sub(r'^src/', 'build/', str(path)), src))
 lib = env.Library('build/libSTL', src)
 env.Prepend(LIBS = lib)
 
 
 # libDXF
 src = Glob('src/dxf/*.cpp')
-src = map(lambda path: re.sub(r'^src/', 'build/', str(path)), src)
+src = list(map(lambda path: re.sub(r'^src/', 'build/', str(path)), src))
 lib = env.Library('build/libDXF', src)
 env.Prepend(LIBS = lib)
 
@@ -155,7 +155,7 @@
 for subdir in subdirs: src += Glob('src/camotics/%s/*.cpp' % subdir)
 if env['with_tpl']: src += Glob('src/tplang/*.cpp')
 
-src = map(lambda path: re.sub(r'^src/', 'build/', str(path)), src)
+src = list(map(lambda path: re.sub(r'^src/', 'build/', str(path)), src))
 
 
 # Build Info
@@ -185,6 +185,7 @@
     for subdir in subdirs:
         guiSrc += Glob('src/camotics/%s/*.cpp' % subdir)
     guiSrc = map(lambda path: re.sub(r'^src/', 'build/', str(path)), guiSrc)
+    guiSrc = list(guiSrc)
 
     # Qt
     dialogs = '''
@@ -294,13 +295,15 @@
     cmd = 'git ls-files examples/'
     p = subprocess.Popen(cmd, shell = True, stdout = subprocess.PIPE)
     examples = p.communicate()[0]
-    examples = map(lambda x: [x, x], examples.split())
+    if isinstance(examples, bytes): examples = examples.decode()
+    examples = list(map(lambda x: [x, x], examples.split()))
 
     # Machines
     cmd = 'git ls-files machines/'
     p = subprocess.Popen(cmd, shell = True, stdout = subprocess.PIPE)
     machines = p.communicate()[0]
-    machines = map(lambda x: [x, x], machines.split())
+    if isinstance(machines, bytes): machines = machines.decode()
+    machines = list(map(lambda x: [x, x], machines.split()))
 
 # Package
 if 'package' in COMMAND_LINE_TARGETS:
@@ -355,7 +358,7 @@
         platform_independent = ('tpl_lib'),
 
         documents = ['README.md', 'CHANGELOG.md'] + examples + machines,
-        programs = map(lambda x: str(x[0]), execs),
+        programs = list(map(lambda x: str(x[0]), execs)),
         desktop_menu = ['CAMotics.desktop'],
         changelog = 'CHANGELOG.md',