$NetBSD: patch-SConstruct,v 1.1 2023/07/24 16:52:45 wiz Exp $ Support Python 3. --- SConstruct.orig 2019-01-28 01:12:19.000000000 +0000 +++ SConstruct @@ -61,21 +61,21 @@ env = Environment(options = opts, Help(opts.GenerateHelpText(env)) # Copy environment variables -if os.environ.has_key('CC'): +if 'CC' in os.environ: env["CC"] = os.getenv('CC') -if os.environ.has_key('CXX'): +if 'CXX' in os.environ: env["CXX"] = os.getenv('CXX') -if os.environ.has_key('AS'): +if 'AS' in os.environ: env["AS"] = os.getenv('AS') -if os.environ.has_key('LD'): +if 'LD' in os.environ: env["LINK"] = os.getenv('LD') -if os.environ.has_key('CFLAGS'): +if 'CFLAGS' in os.environ: env.Append(CCFLAGS = SCons.Util.CLVar(os.environ['CFLAGS'])) -if os.environ.has_key('CPPFLAGS'): +if 'CPPFLAGS' in os.environ: env.Append(CPPFLAGS = SCons.Util.CLVar(os.environ['CPPFLAGS'])) -if os.environ.has_key('CXXFLAGS'): +if 'CXXFLAGS' in os.environ: env.Append(CXXFLAGS = SCons.Util.CLVar(os.environ['CXXFLAGS'])) -if os.environ.has_key('LDFLAGS'): +if 'LDFLAGS' in os.environ: env.Append(LINKFLAGS = SCons.Util.CLVar(os.environ['LDFLAGS'])) # Windows Configuration Changes @@ -95,7 +95,7 @@ if sys.platform == "win32": if env["HASH_ALGO"] == "SHA256": env.Append(CPPFLAGS = [ "-DORI_USE_SHA256" ]) else: - print "Error unsupported hash algorithm" + print("Error unsupported hash algorithm") sys.exit(-1) if env["COMPRESSION_ALGO"] == "LZMA": @@ -105,9 +105,9 @@ elif env["COMPRESSION_ALGO"] == "FASTLZ" elif env["COMPRESSION_ALGO"] == "SNAPPY": env.Append(CPPFLAGS = [ "-DORI_USE_SNAPPY" ]) elif env["COMPRESSION_ALGO"] == "NONE": - print "Building without compression" + print("Building without compression") else: - print "Error unsupported compression algorithm" + print("Error unsupported compression algorithm") sys.exit(-1) if env["CHUNKING_ALGO"] == "RK": @@ -115,7 +115,7 @@ if env["CHUNKING_ALGO"] == "RK": elif env["CHUNKING_ALGO"] == "FIXED": env.Append(CPPFLAGS = [ "-DORI_USE_FIXED" ]) else: - print "Error unsupported chunking algorithm" + print("Error unsupported chunking algorithm") sys.exit(-1) if not env["WITH_MDNS"]: @@ -135,7 +135,7 @@ elif env["BUILDTYPE"] == "PERF": elif env["BUILDTYPE"] == "RELEASE": env.Append(CPPFLAGS = ["-DNDEBUG", "-DORI_RELEASE", "-w", "-O2"]) else: - print "Error BUILDTYPE must be RELEASE or DEBUG" + print("Error BUILDTYPE must be RELEASE or DEBUG") sys.exit(-1) try: @@ -202,12 +202,12 @@ conf = env.Configure(custom_tests = { 'C 'CheckPkgMinVersion' : CheckPkgMinVersion }) if not conf.CheckCC(): - print 'Your C compiler and/or environment is incorrectly configured.' + print('Your C compiler and/or environment is incorrectly configured.') CheckFailed() env.AppendUnique(CXXFLAGS = ['-std=c++11']) if not conf.CheckCXX(): - print 'Your C++ compiler and/or environment is incorrectly configured.' + print('Your C++ compiler and/or environment is incorrectly configured.') CheckFailed() if (sys.platform == "win32") or env["CROSSCOMPILE"]: @@ -215,15 +215,15 @@ if (sys.platform == "win32") or env["CRO else: env["HAS_PKGCONFIG"] = True if not conf.CheckPkgConfig(): - print 'pkg-config not found!' + print('pkg-config not found!') Exit(1) if not conf.CheckCXXHeader('unordered_map'): - print 'C++11 libraries appear to be missing' + print('C++11 libraries appear to be missing') if sys.platform.startswith("freebsd"): if not conf.CheckLib('execinfo'): - print 'FreeBSD requires libexecinfo to build.' + print('FreeBSD requires libexecinfo to build.') Exit(1) check_uuid_h = conf.CheckCHeader('uuid.h') @@ -233,7 +233,7 @@ if check_uuid_h: elif check_uuid_uuid_h: env.Append(CPPFLAGS = "-DHAVE_UUID_UUID_H") else: - print 'Supported UUID header is missing!' + print('Supported UUID header is missing!') Exit(1) if env["COMPRESSION_ALGO"] == "LZMA": @@ -241,39 +241,39 @@ if env["COMPRESSION_ALGO"] == "LZMA": 'lzma.h', 'C', 'lzma_version_string();'): - print 'Please install liblzma' + print('Please install liblzma') Exit(1) if env["WITH_FUSE"]: if env["HAS_PKGCONFIG"] and not conf.CheckPkg('fuse'): - print 'FUSE is not registered in pkg-config' + print('FUSE is not registered in pkg-config') Exit(1) if env["HAS_PKGCONFIG"]: if not conf.CheckPkg('libevent'): - print 'libevent is not registered in pkg-config' + print('libevent is not registered in pkg-config') Exit(1) if not conf.CheckPkgMinVersion("libevent", "2.0"): - print 'libevent version 2.0 or above required' + print('libevent version 2.0 or above required') Exit(1) env.ParseConfig('pkg-config --libs --cflags libevent') has_event = conf.CheckLibWithHeader('', 'event2/event.h', 'C', 'event_init();') if not (has_event or (env["CROSSCOMPILE"])): - print 'Cannot link test binary with libevent 2.0+' + print('Cannot link test binary with libevent 2.0+') Exit(1) if (env["WITH_MDNS"]) and (sys.platform != "darwin"): if not conf.CheckLibWithHeader('dns_sd','dns_sd.h','C'): - print 'Please install libdns_sd' - Exit(1) + print('Please install libdns_sd') + Exit(1) if env["HAS_PKGCONFIG"]: if not conf.CheckPkg("openssl"): - print 'openssl is not registered in pkg-config' + print('openssl is not registered in pkg-config') Exit(1) if not conf.CheckPkgMinVersion("openssl", "1.0.0"): - print 'openssl version 1.0.0 or above required' + print('openssl version 1.0.0 or above required') Exit(1) env.ParseConfig('pkg-config --libs --cflags openssl') @@ -313,7 +313,7 @@ if env["WITH_ASAN"]: env.Append(CPPFLAGS = ["-fsanitize=address"]) env.Append(LINKFLAGS = ["-fsanitize=address"]) if env["WITH_TSAN"] and env["WITH_ASAN"]: - print "Cannot set both WITH_TSAN and WITH_ASAN!" + print("Cannot set both WITH_TSAN and WITH_ASAN!") sys.exit(-1) # libori