From d102a7113f6978041251f362d267749f2ab33e47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BChler?= Date: Mon, 6 Nov 2017 19:11:30 +0100 Subject: [scons] fix various python2/3 incompatibilities --- SConstruct | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'SConstruct') 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), -- cgit v1.2.1