Browse Source

gclient: Support alternative names for OSes in target_os

This expands the names of OSes in a .gclient files target_os list that
gclient will recognize. This should prevent someone from putting
"windows" in their .gclient file's target_os list with no effect. (This
keeps happening to me.)

Bug: None
Change-Id: I7051caacb7fbe769bbc2d1c25c179d6335aa924e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6033012
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: Junji Watanabe <jwata@google.com>
Commit-Queue: Ben Pastene <bpastene@chromium.org>
Ben Pastene 9 tháng trước cách đây
mục cha
commit
52d1357a95
1 tập tin đã thay đổi với 6 bổ sung3 xóa
  1. 6 3
      gclient.py

+ 6 - 3
gclient.py

@@ -1630,14 +1630,17 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
         return tuple(out)
         return tuple(out)
 
 
     def get_builtin_vars(self):
     def get_builtin_vars(self):
+        linux_names = ['linux', 'unix']
+        mac_names = ['mac', 'osx']
+        win_names = ['win', 'windows']
         return {
         return {
             'checkout_android': 'android' in self.target_os,
             'checkout_android': 'android' in self.target_os,
             'checkout_chromeos': 'chromeos' in self.target_os,
             'checkout_chromeos': 'chromeos' in self.target_os,
             'checkout_fuchsia': 'fuchsia' in self.target_os,
             'checkout_fuchsia': 'fuchsia' in self.target_os,
             'checkout_ios': 'ios' in self.target_os,
             'checkout_ios': 'ios' in self.target_os,
-            'checkout_linux': 'unix' in self.target_os,
-            'checkout_mac': 'mac' in self.target_os,
-            'checkout_win': 'win' in self.target_os,
+            'checkout_linux': any(n in self.target_os for n in linux_names),
+            'checkout_mac': any(n in self.target_os for n in mac_names),
+            'checkout_win': any(n in self.target_os for n in win_names),
             'host_os': _detect_host_os(),
             'host_os': _detect_host_os(),
             'checkout_arm': 'arm' in self.target_cpu,
             'checkout_arm': 'arm' in self.target_cpu,
             'checkout_arm64': 'arm64' in self.target_cpu,
             'checkout_arm64': 'arm64' in self.target_cpu,