gst-env: Fix python linter and indent errors

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9107>
This commit is contained in:
Nirbheek Chauhan 2025-05-28 03:13:00 +05:30 committed by GStreamer Marge Bot
parent 313435f6cb
commit 1ecfc008fc
2 changed files with 11 additions and 9 deletions

View File

@ -572,6 +572,7 @@ if __name__ == "__main__":
else:
new_args += ['/c', 'start', '/b', '/wait'] + args
args = new_args
prompt_export = None
if not args:
if os.name != 'nt':
args = [os.environ.get("SHELL", os.path.realpath("/bin/sh"))]
@ -601,7 +602,7 @@ if __name__ == "__main__":
# Ignore SIGINT while using fish as the shell to make it behave
# like other shells such as bash and zsh.
# See: https://gitlab.freedesktop.org/gstreamer/gst-build/issues/18
signal.signal(signal.SIGINT, lambda x, y: True)
signal.signal(signal.SIGINT, lambda _, __: True)
# Set the prompt
args.append('--init-command')
prompt_cmd = '''functions --copy fish_prompt original_fish_prompt

View File

@ -18,6 +18,7 @@ if os.name == 'nt':
_GetShortPathNameW.argtypes = [wintypes.LPCWSTR, wintypes.LPWSTR, wintypes.DWORD]
_GetShortPathNameW.restype = wintypes.DWORD
def win32_get_short_path_name(long_name):
"""
Gets the short path name of a given long path.
@ -44,8 +45,7 @@ def get_wine_shortpath(winecmd, wine_paths):
try:
with open(os.devnull, 'w') as stderr:
wine_path = subprocess.check_output(
winecmd +
['cmd', '/C', getShortPathScript] + wine_paths,
winecmd + ['cmd', '/C', getShortPathScript] + wine_paths,
stderr=stderr).decode('utf-8')
except subprocess.CalledProcessError as e:
print("Could not get short paths: %s" % e)
@ -54,8 +54,8 @@ def get_wine_shortpath(winecmd, wine_paths):
os.remove(getShortPathScript)
if len(wine_path) > 2048:
raise AssertionError('WINEPATH size {} > 2048'
' this will cause random failure.'.format(
len(wine_path)))
' this will cause random failure.'.format(
len(wine_path)))
return wine_path
@ -112,7 +112,6 @@ class Colors:
cls.ENDC = '\033[0m'
def git(*args, repository_path='.', fatal=True):
try:
ret = subprocess.check_output(["git"] + list(args), cwd=repository_path,
@ -122,9 +121,10 @@ def git(*args, repository_path='.', fatal=True):
if fatal:
raise e
print("Non-fatal error running git {}:\n{}".format(' '.join(args), e))
return None
return ''
return ret
def accept_command(commands):
"""Search @commands and returns the first found absolute path."""
for command in commands:
@ -133,16 +133,17 @@ def accept_command(commands):
return command
return None
def get_meson():
meson = os.path.join(ROOTDIR, 'meson', 'meson.py')
if os.path.exists(meson):
return [sys.executable, meson]
mesonintrospect = os.environ.get('MESONINTROSPECT', '')
for comp in shlex.split (mesonintrospect):
for comp in shlex.split(mesonintrospect):
# mesonintrospect might look like "/usr/bin/python /somewhere/meson introspect",
# let's not get tricked
if 'python' in os.path.basename (comp):
if 'python' in os.path.basename(comp):
continue
if os.path.exists(comp):
if comp.endswith('.py'):