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
|
From 931a55347a322f38eb82d5f387b2924e6c7a1746 Mon Sep 17 00:00:00 2001
From: Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
Date: Thu, 9 Jan 2020 10:07:20 +0100
Subject: [PATCH] Update SConstruct with new Python3 syntax: - new raise
keyword syntax - has_key deprecated method is now removed - commands
deprecated library is replaced by subprocess - print function fixes
This should fix FTBFS against new scons 3.1.2
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=947584
---
SConstruct | 45 +++++++++++++++++++++++----------------------
1 file changed, 23 insertions(+), 22 deletions(-)
diff --git a/SConstruct b/SConstruct
index ae3df10b..9d1c8914 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1,18 +1,19 @@
-import os, sys, commands
+import os, sys
+from subprocess import check_output
env = Environment(ENV = os.environ)
# figure out a better way to configure this
-if os.environ.has_key('CXX'):
+if 'CXX' in os.environ:
env['CXX'] = os.environ['CXX']
-if os.environ.has_key('DEBUG'):
+if 'DEBUG' in os.environ:
env['DEBUG'] = os.environ['DEBUG']
-if os.environ.has_key('CXXFLAGS'):
+if 'CXXFLAGS' in os.environ:
#env['CXXFLAGS'] = os.environ['CXXFLAGS']
env.Append(CXXFLAGS = os.environ['CXXFLAGS'])
-if os.environ.has_key('LINKFLAGS'):
+if 'LINKFLAGS' in os.environ:
#env['LDFLAGS'] = os.environ['LDFLAGS']
env.Append(LINKFLAGS = os.environ['LINKFLAGS'])
@@ -22,24 +23,24 @@ if os.environ.has_key('LINKFLAGS'):
## or set BOOST_INCLUDES and BOOST_LIBS if Boost comes with your OS distro e.g. and
## needs BOOST_INCLUDES=/usr/include/boost and BOOST_LIBS=/usr/lib like Ubuntu.
##
-if os.environ.has_key('BOOSTROOT'):
+if 'BOOSTROOT' in os.environ:
os.environ['BOOST_ROOT'] = os.environ['BOOSTROOT']
-if os.environ.has_key('BOOST_ROOT'):
+if 'BOOST_ROOT' in os.environ:
env['BOOST_INCLUDES'] = os.environ['BOOST_ROOT']
env['BOOST_LIBS'] = os.path.join(os.environ['BOOST_ROOT'], 'stage', 'lib')
-elif os.environ.has_key('BOOST_INCLUDES') and os.environ.has_key('BOOST_LIBS'):
+elif 'BOOST_INCLUDES' in os.environ and 'BOOST_LIBS' in os.environ:
env['BOOST_INCLUDES'] = os.environ['BOOST_INCLUDES']
env['BOOST_LIBS'] = os.environ['BOOST_LIBS']
else:
- raise SCons.Errors.UserError, "Neither BOOST_ROOT, nor BOOST_INCLUDES + BOOST_LIBS was set!"
+ raise SCons.Errors.UserError("Neither BOOST_ROOT, nor BOOST_INCLUDES + BOOST_LIBS were set!")
## Custom OpenSSL
-if os.environ.has_key('OPENSSL_PATH'):
+if 'OPENSSL_PATH' in os.environ:
env.Append(CPPPATH = os.path.join(os.environ['OPENSSL_PATH'], 'include'))
env.Append(LIBPATH = os.environ['OPENSSL_PATH'])
-if os.environ.has_key('WSPP_ENABLE_CPP11'):
+if 'WSPP_ENABLE_CPP11' in os.environ:
env['WSPP_ENABLE_CPP11'] = True
else:
env['WSPP_ENABLE_CPP11'] = False
@@ -76,7 +77,7 @@ if env['PLATFORM'].startswith('win'):
env['CCFLAGS'] = '%s /EHsc /GR /GS- /MD /nologo %s %s' % (warn_flags, arch_flags, opt_flags)
env['LINKFLAGS'] = '/INCREMENTAL:NO /MANIFEST /NOLOGO /OPT:REF /OPT:ICF /MACHINE:X86'
elif env['PLATFORM'] == 'posix':
- if env.has_key('DEBUG'):
+ if 'DEBUG' in env:
env.Append(CCFLAGS = ['-g', '-O0'])
else:
env.Append(CPPDEFINES = ['NDEBUG'])
@@ -84,9 +85,9 @@ elif env['PLATFORM'] == 'posix':
env.Append(CCFLAGS = ['-Wall'])
#env['LINKFLAGS'] = ''
elif env['PLATFORM'] == 'darwin':
- if not os.environ.has_key('CXX'):
+ if not 'CXX' in os.environ:
env['CXX'] = "clang++"
- if env.has_key('DEBUG'):
+ if 'DEBUG' in env:
env.Append(CCFLAGS = ['-g', '-O0'])
else:
env.Append(CPPDEFINES = ['NDEBUG'])
@@ -157,29 +158,29 @@ env_cpp11 = env.Clone ()
if env_cpp11['CXX'].startswith('g++'):
# TODO: check g++ version
- GCC_VERSION = commands.getoutput(env_cpp11['CXX'] + ' -dumpversion')
+ GCC_VERSION = check_output([env_cpp11['CXX'], '-dumpversion'])
- if GCC_VERSION > "4.4.0":
- print "C++11 build environment partially enabled"
+ if GCC_VERSION.decode('utf-8') > "4.4.0":
+ print("C++11 build environment partially enabled")
env_cpp11.Append(WSPP_CPP11_ENABLED = "true",CXXFLAGS = ['-std=c++0x'],TOOLSET = ['g++'],CPPDEFINES = ['_WEBSOCKETPP_CPP11_STL_'])
else:
- print "C++11 build environment is not supported on this version of G++"
+ print("C++11 build environment is not supported on this version of G++")
elif env_cpp11['CXX'].startswith('clang++'):
- print "C++11 build environment enabled"
+ print("C++11 build environment enabled")
env.Append(CXXFLANGS = ['-stdlib=libc++'],LINKFLAGS=['-stdlib=libc++'])
env_cpp11.Append(WSPP_CPP11_ENABLED = "true",CXXFLAGS = ['-std=c++0x','-stdlib=libc++'],LINKFLAGS = ['-stdlib=libc++'],TOOLSET = ['clang++'],CPPDEFINES = ['_WEBSOCKETPP_CPP11_STL_'])
# look for optional second boostroot compiled with clang's libc++ STL library
# this prevents warnings/errors when linking code built with two different
# incompatible STL libraries.
- if os.environ.has_key('BOOST_ROOT_CPP11'):
+ if 'BOOST_ROOT_CPP11' in os.environ:
env_cpp11['BOOST_INCLUDES'] = os.environ['BOOST_ROOT_CPP11']
env_cpp11['BOOST_LIBS'] = os.path.join(os.environ['BOOST_ROOT_CPP11'], 'stage', 'lib')
- elif os.environ.has_key('BOOST_INCLUDES_CPP11') and os.environ.has_key('BOOST_LIBS_CPP11'):
+ elif 'BOOST_INCLUDES_CPP11' in os.environ and 'BOOST_LIBS_CPP11' in os.environ:
env_cpp11['BOOST_INCLUDES'] = os.environ['BOOST_INCLUDES_CPP11']
env_cpp11['BOOST_LIBS'] = os.environ['BOOST_LIBS_CPP11']
else:
- print "C++11 build environment disabled"
+ print("C++11 build environment disabled")
# if the build system is known to allow the isystem modifier for library include
# values then use it for the boost libraries. Otherwise just add them to the
|