From 393e851245d88c2bffa352005b3e1104f267e898 Mon Sep 17 00:00:00 2001 From: Merlin Nimier-David Date: Mon, 2 May 2022 10:41:58 +0200 Subject: [PATCH 1/4] SCons: prefer `dependencies/version.txt` Fixes a header naming conflict on macOS (issue #156). --- build/SConscript.configure | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build/SConscript.configure b/build/SConscript.configure index fe9a25028..9370daa99 100644 --- a/build/SConscript.configure +++ b/build/SConscript.configure @@ -280,7 +280,9 @@ else: Export('MTS_VERSION') if needsBuildDependencies: - versionFilename = GetBuildPath('#dependencies/version') + versionFilename = GetBuildPath('#dependencies/version.txt') + if not os.path.exists(versionFilename): + versionFilename = GetBuildPath('#dependencies/version') versionMismatch = False if not os.path.exists(versionFilename): From 2e5fdcf67d39d5a9ec1e0ca8544008facdb8f78c Mon Sep 17 00:00:00 2001 From: Merlin Nimier-David Date: Tue, 24 Jul 2018 18:11:29 +0200 Subject: [PATCH 2/4] SCons: Python 3 compatibility --- build/SConscript.configure | 117 +++++++++++++++++++------------------ build/SConscript.install | 3 +- 2 files changed, 61 insertions(+), 59 deletions(-) diff --git a/build/SConscript.configure b/build/SConscript.configure index 9370daa99..77dc96213 100644 --- a/build/SConscript.configure +++ b/build/SConscript.configure @@ -1,3 +1,4 @@ +from __future__ import print_function import re, multiprocessing Import('sys', 'os', 'SCons', 'resources') @@ -20,14 +21,14 @@ if parallelize == True: SetOption('num_jobs', multiprocessing.cpu_count()) if not os.path.exists(configFile): - print '\nA configuration file must be selected! Have a look at http://www.mitsuba-renderer.org/docs.html' + print('\nA configuration file must be selected! Have a look at http://www.mitsuba-renderer.org/docs.html') Exit(1) needsBuildDependencies = (sys.platform == 'win32' or sys.platform == 'darwin') if needsBuildDependencies and not os.path.exists(GetBuildPath('#dependencies')): - print '\nThe required build dependency files are missing. Please see the documentation' - print 'at http://www.mitsuba-renderer.org/docs.html for details on how to get them.\n' + print('\nThe required build dependency files are missing. Please see the documentation') + print('at http://www.mitsuba-renderer.org/docs.html for details on how to get them.\n') Exit(1) python_versions = ["2.6", "2.7", "3.0", "3.1", "3.2", "3.3", "3.4", "3.5", "3.6", "3.7"] @@ -94,11 +95,11 @@ vars.Add('INTEL_COMPILER', 'Should the Intel C++ compiler be used?') try: env = Environment(options=vars, ENV = os.environ, tools=['default', 'qt5'], toolpath=['#data/scons']) - print 'Checking for Qt 5.x... yes' + print('Checking for Qt 5.x... yes') hasQt = True except Exception: env = Environment(options=vars, ENV = os.environ, tools=['default'], toolpath=['#data/scons']) - print 'Unable to detect a Qt installation -- not building the GUI!' + print('Unable to detect a Qt installation -- not building the GUI!') hasQt = False hasCollada=True @@ -108,19 +109,19 @@ env.Append(CPPPATH=env['BASEINCLUDE']) env.Append(CPPFLAGS=[]) env.Append(LIBPATH=[]) env.Append(LIBS=env['BASELIB']) -if env.has_key('BOOSTINCLUDE'): +if 'BOOSTINCLUDE' in env: env.Prepend(CPPPATH=env['BOOSTINCLUDE']) -if env.has_key('BOOSTLIBDIR'): +if 'BOOSTLIBDIR' in env: env.Prepend(LIBPATH=env['BOOSTLIBDIR']) -if env.has_key('BOOSTLIB'): +if 'BOOSTLIB' in env: env.Prepend(LIBS=env['BOOSTLIB']) -if env.has_key('BASELIBDIR'): +if 'BASELIBDIR' in env: env.Append(LIBPATH=env['BASELIBDIR']) -if env.has_key('OEXRINCLUDE'): +if 'OEXRINCLUDE' in env: env.Prepend(CPPPATH=env['OEXRINCLUDE']) -if env.has_key('OEXRLIBDIR'): +if 'OEXRLIBDIR' in env: env.Prepend(LIBPATH=env['OEXRLIBDIR']) -if env.has_key('EIGENINCLUDE'): +if 'EIGENINCLUDE' in env: env.Prepend(CPPPATH=env['EIGENINCLUDE']) env.Decider('MD5-timestamp') @@ -140,64 +141,64 @@ libPathPrevious = SCons.Util.semi_deepcopy(env['LIBPATH']) cppFlagsPrevious = SCons.Util.semi_deepcopy(env['CPPFLAGS']) cxxFlagsPrevious = SCons.Util.semi_deepcopy(env['CXXFLAGS']) -if env.has_key('PNGINCLUDE'): +if 'PNGINCLUDE' in env: env.Prepend(CPPPATH=env['PNGINCLUDE']) -if env.has_key('PNGLIBDIR'): +if 'PNGLIBDIR' in env: env.Prepend(LIBPATH=env['PNGLIBDIR']) -if env.has_key('JPEGINCLUDE'): +if 'JPEGINCLUDE' in env: env.Prepend(CPPPATH=env['JPEGINCLUDE']) -if env.has_key('JPEGLIBDIR'): +if 'JPEGLIBDIR' in env: env.Prepend(LIBPATH=env['JPEGLIBDIR']) -if env.has_key('OEXRFLAGS'): +if 'OEXRFLAGS' in env: env.Prepend(CPPFLAGS=env['OEXRFLAGS']) -if env.has_key('OEXRINCLUDE'): +if 'OEXRINCLUDE' in env: env.Prepend(CPPPATH=env['OEXRINCLUDE']) -if env.has_key('OEXRLIBDIR'): +if 'OEXRLIBDIR' in env: env.Prepend(LIBPATH=env['OEXRLIBDIR']) -if env.has_key('XERCESINCLUDE'): +if 'XERCESINCLUDE' in env: env.Prepend(CPPPATH=env['XERCESINCLUDE']) -if env.has_key('XERCESLIBDIR'): +if 'XERCESLIBDIR' in env: env.Prepend(LIBPATH=env['XERCESLIBDIR']) -if env.has_key('GLINCLUDE'): +if 'GLINCLUDE' in env: env.Prepend(CPPPATH=env['GLINCLUDE']) -if env.has_key('GLFLAGS'): +if 'GLFLAGS' in env: env.Prepend(CPPFLAGS=env['GLFLAGS']) -if env.has_key('COLLADAINCLUDE'): +if 'COLLADAINCLUDE' in env: env.Prepend(CPPPATH=env['COLLADAINCLUDE']) -if env.has_key('COLLADALIBDIR'): +if 'COLLADALIBDIR' in env: env.Prepend(LIBPATH=env['COLLADALIBDIR']) -if env.has_key('FFTWINCLUDE'): +if 'FFTWINCLUDE' in env: env.Prepend(CPPPATH=env['FFTWINCLUDE']) -if env.has_key('FFTWLIBDIR'): +if 'FFTWLIBDIR' in env: env.Prepend(LIBPATH=env['FFTWLIBDIR']) if not conf.CheckCXX(): - print 'Could not compile a simple C++ fragment, verify that ' + \ + print('Could not compile a simple C++ fragment, verify that ' + \ env['CXX'] + ' is installed! This could also mean that the ' + \ 'Boost libraries are missing. The file "config.log" should ' + \ - 'contain more information.' + 'contain more information.') Exit(1) if not conf.CheckCHeader(['png.h']): - print 'libpng is missing (install libpng12-dev for PNG I/O support)' + print('libpng is missing (install libpng12-dev for PNG I/O support)') else: env.Append(CPPDEFINES = [['MTS_HAS_LIBPNG', 1]] ) if not conf.CheckCHeader(['stdio.h', 'jpeglib.h']): - print 'libjpeg is missing (install libjpeg62-dev for JPEG I/O support)' + print('libjpeg is missing (install libjpeg62-dev for JPEG I/O support)') else: env.Append(CPPDEFINES = [['MTS_HAS_LIBJPEG', 1]] ) if not conf.CheckCXXHeader('ImfRgba.h'): - print 'OpenEXR is missing (install libopenexr-dev for OpenEXR I/O support)' + print('OpenEXR is missing (install libopenexr-dev for OpenEXR I/O support)') else: env.Append(CPPDEFINES = [['MTS_HAS_OPENEXR', 1]] ) if not conf.CheckCXXHeader('xercesc/dom/DOMLSParser.hpp'): - print 'Xerces-C++ 3.x must be installed (install libxerces-c-dev)!' + print('Xerces-C++ 3.x must be installed (install libxerces-c-dev)!') Exit(1) if not conf.CheckCXXHeader('dae.h'): hasCollada = False - print 'COLLADA DOM is missing: not building the COLLADA importer' + print('COLLADA DOM is missing: not building the COLLADA importer') hasBreakpad = '-DMTS_HAS_BREAKPAD' in env['CCFLAGS'] or 'MTS_HAS_BREAKPAD' in env['CXXFLAGS'] @@ -211,54 +212,54 @@ for ver in python_versions: if conf.CheckCXXHeader('pyconfig.h'): hasPython += [ ver ] else: - print 'Python ' + ver + ' is missing: not building wrappers' + print('Python ' + ver + ' is missing: not building wrappers') env['CPPPATH'][:] = [ x for x in env['CPPPATH'] if x not in includePath ] if not conf.CheckCXXHeader('boost/version.hpp'): - print 'Boost is missing (install libboost-all-dev)!' + print('Boost is missing (install libboost-all-dev)!') Exit(1) if not conf.TryCompile("#include \n#if BOOST_VERSION < 104400\n#error Boost is outdated!\n#endif", ".cpp"): - print 'Boost is outdated (you will need version 1.44 or newer)!' + print('Boost is outdated (you will need version 1.44 or newer)!') Exit(1) if not conf.CheckCXXHeader('Eigen/Core'): - print 'Eigen 3.x is missing (install libeigen3-dev)!' + print('Eigen 3.x is missing (install libeigen3-dev)!') Exit(1) if not conf.CheckCXXHeader('fftw3.h'): - print 'FFTW3 not found (install for fast image convolution support)' + print('FFTW3 not found (install for fast image convolution support)') else: env.Append(CPPDEFINES = [['MTS_HAS_FFTW', 1]] ) if sys.platform == 'win32': if not (conf.CheckCHeader(['windows.h', 'GL/gl.h']) \ and conf.CheckCHeader(['windows.h', 'GL/glu.h']) \ and conf.CheckCHeader(['windows.h', 'GL/gl.h', 'GL/glext.h'])): - print 'OpenGL headers are missing!' + print('OpenGL headers are missing!') Exit(1) if not conf.CheckCHeader('GL/glew.h'): - print 'GLEW headers are missing!' + print('GLEW headers are missing!') Exit(1) elif sys.platform == 'linux2': if not (conf.CheckCHeader('GL/gl.h') and conf.CheckCHeader('GL/glu.h') and conf.CheckCHeader(['GL/gl.h', 'GL/glext.h'])): - print 'OpenGL headers are missing!' + print('OpenGL headers are missing!') Exit(1) if not conf.CheckCHeader('GL/glew.h'): - print 'GLEW headers are missing (install libglewmx1.5-dev)!' + print('GLEW headers are missing (install libglewmx1.5-dev)!') Exit(1) if not conf.CheckType('GLEWContext', '#include '): - print 'GLEW-MX must be present!' + print('GLEW-MX must be present!') Exit(1) if not conf.TryCompile("#include \n int i = GL_VERTEX_ATTRIB_ARRAY_UNIFIED_NV;", '.cpp'): - print 'Your version of GLEW-MX seems to be outdated!' + print('Your version of GLEW-MX seems to be outdated!') Exit(1) elif sys.platform == 'darwin': if not (conf.CheckCHeader('OpenGL/gl.h') and conf.CheckCHeader('OpenGL/glu.h') and conf.CheckCHeader(['OpenGL/gl.h', 'OpenGL/glext.h'])): - print 'OpenGL headers are missing!' + print('OpenGL headers are missing!') Exit(1) if not conf.CheckCHeader('OpenGL/glew.h'): - print 'GLEW headers are missing!' + print('GLEW headers are missing!') Exit(1) if sys.platform == 'linux2': if not (conf.CheckCHeader(['X11/Xlib.h', 'X11/extensions/xf86vmode.h'])): - print 'X Video Mode selection library headers are missing! (Install libxxf86vm-dev)' + print('X Video Mode selection library headers are missing! (Install libxxf86vm-dev)') Exit(1) env.Replace(CPPPATH=cppPathPrevious) @@ -273,10 +274,10 @@ for line in file: if line.startswith("#define MTS_VERSION "): MTS_VERSION = line[21:len(line)-2] if MTS_VERSION == "": - print 'could not be determined!' + print('could not be determined!') Exit(1) else: - print MTS_VERSION + print(MTS_VERSION) Export('MTS_VERSION') if needsBuildDependencies: @@ -295,14 +296,14 @@ if needsBuildDependencies: versionMismatch = True if versionMismatch: - print '\nThe dependency directory and your Mitsuba codebase have different version' - print 'numbers! Your copy of Mitsuba has version %s, whereas the dependencies ' % MTS_VERSION - print 'have version %s. Please bring them into sync, either by running\n' % depVersion - print '$ hg update -r v%s\n' % depVersion - print 'in the Mitsuba directory, or by running\n' - print '$ cd dependencies' - print '$ hg pull' - print '$ hg update -r v%s\n' % MTS_VERSION + print('\nThe dependency directory and your Mitsuba codebase have different version') + print('numbers! Your copy of Mitsuba has version %s, whereas the dependencies ' % MTS_VERSION) + print('have version %s. Please bring them into sync, either by running\n' % depVersion) + print('$ hg update -r v%s\n' % depVersion) + print('in the Mitsuba directory, or by running\n') + print('$ cd dependencies') + print('$ hg pull') + print('$ hg update -r v%s\n' % MTS_VERSION) Exit(1) env = conf.Finish() diff --git a/build/SConscript.install b/build/SConscript.install index 1db43c99f..45fd6a18e 100644 --- a/build/SConscript.install +++ b/build/SConscript.install @@ -1,3 +1,4 @@ +from __future__ import print_function import fnmatch Import('env', 'os', 'sys', 'plugins', 'dist', @@ -27,7 +28,7 @@ def installAs(target, path, prefix = None): return result if not 'DISTDIR' in env: - print 'The \"DISTDIR\" variable is missing. Please update your configuration file!' + print('The \"DISTDIR\" variable is missing. Please update your configuration file!') Exit(1) distDir = env.GetBuildPath(env['DISTDIR']) From b160b8e8e0c3ffd8b9a18057fb6ce750870475f5 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 24 Sep 2021 12:34:33 +0800 Subject: [PATCH 3/4] Python 3 compatibility for building qt --- data/scons/qt5.py | 24 +++++++++++++++--------- src/mtsgui/SConscript | 16 ++++++++-------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/data/scons/qt5.py b/data/scons/qt5.py index 4bddb8985..22e366844 100644 --- a/data/scons/qt5.py +++ b/data/scons/qt5.py @@ -135,23 +135,25 @@ def __call__(self, target, source, env): out_sources = source[:] for obj in source: - if isinstance(obj,basestring): # big kludge! - print "scons: qt5: '%s' MAYBE USING AN OLD SCONS VERSION AND NOT CONVERTED TO 'File'. Discarded." % str(obj) + if isinstance(obj,str): # big kludge! + print("scons: qt5: '%s' MAYBE USING AN OLD SCONS VERSION AND NOT CONVERTED TO 'File'. Discarded." % str(obj)) continue if not obj.has_builder(): # binary obj file provided if debug: - print "scons: qt: '%s' seems to be a binary. Discarded." % str(obj) + print("scons: qt: '%s' seems to be a binary. Discarded." % str(obj)) continue cpp = obj.sources[0] if not splitext(str(cpp))[1] in cxx_suffixes: if debug: - print "scons: qt: '%s' is no cxx file. Discarded." % str(cpp) + print("scons: qt: '%s' is no cxx file. Discarded." % str(cpp)) # c or fortran source continue #cpp_contents = comment.sub('', cpp.get_contents()) try: cpp_contents = cpp.get_contents() + if not isinstance(cpp_contents, str): + cpp_contents = str(cpp_contents) except: continue # may be an still not generated source h=None for h_ext in header_extensions: @@ -161,12 +163,14 @@ def __call__(self, target, source, env): h = find_file(hname, (cpp.get_dir(),), env.File) if h: if debug: - print "scons: qt: Scanning '%s' (header of '%s')" % (str(h), str(cpp)) + print("scons: qt: Scanning '%s' (header of '%s')" % (str(h), str(cpp))) #h_contents = comment.sub('', h.get_contents()) h_contents = h.get_contents() + if not isinstance(h_contents, str): + h_contents = str(h_contents) break if not h and debug: - print "scons: qt: no header for '%s'." % (str(cpp)) + print("scons: qt: no header for '%s'." % (str(cpp))) if h and q_object_search.search(h_contents): # h file with the Q_OBJECT macro found -> add moc_cpp moc_cpp = env.Moc5(h) @@ -174,14 +178,14 @@ def __call__(self, target, source, env): out_sources.append(moc_o) #moc_cpp.target_scanner = SCons.Defaults.CScan if debug: - print "scons: qt: found Q_OBJECT macro in '%s', moc'ing to '%s'" % (str(h), str(moc_cpp)) + print("scons: qt: found Q_OBJECT macro in '%s', moc'ing to '%s'" % (str(h), str(moc_cpp))) if cpp and q_object_search.search(cpp_contents): # cpp file with Q_OBJECT macro found -> add moc # (to be included in cpp) moc = env.Moc5(cpp) env.Ignore(moc, moc) if debug: - print "scons: qt: found Q_OBJECT macro in '%s', moc'ing to '%s'" % (str(cpp), str(moc)) + print("scons: qt: found Q_OBJECT macro in '%s', moc'ing to '%s'" % (str(cpp), str(moc))) #moc.source_scanner = SCons.Defaults.CScan # restore the original env attributes (FIXME) objBuilder.env = objBuilderEnv @@ -303,6 +307,8 @@ def recursiveFiles(basepath, path) : result.append(itemPath) return result contents = node.get_contents() + if not isinstance(contents, str): + contents = str(contents) includes = qrcinclude_re.findall(contents) qrcpath = os.path.dirname(node.path) dirs = [included for included in includes if os.path.isdir(os.path.join(qrcpath,included))] @@ -475,4 +481,4 @@ def enable_modules(self, modules, debug=False, crosscompiling=False) : return def exists(env): - return _detect(env) + return _detect(env) \ No newline at end of file diff --git a/src/mtsgui/SConscript b/src/mtsgui/SConscript index 0cc822265..346e7caa0 100644 --- a/src/mtsgui/SConscript +++ b/src/mtsgui/SConscript @@ -3,10 +3,10 @@ Import('env', 'os', 'glob', 'sys', 'hasQt', 'hasCollada', 'hasBreakpad', 'mainEn # For running Uic & Moc (below) def recursiveDirs(root) : - return filter((lambda a : a.rfind(".svn") == -1), [a[0] for a in os.walk(root)]) + return list(filter((lambda a : a.rfind(".svn") == -1), [a[0] for a in os.walk(root)])) -def unique(list) : - return dict.fromkeys(list).keys() +def unique(l) : + return list(dict.fromkeys(l).keys()) def scanFiles(dir, accept=["*.cpp"], reject=[]) : sources = [] @@ -15,15 +15,15 @@ def scanFiles(dir, accept=["*.cpp"], reject=[]) : for pattern in accept : sources+=glob.glob(path + "/" + pattern) for pattern in reject: - sources = filter((lambda a : a.rfind(pattern) == -1), sources) - sources = map((lambda a : os.path.basename(a)), sources) + sources = list(filter((lambda a : a.rfind(pattern) == -1), sources)) + sources = list(map((lambda a : os.path.basename(a)), sources)) return unique(sources) if hasQt: qtEnv = mainEnv.Clone() qtEnv.Append(CPPPATH=['#src/mtsgui']) - if qtEnv.has_key('QTINCLUDE'): + if 'QTINCLUDE' in qtEnv: qtEnv.Prepend(CPPPATH=qtEnv['QTINCLUDE']) qtEnv.EnableQt5Modules(['QtGui', 'QtWidgets', 'QtCore', 'QtOpenGL', 'QtXml', 'QtXmlPatterns', 'QtNetwork']) @@ -51,9 +51,9 @@ if hasQt: if hasCollada: qtSources += converter_objects - if env.has_key('COLLADALIBDIR'): + if 'COLLADALIBDIR' in env: qtEnv.Prepend(LIBPATH=env['COLLADALIBDIR']) - if env.has_key('COLLADALIB'): + if 'COLLADALIB' in env: qtEnv.Prepend(LIBS=env['COLLADALIB']) if sys.platform == 'darwin': From 3f1168e84146f9881e30f25e00cd779f293fd62d Mon Sep 17 00:00:00 2001 From: Merlin Nimier-David Date: Mon, 2 May 2022 10:32:34 +0200 Subject: [PATCH 4/4] SCons: replace usage of `has_key` Tested with SCons 4.3.0. --- src/converter/SConscript | 6 +++--- src/films/SConscript | 8 ++++---- src/libcore/SConscript | 26 +++++++++++++------------- src/libhw/SConscript | 8 ++++---- src/libpython/SConscript | 12 ++++++------ src/librender/SConscript | 6 +++--- src/mitsuba/SConscript | 14 +++++++------- 7 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/converter/SConscript b/src/converter/SConscript index 8c2838729..3a8b19e7d 100644 --- a/src/converter/SConscript +++ b/src/converter/SConscript @@ -12,11 +12,11 @@ if hasCollada: # Build the COLLADA importer if COLLADA-DOM is vailable colladaEnv.Append(LIBS=['mitsuba-hw']) colladaEnv.Append(LIBPATH=['#src/libhw']) - if colladaEnv.has_key('COLLADAINCLUDE'): + if 'COLLADAINCLUDE' in colladaEnv: colladaEnv.Prepend(CPPPATH=colladaEnv['COLLADAINCLUDE']) - if colladaEnv.has_key('COLLADALIBDIR'): + if 'COLLADALIBDIR' in colladaEnv: colladaEnv.Prepend(LIBPATH=colladaEnv['COLLADALIBDIR']) - if colladaEnv.has_key('COLLADALIB'): + if 'COLLADALIB' in colladaEnv: colladaEnv.Prepend(LIBS=colladaEnv['COLLADALIB']) converter_objects += [ colladaEnv.StaticObject('collada.cpp'), diff --git a/src/films/SConscript b/src/films/SConscript index d3f2ebd07..83d174563 100644 --- a/src/films/SConscript +++ b/src/films/SConscript @@ -1,13 +1,13 @@ Import('env', 'plugins') filmEnv = env.Clone() -if filmEnv.has_key('OEXRLIBDIR'): +if 'OEXRLIBDIR' in filmEnv: filmEnv.Prepend(LIBPATH=env['OEXRLIBDIR']) -if filmEnv.has_key('OEXRINCLUDE'): +if 'OEXRINCLUDE' in filmEnv: filmEnv.Prepend(CPPPATH=env['OEXRINCLUDE']) -if filmEnv.has_key('OEXRFLAGS'): +if 'OEXRFLAGS' in filmEnv: filmEnv.Prepend(CPPFLAGS=env['OEXRFLAGS']) -if filmEnv.has_key('OEXRLIB'): +if 'OEXRLIB' in filmEnv: filmEnv.Prepend(LIBS=env['OEXRLIB']) plugins += filmEnv.SharedLibrary('mfilm', ['mfilm.cpp', 'cnpy.cpp']) diff --git a/src/libcore/SConscript b/src/libcore/SConscript index 6a31fe639..b3a5640d5 100644 --- a/src/libcore/SConscript +++ b/src/libcore/SConscript @@ -2,31 +2,31 @@ Import('env', 'sys', 'os') # Core library environment with OpenEXR, libpng and libjpeg coreEnv = env.Clone() -if coreEnv.has_key('OEXRLIBDIR'): +if 'OEXRLIBDIR' in coreEnv: coreEnv.Prepend(LIBPATH=env['OEXRLIBDIR']) -if coreEnv.has_key('OEXRINCLUDE'): +if 'OEXRINCLUDE' in coreEnv: coreEnv.Prepend(CPPPATH=env['OEXRINCLUDE']) -if coreEnv.has_key('OEXRFLAGS'): +if 'OEXRFLAGS' in coreEnv: coreEnv.Prepend(CPPFLAGS=env['OEXRFLAGS']) -if coreEnv.has_key('OEXRLIB'): +if 'OEXRLIB' in coreEnv: coreEnv.Prepend(LIBS=env['OEXRLIB']) -if coreEnv.has_key('PNGLIBDIR'): +if 'PNGLIBDIR' in coreEnv: coreEnv.Prepend(LIBPATH=env['PNGLIBDIR']) -if coreEnv.has_key('PNGINCLUDE'): +if 'PNGINCLUDE' in coreEnv: coreEnv.Prepend(CPPPATH=env['PNGINCLUDE']) -if coreEnv.has_key('PNGLIB'): +if 'PNGLIB' in coreEnv: coreEnv.Prepend(LIBS=env['PNGLIB']) -if coreEnv.has_key('JPEGLIBDIR'): +if 'JPEGLIBDIR' in coreEnv: coreEnv.Prepend(LIBPATH=env['JPEGLIBDIR']) -if coreEnv.has_key('JPEGINCLUDE'): +if 'JPEGINCLUDE' in coreEnv: coreEnv.Prepend(CPPPATH=env['JPEGINCLUDE']) -if coreEnv.has_key('JPEGLIB'): +if 'JPEGLIB' in coreEnv: coreEnv.Prepend(LIBS=env['JPEGLIB']) -if coreEnv.has_key('FFTWLIBDIR'): +if 'FFTWLIBDIR' in coreEnv: coreEnv.Prepend(LIBPATH=env['FFTWLIBDIR']) -if coreEnv.has_key('FFTWINCLUDE'): +if 'FFTWINCLUDE' in coreEnv: coreEnv.Prepend(CPPPATH=env['FFTWINCLUDE']) -if coreEnv.has_key('FFTWLIB'): +if 'FFTWLIB' in coreEnv: coreEnv.Prepend(LIBS=env['FFTWLIB']) coreEnv.Prepend(CPPDEFINES = [['MTS_BUILD_MODULE', 'MTS_MODULE_CORE']]) diff --git a/src/libhw/SConscript b/src/libhw/SConscript index bb4c30142..e789c63d9 100644 --- a/src/libhw/SConscript +++ b/src/libhw/SConscript @@ -18,13 +18,13 @@ elif 'linux' in sys.platform: glEnv = env.Clone() glEnv.Append(CPPDEFINES = [['MTS_BUILD_MODULE', 'MTS_MODULE_HW']] ) -if glEnv.has_key('GLLIB'): +if 'GLLIB' in glEnv: glEnv.Prepend(LIBS=glEnv['GLLIB']) -if glEnv.has_key('GLLIBDIR'): +if 'GLLIBDIR' in glEnv: glEnv.Prepend(LIBPATH=glEnv['GLLIBDIR']) -if glEnv.has_key('GLFLAGS'): +if 'GLFLAGS' in glEnv: glEnv.Prepend(CPPFLAGS=glEnv['GLFLAGS']) -if glEnv.has_key('GLINCLUDE'): +if 'GLINCLUDE' in glEnv: glEnv.Prepend(CPPPATH=glEnv['GLINCLUDE']) if sys.platform == 'darwin': diff --git a/src/libpython/SConscript b/src/libpython/SConscript index 58146e27b..0bd6bcd57 100644 --- a/src/libpython/SConscript +++ b/src/libpython/SConscript @@ -2,9 +2,9 @@ Import('env', 'sys', 'os', 'hasPython') for ver in hasPython: sver = ver.replace('.', '') - python_include = list(env['PYTHON'+sver+'INCLUDE']) if env.has_key('PYTHON'+sver+'INCLUDE') else [] - python_libdir = list(env['PYTHON'+sver+'LIBDIR']) if env.has_key('PYTHON'+sver+'LIBDIR') else [] - python_lib = list(env['PYTHON'+sver+'LIB']) if env.has_key('PYTHON'+sver+'LIB') else [] + python_include = list(env['PYTHON'+sver+'INCLUDE']) if ('PYTHON'+sver+'INCLUDE') in env else [] + python_libdir = list(env['PYTHON'+sver+'LIBDIR']) if ('PYTHON'+sver+'LIBDIR') in env else [] + python_lib = list(env['PYTHON'+sver+'LIB']) if ('PYTHON'+sver+'LIB') in env else [] if 'linux' in sys.platform: # On Linux, don't link to the core Python library. The associated symbols will be resolved @@ -23,11 +23,11 @@ for ver in hasPython: pythonEnv.Append(LIBS=['mitsuba-bidir']) pythonEnv.Append(LIBPATH=['#src/libbidir']) - if pythonEnv.has_key('XERCESINCLUDE'): + if 'XERCESINCLUDE' in pythonEnv: pythonEnv.Prepend(CPPPATH=pythonEnv['XERCESINCLUDE']) - if pythonEnv.has_key('XERCESLIBDIR'): + if 'XERCESLIBDIR' in pythonEnv: pythonEnv.Prepend(LIBPATH=pythonEnv['XERCESLIBDIR']) - if pythonEnv.has_key('XERCESLIB'): + if 'XERCESLIB' in pythonEnv: pythonEnv.Prepend(LIBS=pythonEnv['XERCESLIB']) if sys.platform != 'win32': diff --git a/src/librender/SConscript b/src/librender/SConscript index d074e07d5..af73306cf 100644 --- a/src/librender/SConscript +++ b/src/librender/SConscript @@ -2,11 +2,11 @@ Import('env', 'sys', 'os') renderEnv = env.Clone() renderEnv.Append(CPPDEFINES = [['MTS_BUILD_MODULE', 'MTS_MODULE_RENDER']] ) -if renderEnv.has_key('XERCESINCLUDE'): +if 'XERCESINCLUDE' in renderEnv: renderEnv.Prepend(CPPPATH=renderEnv['XERCESINCLUDE']) -if renderEnv.has_key('XERCESLIBDIR'): +if 'XERCESLIBDIR' in renderEnv: renderEnv.Prepend(LIBPATH=renderEnv['XERCESLIBDIR']) -if renderEnv.has_key('XERCESLIB'): +if 'XERCESLIB' in renderEnv: renderEnv.Prepend(LIBS=renderEnv['XERCESLIB']) librender = renderEnv.SharedLibrary('mitsuba-render', [ diff --git a/src/mitsuba/SConscript b/src/mitsuba/SConscript index adae16b87..583ad6a45 100644 --- a/src/mitsuba/SConscript +++ b/src/mitsuba/SConscript @@ -2,19 +2,19 @@ Import('sys', 'env', 'hasCollada', 'stubs', 'winstubs') # Create an environment with Xerces and OpenGL mainEnv = env.Clone() -if mainEnv.has_key('XERCESINCLUDE'): +if 'XERCESINCLUDE' in mainEnv: mainEnv.Prepend(CPPPATH=mainEnv['XERCESINCLUDE']) -if mainEnv.has_key('XERCESLIBDIR'): +if 'XERCESLIBDIR' in mainEnv: mainEnv.Prepend(LIBPATH=mainEnv['XERCESLIBDIR']) -if mainEnv.has_key('XERCESLIB'): +if 'XERCESLIB' in mainEnv: mainEnv.Prepend(LIBS=mainEnv['XERCESLIB']) -if mainEnv.has_key('GLLIB'): +if 'GLLIB' in mainEnv: mainEnv.Prepend(LIBS=mainEnv['GLLIB']) -if mainEnv.has_key('GLLIBDIR'): +if 'GLLIBDIR' in mainEnv: mainEnv.Prepend(LIBPATH=mainEnv['GLLIBDIR']) -if mainEnv.has_key('GLFLAGS'): +if 'GLFLAGS' in mainEnv: mainEnv.Prepend(CXXFLAGS=mainEnv['GLFLAGS']) -if mainEnv.has_key('GLINCLUDE'): +if 'GLINCLUDE' in mainEnv: mainEnv.Prepend(CPPPATH=mainEnv['GLINCLUDE']) if sys.platform == 'darwin':