Description: Changes to scons build files needed to work with python3
Author: Alastair McKinstry <mckinstry@debian.org>
Forwarded: no
Last-Updated: 2020-03-09
 Updated for python3.8

Index: python-escript-5.6/site_scons/extractdebbuild.py
===================================================================
--- python-escript-5.6.orig/site_scons/extractdebbuild.py
+++ python-escript-5.6/site_scons/extractdebbuild.py
@@ -35,7 +35,7 @@ def getdebbuildflags():
   mycflags=None
   mycxxflags=None
   try:
-    deps=subprocess.check_output("dpkg-buildflags")
+    deps=subprocess.check_output("dpkg-buildflags").decode()
   except OSError:
     return []
   res=[]
Index: python-escript-5.6/site_scons/dependencies.py
===================================================================
--- python-escript-5.6.orig/site_scons/dependencies.py
+++ python-escript-5.6/site_scons/dependencies.py
@@ -122,7 +122,7 @@ def call_python_config(bin=None):
     cmd+='  sp=subprocess.Popen([pythonroot+"python"+pyversion+"-config","--ldflags"], stdout=subprocess.PIPE)\n'
     cmd+='d=sp.stdout.readline().split()\n'
     cmd+="libdirs=[z[2:] for z in d if z.startswith(b'-L')]\n"
-    cmd+="libs=[z[2:] for z in d if z.startswith(b'-lpython')]\n"
+    cmd+="libs=[b'python'+pyversion.encode('UTF-8')]\n"
     cmd+="target=''\n"
     cmd+="libname=''\n"
     cmd+="for d in libdirs:\n"
@@ -162,7 +162,7 @@ def call_python_config(bin=None):
     libname=sp.stdout.readline().strip()
     ver=sp.stdout.readline().strip()
     pinc=sp.stdout.readline().strip()
-    return (target, libname, ver, pinc)
+    return (target.decode(), libname.decode(), ver.decode(), pinc.decode())
 
 def checkPython(env):
     # First we check to see if the config file has specified
@@ -177,7 +177,7 @@ def checkPython(env):
             python_libs=['python%s%s'%(sys.version_info[0], sys.version_info[1])]
             verstring=".".join([str(i) for i in sys.version_info[:3]])
         else:
-            (python_lib_path, python_libs,verstring, python_inc_path)=call_python_config(env['pythoncmd'])
+            (python_lib_path, python_libs,verstring, python_inc_path)=call_python_config(env['pythoncmd'])            
 
     # if we want to use a python other than the one scons is running
     # Note: we assume scons is running python 2 in the following.
@@ -793,6 +793,7 @@ def checkOptionalLibraries(env):
         else:
             which = Popen(['which', 'gmsh'], stdout=PIPE)
             path,_ = which.communicate()
+            path = path.decode()
             if which.wait() == 0:
                 cmd = ['ldd', path[:-1]]
                 if env['IS_OSX']:
