mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
[bootstrap] Move bitness detection logic into Python
Bug: 703064 Change-Id: I319e89a43533b86c0eedff56fec2665fa13e728c Reviewed-on: https://chromium-review.googlesource.com/466006 Commit-Queue: Robbie Iannucci <iannucci@chromium.org> Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
This commit is contained in:
committed by
Commit Bot
parent
3721ee91fe
commit
a5bec84569
@@ -6,6 +6,7 @@ import argparse
|
||||
import fnmatch
|
||||
import logging
|
||||
import os
|
||||
import platform
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
@@ -26,6 +27,11 @@ def _check_call(argv, **kwargs):
|
||||
subprocess.check_call(argv, **kwargs)
|
||||
|
||||
|
||||
def get_os_bitness():
|
||||
"""Returns bitness of operating system as int."""
|
||||
return 64 if platform.machine().endswith('64') else 32
|
||||
|
||||
|
||||
def get_target_git_version():
|
||||
"""Returns git version that should be installed."""
|
||||
if os.path.exists(os.path.join(ROOT_DIR, '.git_bleeding_edge')):
|
||||
@@ -148,8 +154,9 @@ def install_git(args, git_version, git_directory):
|
||||
|
||||
def main(argv):
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--bits', type=int, choices=(32,64), default=64,
|
||||
help='Bitness of the client to install.')
|
||||
parser.add_argument('--bits', type=int, choices=(32,64),
|
||||
help='Bitness of the client to install. Default on this'
|
||||
' system: %(default)s', default=get_os_bitness())
|
||||
parser.add_argument('--cipd-client',
|
||||
help='Path to CIPD client binary. default: %(default)s',
|
||||
default=os.path.join(ROOT_DIR, 'cipd'+BAT_EXT))
|
||||
|
||||
@@ -58,16 +58,7 @@ set ERRORLEVEL=1
|
||||
goto :END
|
||||
|
||||
:GIT_CHECK
|
||||
|
||||
:: must explicitly use FIND_EXE to prevent this from grabbing e.g. gnuwin32 or
|
||||
:: msys versions.
|
||||
set FIND_EXE=%SYSTEMROOT%\System32\find.exe
|
||||
|
||||
:: Check to see if we're on a 32 or 64 bit system
|
||||
:: (parens) are necessary, otherwise batch puts an extra space after 32.
|
||||
reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | %FIND_EXE% /i "x86" > NUL && (set OS_BITS=32) || (set OS_BITS=64)
|
||||
|
||||
"%WIN_TOOLS_ROOT_DIR%\python.bat" "%~dp0git_bootstrap.py" --bits "%OS_BITS%"
|
||||
"%WIN_TOOLS_ROOT_DIR%\python.bat" "%~dp0git_bootstrap.py"
|
||||
goto :END
|
||||
|
||||
:returncode
|
||||
|
||||
Reference in New Issue
Block a user