--- 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',