Skip to content

Commit 730c31d

Browse files
basePythonEnv
1 parent f6371a8 commit 730c31d

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

SConstruct

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,46 +1167,47 @@ def pythonVersion( pythonEnv ) :
11671167
universal_newlines = True
11681168
).strip()
11691169

1170-
pythonEnv = env.Clone()
1170+
basePythonEnv = env.Clone()
11711171

11721172
# decide where python is
1173-
if pythonEnv["PYTHON"]=="" :
1173+
if basePythonEnv["PYTHON"]=="" :
11741174
if env["PLATFORM"] == "win32" :
11751175
sys.stderr.write( "ERROR : Python executable path must be set with PYTHON option.\n" )
11761176
Exit( 1 )
11771177
else:
1178-
pythonEnv["PYTHON"] = getPythonConfig( pythonEnv, "--exec-prefix" ) + "/bin/python"
1178+
basePythonEnv["PYTHON"] = getPythonConfig( basePythonEnv, "--exec-prefix" ) + "/bin/python"
11791179

11801180
# run it to determine version
1181-
pythonEnv["PYTHON_VERSION"] = pythonVersion( pythonEnv )
1181+
basePythonEnv["PYTHON_VERSION"] = pythonVersion( basePythonEnv )
11821182

11831183
# get the include path for python if we haven't been told it explicitly
11841184
# Windows does not have python-config so rely the user setting the appropriate options
11851185
if env["PLATFORM"] != "win32" :
1186-
if pythonEnv["PYTHON_INCLUDE_PATH"]=="" :
1187-
pythonEnv["PYTHON_INCLUDE_FLAGS"] = getPythonConfig( pythonEnv, "--includes" ).split()
1186+
if basePythonEnv["PYTHON_INCLUDE_PATH"]=="" :
1187+
basePythonEnv["PYTHON_INCLUDE_FLAGS"] = getPythonConfig( basePythonEnv, "--includes" ).split()
11881188
else :
1189-
pythonEnv["PYTHON_INCLUDE_FLAGS"] = [ systemIncludeArgument, "$PYTHON_INCLUDE_PATH" ]
1189+
basePythonEnv["PYTHON_INCLUDE_FLAGS"] = [ systemIncludeArgument, "$PYTHON_INCLUDE_PATH" ]
11901190

1191-
pythonEnv.Append( CXXFLAGS = "$PYTHON_INCLUDE_FLAGS" )
1191+
basePythonEnv.Append( CXXFLAGS = "$PYTHON_INCLUDE_FLAGS" )
11921192

11931193
if env["PLATFORM"] == "posix" :
11941194
## We really want to not have the -Wno-strict-aliasing flag, but it's necessary to stop boost
11951195
# python warnings that don't seem to be prevented by including boost via -isystem even. Better to
11961196
# be able to have -Werror but be missing one warning than to have no -Werror.
11971197
## \todo This is probably only necessary for specific gcc versions where -isystem doesn't
11981198
# fully work. Reenable when we encounter versions that work correctly.
1199-
pythonEnv.Append( CXXFLAGS = [ "-Wno-strict-aliasing" ] )
1199+
basePythonEnv.Append( CXXFLAGS = [ "-Wno-strict-aliasing" ] )
12001200

12011201
# get the python link flags
1202-
if pythonEnv["PYTHON_LINK_FLAGS"]=="" :
1203-
pythonEnv["PYTHON_LINK_FLAGS"] = getPythonConfig( pythonEnv, "--ldflags" )
1204-
pythonEnv["PYTHON_LINK_FLAGS"] = pythonEnv["PYTHON_LINK_FLAGS"].replace( "Python.framework/Versions/" + pythonEnv["PYTHON_VERSION"] + "/Python", "" )
1202+
if basePythonEnv["PYTHON_LINK_FLAGS"]=="" :
1203+
basePythonEnv["PYTHON_LINK_FLAGS"] = getPythonConfig( basePythonEnv, "--ldflags" )
1204+
basePythonEnv["PYTHON_LINK_FLAGS"] = basePythonEnv["PYTHON_LINK_FLAGS"].replace( "Python.framework/Versions/" + basePythonEnv["PYTHON_VERSION"] + "/Python", "" )
12051205

1206-
pythonEnv.Append( SHLINKFLAGS = pythonEnv["PYTHON_LINK_FLAGS"].split() )
1206+
basePythonEnv.Append( SHLINKFLAGS = basePythonEnv["PYTHON_LINK_FLAGS"].split() )
12071207
else :
1208-
pythonEnv["PYTHON_INCLUDE_FLAGS"] = ""
1208+
basePythonEnv["PYTHON_INCLUDE_FLAGS"] = ""
12091209

1210+
pythonEnv = basePythonEnv.Clone()
12101211
pythonEnv.Append( CPPFLAGS = "-DBOOST_PYTHON_MAX_ARITY=20" )
12111212

12121213
# if BOOST_PYTHON_LIB_SUFFIX is provided, use it
@@ -2066,7 +2067,9 @@ usdEnvSets = {
20662067
"IECORE_NAME" : "IECoreUSD"
20672068
}
20682069

2069-
usdEnv = env.Clone( **usdEnvSets )
2070+
# We are deliberately cloning from `basePythonEnv` rather than
2071+
# `env` because USD itself has dependencies on Python.
2072+
usdEnv = basePythonEnv.Clone( **usdEnvSets )
20702073

20712074
if usdEnv["WITH_USD_MONOLITHIC"] :
20722075
usdLibs = [ "usd_ms" ]
@@ -2116,7 +2119,6 @@ usdEnvAppends = {
21162119
"CPPPATH" : [
21172120
"contrib/IECoreUSD/include",
21182121
"contrib/IECoreUSD/src",
2119-
"$PYTHON_INCLUDE_PATH",
21202122
],
21212123
"LIBPATH" : [
21222124
"$USD_LIB_PATH"

0 commit comments

Comments
 (0)