Re: Python3 problem under Solaris
Mats Wichmann <[email protected]> Mon, 25 Nov 2019 16:12:27 -0700
| Newsgroups | gmane.comp.programming.tools.scons.devel |
|---|---|
| Message-ID | <[email protected]> |
On 11/25/19 3:34 PM, Rob Boehne wrote: > I’m porting to SPARC Solaris a project that uses Scons in Python3 – (we > use it widely on Sparc & Intel Solaris with python 2.7) and I’m seeing > what appears to be a Python3 porting problem when an Environment object > is created: > > (python-env-lhasa) > robb@lhasa:/devlocal/robb/apdfl-18box/pdfl18_all/DevTests (sparc_stuff)$ > scons BUILD_64_BIT=true STAGE=Debug TESTS=smoke > > scons: Reading SConscript files ... > > Building for Debug > > TypeError: cannot use a string pattern on a bytes-like object: > > File "/devlocal/robb/apdfl-18box/pdfl18_all/DevTests/SConstruct", > line 538: > > OS_LEVEL='') > > File > "/devlocal/robb/apdfl-18box/python-env-lhasa/lib/python3.7/site-packages/scons/SCons/Environment.py", > line 992: > > apply_tools(self, tools, toolpath) > > File > "/devlocal/robb/apdfl-18box/python-env-lhasa/lib/python3.7/site-packages/scons/SCons/Environment.py", > line 107: > > env.Tool(tool) > > File > "/devlocal/robb/apdfl-18box/python-env-lhasa/lib/python3.7/site-packages/scons/SCons/Environment.py", > line 1799: > > tool(self) > > File > "/devlocal/robb/apdfl-18box/python-env-lhasa/lib/python3.7/site-packages/scons/SCons/Tool/__init__.py", > line 303: > > self.generate(env, *args, **kw) > > File > "/devlocal/robb/apdfl-18box/python-env-lhasa/lib/python3.7/site-packages/scons/SCons/Tool/default.py", > line 40: > > for t in SCons.Tool.tool_list(env['PLATFORM'], env): > > File > "/devlocal/robb/apdfl-18box/python-env-lhasa/lib/python3.7/site-packages/scons/SCons/Tool/__init__.py", > line 1288: > > cxx_compiler = FindTool(cxx_compilers, env) or cxx_compilers[0] > > File > "/devlocal/robb/apdfl-18box/python-env-lhasa/lib/python3.7/site-packages/scons/SCons/Tool/__init__.py", > line 1174: > > if t.exists(env): > > File > "/devlocal/robb/apdfl-18box/python-env-lhasa/lib/python3.7/site-packages/scons/SCons/Tool/suncxx.py", > line 139: > > path, cxx, shcxx, version = get_cppc(env) > > File > "/devlocal/robb/apdfl-18box/python-env-lhasa/lib/python3.7/site-packages/scons/SCons/Tool/suncxx.py", > line 115: > > path, version = get_package_info(package, pkginfo, pkgchk) > > File > "/devlocal/robb/apdfl-18box/python-env-lhasa/lib/python3.7/site-packages/scons/SCons/Tool/suncxx.py", > line 79: > > version_match = version_re.search(pkginfo_contents) > > (python-env-lhasa) > robb@lhasa:/devlocal/robb/apdfl-18box/pdfl18_all/DevTests (sparc_stuff)$ > > I corrected this by specifying encoding=’utf-8’ to the two > subprocess.Popen() calls in SCons/Tool/suncxx.py > > And I **think** that should be fine for Python 2.7 as well. > > I haven’t done any SCons development in a long while, but here is a > diff. It should be fairly obvious if this is the right fix. there's a similar fix that recently went in as commit b907ebd6, which is in master but not released. I'd personally prefer to run subprocess.Popen with text=True (or for the brief period we still support Python 2.7, universal_newlines instead). Since we *know* we're going to talk to a command that's going to speak text to us - we're going to ask it to tell us the version number, only - it sounds better to let Python handle it rather than let the stdout pipe be opened in binary mode and then have to fuss with encodings. _______________________________________________ Scons-dev mailing list [email protected] https://pairlist2.pair.net/mailman/listinfo/scons-dev