[Scons-dev] Python3 problem under Solaris

Rob Boehne robb at datalogics.com
Mon Nov 25 17:34:13 EST 2019


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 at 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 at 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.


(python-env-lhasa) robb at lhasa:/devlocal/robb/apdfl-18box/python-env-lhasa/lib/python3.7/site-packages/scons/SCons/Tool (develop-18)$ diff -u suncxx.py~ suncxx.py

--- suncxx.py~  Mon Nov 25 11:45:14 2019

+++ suncxx.py   Mon Nov 25 16:27:09 2019

@@ -69,6 +69,7 @@



         try:

             p = subprocess.Popen([pkginfo, '-l', package_name],

+                                 encoding='utf-8',

                                  stdout=subprocess.PIPE,

                                  stderr=DEVNULL)

         except EnvironmentError:

@@ -83,6 +84,7 @@

         if pathname is None:

             try:

                 p = subprocess.Popen([pkgchk, '-l', package_name],

+                                     encoding='utf-8',

                                      stdout=subprocess.PIPE,

                                      stderr=DEVNULL)

             except EnvironmentError:


Thanks,

Rob Boehne

[cid:image002.png at 01D3D0E3.DCFE6710]
Rob Boehne
Senior Software Architect | Datalogics, Inc.
+1.312.853.8351<tel:(312)%20853-8351> | robb at datalogics.com<mailto:robb at datalogics.com>
datalogics.com<http://www.datalogics.com/> | blogs.datalogics.com<http://blogs.datalogics.com/>
Connect with us: Facebook<https://www.facebook.com/DatalogicsInc> | Twitter<https://twitter.com/DatalogicsInc> | LinkedIn<https://www.linkedin.com/company/datalogics?actionToken=p=p%3Dbiz-company-login%26c%3D3217e65a-bdc2-4b38-8f9c-13c982e8c529%26m%3Dcompany_feed%26n%3D0&t=a%3DisFolloweeOfPoster%253Dfalse%2526distanceFromActor%253D-1%2526actorType%253D%2526likedByUser%253Dfalse%2526targetId%253D%2526recentCommentUrns%253D%2526targetType%253D%2526sponsoredFlag%253DORGANIC%2526verbType%253Dlinkedin%25253Ashare%2526objectType%253Dlinkedin%25253Aarticle%2526totalShares%253D0%2526activityId%253Durn%25253Ali%25253Aactivity%25253A6263731876121362433%2526recentLikerUrns%253D%2526actorId%253Durn%25253Ali%25253Acompany%25253A14000%2526totalComments%253D0%2526relevanceScore%253D0.0%2526recentCommenterUrns%253D%2526isPublic%253Dtrue%2526time%253D-1%2526totalLikes%253D0%2526objectId%253Durn%25253Ali%25253Aarticle%25253A7793179909183391510%2526distanceFromNestedActor%253D-1%26s%3DORG> | YouTube<https://www.youtube.com/user/Datalogics>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist2.pair.net/pipermail/scons-dev/attachments/20191125/7f8b7583/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 124449 bytes
Desc: image001.png
URL: <https://pairlist2.pair.net/pipermail/scons-dev/attachments/20191125/7f8b7583/attachment-0001.png>


More information about the Scons-dev mailing list