mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 10:41:31 +00:00
[portability] Support unknown operating systems in gclient.
Detect the name of unknown operating systems using uname, if available, since it doesn't append the operating system version. Change-Id: Idab7bd0db65a8d424ec2fd48f06247405b6649e4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4169240 Auto-Submit: Jonas Termansen <sortie@google.com> Reviewed-by: Josip Sokcevic <sokcevic@chromium.org> Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
This commit is contained in:
@@ -634,7 +634,7 @@ def CheckCallAndFilter(args, print_stdout=False, filter_fn=None,
|
||||
# If our stdout is a terminal, then pass in a psuedo-tty pipe to our
|
||||
# subprocess when filtering its output. This makes the subproc believe
|
||||
# it was launched from a terminal, which will preserve ANSI color codes.
|
||||
os_type = GetMacWinAixOrLinux()
|
||||
os_type = GetOperatingSystem()
|
||||
if sys.stdout.isatty() and os_type != 'win' and os_type != 'aix':
|
||||
pipe_reader, pipe_writer = os.openpty()
|
||||
else:
|
||||
@@ -780,8 +780,8 @@ def FindFileUpwards(filename, path=None):
|
||||
path = new_path
|
||||
|
||||
|
||||
def GetMacWinAixOrLinux():
|
||||
"""Returns 'mac', 'win', or 'linux', matching the current platform."""
|
||||
def GetOperatingSystem():
|
||||
"""Returns 'mac', 'win', 'linux', or the name of the current platform."""
|
||||
if sys.platform.startswith(('cygwin', 'win')):
|
||||
return 'win'
|
||||
|
||||
@@ -794,7 +794,10 @@ def GetMacWinAixOrLinux():
|
||||
if sys.platform.startswith('aix'):
|
||||
return 'aix'
|
||||
|
||||
raise Error('Unknown platform: ' + sys.platform)
|
||||
try:
|
||||
return os.uname().sysname.lower()
|
||||
except AttributeError:
|
||||
return sys.platform
|
||||
|
||||
|
||||
def GetGClientRootAndEntries(path=None):
|
||||
|
||||
Reference in New Issue
Block a user