Use == instead of is operator for checking string equality in AMBuild scripts (bug 6043, r=dvander).

This commit is contained in:
Scott Ehlert 2014-02-09 22:50:20 -06:00
parent 8476832dc2
commit e00e879af5
16 changed files with 47 additions and 49 deletions

View File

@ -124,7 +124,7 @@ class SMConfig(object):
cfg = builder.DetectCompilers()
cxx = cfg.cxx
if cxx.behavior is 'gcc':
if cxx.behavior == 'gcc':
cfg.defines += [
'stricmp=strcasecmp',
'_stricmp=strcasecmp',
@ -145,8 +145,8 @@ class SMConfig(object):
'-m32',
]
have_gcc = cxx.name is 'gcc'
have_clang = cxx.name is 'clang'
have_gcc = cxx.name == 'gcc'
have_clang = cxx.name == 'clang'
if have_clang or (have_gcc and cxx.majorVersion >= 4):
cfg.cflags += ['-fvisibility=hidden']
cfg.cxxflags += ['-fvisibility-inlines-hidden']
@ -364,21 +364,21 @@ class SMConfig(object):
def HL2Library(self, context, name, sdk):
compiler = self.HL2Compiler(context, sdk)
if builder.target_platform is 'linux':
if sdk.name is 'ep1':
if builder.target_platform == 'linux':
if sdk.name == 'ep1':
lib_folder = os.path.join(sdk.path, 'linux_sdk')
elif sdk.name is '2013':
elif sdk.name == '2013':
lib_folder = os.path.join(sdk.path, 'lib', 'public', 'linux32')
else:
lib_folder = os.path.join(sdk.path, 'lib', 'linux')
elif builder.target_platform == 'mac':
if sdk.name is '2013':
if sdk.name == '2013':
lib_folder = os.path.join(sdk.path, 'lib', 'public', 'osx32')
else:
lib_folder = os.path.join(sdk.path, 'lib', 'mac')
if builder.target_platform in ['linux', 'mac']:
if sdk.name is '2013':
if sdk.name == '2013':
compiler.postlink += [
compiler.Dep(os.path.join(lib_folder, 'tier1.a')),
compiler.Dep(os.path.join(lib_folder, 'mathlib.a'))

View File

@ -8,16 +8,16 @@ for sdk_name in SM.sdks:
binary = SM.HL2Library(builder, binary_name, sdk)
compiler = binary.compiler
if sdk.name is 'csgo':
if sdk.name == 'csgo':
# Protobuf 2.3 headers have some signed/unsigned compares. I believe that it's fixed in later versions, but Valve.
if compiler.cxx.behavior is 'gcc':
if compiler.cxx.behavior == 'gcc':
compiler.cflags += ['-Wno-sign-compare']
compiler.cxxincludes += [
os.path.join(sdk.path, 'common', 'protobuf-2.3.0', 'src'),
os.path.join(sdk.path, 'public', 'engine', 'protobuf'),
os.path.join(sdk.path, 'public', 'game', 'shared', 'csgo', 'protobuf')
]
elif sdk.name is 'dota':
elif sdk.name == 'dota':
compiler.cxxincludes += [
os.path.join(sdk.path, 'common', 'protobuf-2.4.1', 'src'),
os.path.join(sdk.path, 'public', 'engine', 'protobuf'),
@ -25,15 +25,15 @@ for sdk_name in SM.sdks:
os.path.join(sdk.path, 'public', 'game', 'shared', 'dota', 'protobuf')
]
if builder.target_platform is 'linux':
if builder.target_platform == 'linux':
compiler.postlink += ['-lpthread', '-lrt']
if sdk.name is 'csgo' or sdk.name is 'dota':
if builder.target_platform is 'linux':
if sdk.name == 'csgo' or sdk.name == 'dota':
if builder.target_platform == 'linux':
lib_path = os.path.join(sdk.path, 'lib', 'linux32', 'release', 'libprotobuf.a')
elif builder.target_platform is 'mac':
elif builder.target_platform == 'mac':
lib_path = os.path.join(sdk.path, 'lib', 'osx32', 'release', 'libprotobuf.a')
elif builder.target_platform is 'windows':
elif builder.target_platform == 'windows':
if 'DEBUG' in compiler.defines:
lib_path = os.path.join(sdk.path, 'lib', 'win32', 'debug', 'vs2010', 'libprotobuf.lib')
else:
@ -89,13 +89,13 @@ for sdk_name in SM.sdks:
else:
binary.sources += ['smn_bitbuffer.cpp']
if sdk.name is 'csgo':
if sdk.name == 'csgo':
binary.sources += [
os.path.join(sdk.path, 'public', 'engine', 'protobuf', 'netmessages.pb.cc'),
os.path.join(sdk.path, 'public', 'game', 'shared', 'csgo', 'protobuf', 'cstrike15_usermessages.pb.cc'),
os.path.join(sdk.path, 'public', 'game', 'shared', 'csgo', 'protobuf', 'cstrike15_usermessage_helpers.cpp'),
]
elif sdk.name is 'dota':
elif sdk.name == 'dota':
binary.sources += [
os.path.join(sdk.path, 'public', 'engine', 'protobuf', 'networkbasetypes.pb.cc'),
os.path.join(sdk.path, 'public', 'engine', 'protobuf', 'netmessages.pb.cc'),

View File

@ -14,9 +14,9 @@ binary.compiler.defines += [
'SM_LOGIC'
]
if builder.target_platform is 'linux':
if builder.target_platform == 'linux':
binary.compiler.postlink += ['-lpthread', '-lrt']
elif builder.target_platform is 'mac':
elif builder.target_platform == 'mac':
binary.compiler.cflags += ['-Wno-deprecated-declarations']
binary.compiler.postlink += ['-framework', 'CoreServices']
binary.sources += [
@ -64,7 +64,7 @@ binary.sources += [
'smn_database.cpp',
'ForwardSys.cpp',
]
if builder.target_platform is 'windows':
if builder.target_platform == 'windows':
binary.sources += ['thread/WinThreads.cpp']
else:
binary.sources += ['thread/PosixThreads.cpp']

View File

@ -9,9 +9,9 @@ binary.compiler.includes += [
]
binary.compiler.defines += ['CURL_STATICLIB']
binary.compiler.postlink += [libcurl.binary]
if builder.target_platform is 'linux':
if builder.target_platform == 'linux':
binary.compiler.postlink += ['-lrt']
elif builder.target_platform is 'windows':
elif builder.target_platform == 'windows':
binary.compiler.postlink += ['ws2_32.lib']
binary.sources += [

View File

@ -9,18 +9,18 @@ binary.compiler.includes += [
os.path.join(builder.sourcePath, 'extensions', 'curl', 'curl-src', 'include')
]
if builder.target_platform is 'mac':
if builder.target_platform == 'mac':
mac_version, ignore, ignore = platform.mac_ver()
mac_tuple = mac_version.split('.')
if int(mac_tuple[0]) >= 10 and int(mac_tuple[1]) >= 9:
binary.compiler.defines += ['BUILTIN_STRLCAT']
elif builder.target_platform is 'windows':
elif builder.target_platform == 'windows':
binary.compiler.defines += [
'BUILDING_LIBCURL',
'CURL_STATICLIB',
'CURL_DISABLE_LDAP',
]
elif builder.target_platform is 'linux':
elif builder.target_platform == 'linux':
binary.compiler.defines += ['_GNU_SOURCE']
binary.sources += [

View File

@ -2,7 +2,7 @@
import os
binary = SM.ExtLibrary(builder, 'geoip.ext')
if builder.target_platform is 'windows':
if builder.target_platform == 'windows':
binary.compiler.postlink += ['wsock32.lib']
binary.sources += [

View File

@ -8,14 +8,14 @@ if SM.mysql_root:
os.path.join(SM.mms_root, 'core', 'sourcehook')
]
if builder.target_platform is 'linux' or builder.target_platform is 'mac':
if builder.target_platform == 'linux' or builder.target_platform == 'mac':
binary.compiler.postlink += [
os.path.join(SM.mysql_root, 'lib', 'libmysqlclient_r.a'),
'-lz',
'-lpthread',
'-lm'
]
elif builder.target_platform is 'windows':
elif builder.target_platform == 'windows':
binary.compiler.postlink += [
os.path.join(SM.mysql_root, 'lib', 'opt', 'mysqlclient.lib'),
os.path.join(SM.mysql_root, 'lib', 'opt', 'zlib.lib'),

View File

@ -6,11 +6,11 @@ binary.compiler.cxxincludes += [
os.path.join(SM.mms_root, 'core', 'sourcehook'),
]
if builder.target_platform is 'linux':
if builder.target_platform == 'linux':
path = os.path.join(builder.sourcePath, 'extensions', 'regex', 'lib_linux', 'libpcre.a')
elif builder.target_platform is 'windows':
elif builder.target_platform == 'windows':
path = os.path.join(builder.sourcePath, 'extensions', 'regex', 'lib_win', 'pcre.lib')
elif builder.target_platform is 'mac':
elif builder.target_platform == 'mac':
path = os.path.join(builder.sourcePath, 'extensions', 'regex', 'lib_darwin', 'libpcre.a')
binary.compiler.postlink += [binary.Dep(path)]

View File

@ -8,7 +8,7 @@ for sdk_name in SM.sdks:
binary.compiler.cxxincludes += [
os.path.join(sdk.path, 'game', 'shared')
]
if binary.compiler.cxx.behavior is 'gcc':
if binary.compiler.cxx.behavior == 'gcc':
binary.compiler.cxxflags += ['-Wno-invalid-offsetof']
binary.sources += [

View File

@ -14,7 +14,7 @@ for sdk_name in SM.sdks:
if sdk.name != 'ep1':
binary.compiler.defines += ['HOOKING_ENABLED']
if binary.compiler.cxx.behavior is 'gcc':
if binary.compiler.cxx.behavior == 'gcc':
binary.compiler.cxxflags += ['-Wno-invalid-offsetof']
binary.sources += [

View File

@ -10,7 +10,7 @@ binary.compiler.defines += [
'SQLITE_OMIT_LOAD_EXTENSION',
'SQLITE_THREADSAFE'
]
if builder.target_platform is 'linux':
if builder.target_platform == 'linux':
binary.compiler.postlink += ['-ldl', '-lpthread']
binary.sources += [

View File

@ -4,7 +4,7 @@ import os.path
if builder.target_platform in ['windows', 'mac']:
name = 'sourcemod_mm'
extra_ldflags = []
elif builder.target_platform is 'linux':
elif builder.target_platform == 'linux':
name = 'sourcemod_mm_i486'
extra_ldflags = ['-ldl']

View File

@ -10,15 +10,15 @@ compiler.includes += [
os.path.join(builder.buildPath, 'includes'),
]
if compiler.cc.behavior is 'gcc':
if compiler.cc.behavior == 'gcc':
compiler.cflags += ['-Wno-format']
if builder.target_platform is 'linux':
if builder.target_platform == 'linux':
compiler.postlink += ['-lgcc', '-lm']
elif compiler.cc.behavior is 'msvc':
elif compiler.cc.behavior == 'msvc':
compiler.linkflags.remove('/SUBSYSTEM:WINDOWS')
compiler.linkflags.append('/SUBSYSTEM:CONSOLE')
if builder.target_platform is 'linux':
if builder.target_platform == 'linux':
compiler.defines += [
'LINUX',
'HAVE_STDINT_H',
@ -26,7 +26,7 @@ if builder.target_platform is 'linux':
'ENABLE_BINRELOC',
'_GNU_SOURCE'
]
elif builder.target_platform is 'mac':
elif builder.target_platform == 'mac':
compiler.defines += [
'DARWIN',
'HAVE_STDINT_H',
@ -69,7 +69,7 @@ binary.sources += [
'zlib/zutil.c',
'sp_symhash.c'
]
if builder.target_platform is 'linux':
if builder.target_platform == 'linux':
binary.sources.append('binreloc.c')
SM.spcomp = builder.Add(binary)

View File

@ -14,10 +14,8 @@ binary.compiler.includes += [
os.path.join(builder.sourcePath, 'knight', 'shared'),
]
if builder.target_platform is 'linux':
if builder.target_platform == 'linux':
binary.compiler.postlink += ['-lpthread', '-lrt']
elif builder.target_platform is 'darwin':
binary.compiler.postlink += ['-lpthread', '-ldl']
binary.sources += [
'BaseRuntime.cpp',

View File

@ -13,11 +13,11 @@ for cxx_task in cxx_tasks:
debug_entry = cxx_task.binary
debug_file = os.path.join(builder.buildPath, debug_entry.path)
if builder.target_platform is 'linux':
if builder.target_platform == 'linux':
argv = ['dump_syms', debug_file, os.path.dirname(debug_file)]
elif builder.target_platform is 'mac':
elif builder.target_platform == 'mac':
argv = ['dump_syms', debug_file]
elif builder.target_platform is 'windows':
elif builder.target_platform == 'windows':
argv = ['dump_syms.exe', debug_file]
base_file = os.path.splitext(os.path.basename(debug_file))[0]

View File

@ -52,7 +52,7 @@ for cxx_task in SM.extensions:
builder.AddCopy(SM.spcomp.binary, folder_map['addons/sourcemod/scripting'])
# Copy debugging files.
if builder.options.packdebug and builder.target_platform is not 'mac':
if builder.options.packdebug and builder.target_platform != 'mac':
for cxx_task in SM.binaries:
builder.AddCopy(cxx_task.debug, folder_map['addons/sourcemod/bin'])
for cxx_task in SM.extensions: