summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan B├╝hler <stbuehler@web.de>2017-11-06 19:11:30 +0100
committerGlenn Strauss <gstrauss@gluelogic.com>2017-11-08 00:02:54 -0500
commitd102a7113f6978041251f362d267749f2ab33e47 (patch)
treea7e7e8f0e8f3da7a56384f731a208e4e5724d474
parent2728572af3b1f75d38efdcd6fb87a38f1d236c4b (diff)
downloadlighttpd1.4-d102a7113f6978041251f362d267749f2ab33e47.tar.gz
lighttpd1.4-d102a7113f6978041251f362d267749f2ab33e47.zip
[scons] fix various python2/3 incompatibilities
-rw-r--r--SConstruct12
-rw-r--r--src/SConscript15
2 files changed, 19 insertions, 8 deletions
diff --git a/SConstruct b/SConstruct
index 6aa1cafe..4b847f1f 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1,3 +1,4 @@
+from __future__ import print_function
import os
import re
import string
@@ -5,6 +6,11 @@ import sys
from copy import copy
from stat import *
+try:
+ string_types = basestring
+except NameError:
+ string_types = str
+
package = 'lighttpd'
version = '1.4.48'
@@ -14,7 +20,7 @@ def underscorify(id):
def fail(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
- env.Exit(-1)
+ sys.exit(-1)
class Autoconf:
class RestoreEnvLibs:
@@ -91,7 +97,7 @@ class Autoconf:
if self.CheckCHeader(hdr):
# if we have a list of headers define HAVE_ only for last one
target = hdr
- if not isinstance(target, basestring):
+ if not isinstance(target, string_types):
target = target[-1]
self.conf.env.Append(CPPFLAGS = [ '-DHAVE_' + underscorify(target) ])
return True
@@ -632,7 +638,7 @@ elif re.compile("darwin|aix").search(env['PLATFORM']):
else:
env.Append(COMMON_LIB = False)
-versions = string.split(version, '.')
+versions = version.split('.')
version_id = int(versions[0]) << 16 | int(versions[1]) << 8 | int(versions[2])
env.Append(CPPFLAGS = [
'-DLIGHTTPD_VERSION_ID=' + hex(version_id),
diff --git a/src/SConscript b/src/SConscript
index a518b8b5..07a134fc 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -1,10 +1,15 @@
import itertools
import os
import re
-import types
from collections import OrderedDict
from copy import copy
+try:
+ string_types = basestring
+except NameError:
+ string_types = str
+
+
# search any file, not just executables
def WhereIsFile(file, paths):
for d in paths:
@@ -22,7 +27,7 @@ def WhereIsFile(file, paths):
return None
def FlattenLibs(libs):
- if isinstance(libs, basestring):
+ if isinstance(libs, string_types):
return [libs]
else:
return [item for sublibs in libs for item in FlattenLibs(sublibs)]
@@ -173,7 +178,7 @@ staticinit = ''
for module in modules.keys():
staticsrc += modules[module]['src']
staticinit += "PLUGIN_INIT(%s)\n"%module
- if modules[module].has_key('lib'):
+ if 'lib' in modules[module]:
staticlib += modules[module]['lib']
def WriteStaticPluginHeader(target, source, env):
@@ -227,7 +232,7 @@ f.close
lddre = re.compile(r'^\s+lib([^=-]+)(?:-[\.0-9]+)?\.so\.[0-9]+ =>', re.MULTILINE)
for libs in staticlib:
- if type(libs) is types.StringType: libs = [ libs ]
+ if isinstance(libs, string_types): libs = [ libs ]
for lib in libs:
fullstaticlib += [ lib ]
solibpath = WhereIsFile('lib' + lib + '.so', paths = searchlibs)
@@ -293,7 +298,7 @@ env['SHLIBPREFIX'] = ''
instlib = []
for module in modules.keys():
libs = [ common_lib ]
- if modules[module].has_key('lib'):
+ if 'lib' in modules[module]:
libs += modules[module]['lib']
instlib += env.SharedLibrary(module, modules[module]['src'], LIBS = GatherLibs(env, libs))
env.Alias('modules', instlib)