Browse Source

[scons] fix various python2/3 incompatibilities

personal/stbuehler/1.4.48-mod-proxy-fix
Stefan Bühler 4 years ago
committed by Glenn Strauss
parent
commit
d102a7113f
  1. 12
      SConstruct
  2. 15
      src/SConscript

12
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),

15
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)

Loading…
Cancel
Save