Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Unified Diff: win_toolchain/get_toolchain_if_necessary.py

Issue 233563003: Run get_toolchain_if_necessary.py with depot_tools Python under Cygwin (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: address comments Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: win_toolchain/get_toolchain_if_necessary.py
diff --git a/win_toolchain/get_toolchain_if_necessary.py b/win_toolchain/get_toolchain_if_necessary.py
index 127506ba2f9221af535f9395ff4a2e843411d443..dcf1125eb6ad92dd82544edca591e24ec22f6b4f 100755
--- a/win_toolchain/get_toolchain_if_necessary.py
+++ b/win_toolchain/get_toolchain_if_necessary.py
@@ -26,7 +26,6 @@ future when a hypothetical VS2015 is released, the 2013 script will be
maintained, and a new 2015 script would be added.
"""
-import ctypes.wintypes
import hashlib
import json
import optparse
@@ -38,15 +37,17 @@ import time
BASEDIR = os.path.dirname(os.path.abspath(__file__))
-sys.path.append(os.path.join(BASEDIR, '..'))
+DEPOT_TOOLS_PATH = os.path.join(BASEDIR, '..')
+sys.path.append(DEPOT_TOOLS_PATH)
import download_from_google_storage
-
-GetFileAttributes = ctypes.windll.kernel32.GetFileAttributesW
-GetFileAttributes.argtypes = (ctypes.wintypes.LPWSTR,)
-GetFileAttributes.restype = ctypes.wintypes.DWORD
-FILE_ATTRIBUTE_HIDDEN = 0x2
-FILE_ATTRIBUTE_SYSTEM = 0x4
+if sys.platform != 'cygwin':
+ import ctypes.wintypes
+ GetFileAttributes = ctypes.windll.kernel32.GetFileAttributesW
+ GetFileAttributes.argtypes = (ctypes.wintypes.LPWSTR,)
+ GetFileAttributes.restype = ctypes.wintypes.DWORD
+ FILE_ATTRIBUTE_HIDDEN = 0x2
+ FILE_ATTRIBUTE_SYSTEM = 0x4
def IsHidden(file_path):
@@ -194,6 +195,17 @@ def main():
help='write information about toolchain to FILE')
options, args = parser.parse_args()
+ if sys.platform == 'cygwin':
+ # This script requires Windows Python, so invoke with depot_tools' Python.
+ def winpath(path):
+ return subprocess.check_output(['cygpath', '-w', path]).strip()
+ python = os.path.join(DEPOT_TOOLS_PATH, 'python.bat')
+ cmd = [python, winpath(__file__)]
+ if options.output_json:
+ cmd.extend(['--output-json', winpath(options.output_json)])
+ cmd.extend(args)
+ sys.exit(subprocess.call(cmd))
+
# We assume that the Pro hash is the first one.
desired_hashes = args
if len(desired_hashes) == 0:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698