mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-22 09:41:07 +00:00
python: Avoid using 'is' to compare strings
This is the wrong operator to use, which only seems to work because `os.name` and `'nt'` happen to be the same object. Python 3.8 also produces a `SyntaxWarning` when encountering this pattern.
This commit is contained in:
parent
2e6bd1ca8d
commit
49fea2520f
3 changed files with 5 additions and 5 deletions
|
@ -86,7 +86,7 @@ def update_repo(repo_name, repo_dir, revision, no_interaction, fetch_args=[], re
|
||||||
"\n=====================================" % (
|
"\n=====================================" % (
|
||||||
out, repo_dir))
|
out, repo_dir))
|
||||||
try:
|
try:
|
||||||
if os.name is 'nt':
|
if os.name == 'nt':
|
||||||
shell = os.environ.get("COMSPEC", r"C:\WINDOWS\system32\cmd.exe")
|
shell = os.environ.get("COMSPEC", r"C:\WINDOWS\system32\cmd.exe")
|
||||||
else:
|
else:
|
||||||
shell = os.environ.get("SHELL", os.path.realpath("/bin/sh"))
|
shell = os.environ.get("SHELL", os.path.realpath("/bin/sh"))
|
||||||
|
|
|
@ -56,7 +56,7 @@ def prepend_env_var(env, var, value, sysroot):
|
||||||
if value.startswith(sysroot):
|
if value.startswith(sysroot):
|
||||||
value = value[len(sysroot):]
|
value = value[len(sysroot):]
|
||||||
# Try not to exceed maximum length limits for env vars on Windows
|
# Try not to exceed maximum length limits for env vars on Windows
|
||||||
if os.name is 'nt':
|
if os.name == 'nt':
|
||||||
value = win32_get_short_path_name(value)
|
value = win32_get_short_path_name(value)
|
||||||
env_val = env.get(var, '')
|
env_val = env.get(var, '')
|
||||||
val = os.pathsep + value + os.pathsep
|
val = os.pathsep + value + os.pathsep
|
||||||
|
@ -144,7 +144,7 @@ def get_subprocess_env(options, gst_version):
|
||||||
env["GST_PTP_HELPER"] = os.path.normpath(
|
env["GST_PTP_HELPER"] = os.path.normpath(
|
||||||
"%s/subprojects/gstreamer/libs/gst/helpers/gst-ptp-helper" % options.builddir)
|
"%s/subprojects/gstreamer/libs/gst/helpers/gst-ptp-helper" % options.builddir)
|
||||||
|
|
||||||
if os.name is 'nt':
|
if os.name == 'nt':
|
||||||
lib_path_envvar = 'PATH'
|
lib_path_envvar = 'PATH'
|
||||||
elif platform.system() == 'Darwin':
|
elif platform.system() == 'Darwin':
|
||||||
lib_path_envvar = 'DYLD_LIBRARY_PATH'
|
lib_path_envvar = 'DYLD_LIBRARY_PATH'
|
||||||
|
@ -361,7 +361,7 @@ if __name__ == "__main__":
|
||||||
gst_version += '-' + os.path.basename(options.wine)
|
gst_version += '-' + os.path.basename(options.wine)
|
||||||
|
|
||||||
if not args:
|
if not args:
|
||||||
if os.name is 'nt':
|
if os.name == 'nt':
|
||||||
shell = get_windows_shell()
|
shell = get_windows_shell()
|
||||||
if shell == 'powershell.exe':
|
if shell == 'powershell.exe':
|
||||||
args = ['powershell.exe']
|
args = ['powershell.exe']
|
||||||
|
|
|
@ -11,7 +11,7 @@ import uuid
|
||||||
ROOTDIR = os.path.abspath(os.path.dirname(__file__))
|
ROOTDIR = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
|
||||||
|
|
||||||
if os.name is 'nt':
|
if os.name == 'nt':
|
||||||
import ctypes
|
import ctypes
|
||||||
from ctypes import wintypes
|
from ctypes import wintypes
|
||||||
_GetShortPathNameW = ctypes.windll.kernel32.GetShortPathNameW
|
_GetShortPathNameW = ctypes.windll.kernel32.GetShortPathNameW
|
||||||
|
|
Loading…
Reference in a new issue