Commit e316cafe authored by Roger Tawa's avatar Roger Tawa Committed by Commit Bot

Fix win/cross of the credential provider.

Bug: 907469
Change-Id: I11eef2154474685461408d7932a4406001ee0174
Reviewed-on: https://chromium-review.googlesource.com/c/1359066
Commit-Queue: Roger Tawa <rogerta@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#613238}
parent 399ea6ea
...@@ -44,10 +44,24 @@ All paths can be absolute or relative to $root_build_dir. ...@@ -44,10 +44,24 @@ All paths can be absolute or relative to $root_build_dir.
import argparse import argparse
import os import os
import shutil
import subprocess import subprocess
import sys import sys
def GetLZMAExec(src_path):
"""Gets the path to the 7zip compression command line tool.
Args:
src_path: Full path to the source root
Returns:
The executable command to run the 7zip compressor.
"""
return (os.path.join(src_path, r'third_party\lzma_sdk\7zr.exe')
if sys.platform == 'win32' else '7zr')
def main(): def main():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
...@@ -74,7 +88,7 @@ def main(): ...@@ -74,7 +88,7 @@ def main():
gcp_installer_fn = os.path.join(args.root_build_path, 'gcp_installer.exe') gcp_installer_fn = os.path.join(args.root_build_path, 'gcp_installer.exe')
gcp_7z_fn = os.path.join(args.root_build_path, 'gcp.7z') gcp_7z_fn = os.path.join(args.root_build_path, 'gcp.7z')
sz_fn = os.path.join(args.src_path, r'third_party\lzma_sdk\7zr.exe') sz_fn = GetLZMAExec(args.src_path)
sfx_fn = os.path.join(args.root_build_path, 'gcp_sfx.exe') sfx_fn = os.path.join(args.root_build_path, 'gcp_sfx.exe')
# Build the command line for updating files in the GCP 7z archive. # Build the command line for updating files in the GCP 7z archive.
...@@ -110,7 +124,7 @@ def main(): ...@@ -110,7 +124,7 @@ def main():
# 7zip and copy commands don't have a "silent" mode, so redirecting stdout # 7zip and copy commands don't have a "silent" mode, so redirecting stdout
# and stderr to nul. # and stderr to nul.
with open('nul') as nul_file: with open(os.devnull) as nul_file:
os.chdir(args.root_build_path) os.chdir(args.root_build_path)
subprocess.check_call(cmd + ['gaia1_0.dll'], stdout=nul_file) subprocess.check_call(cmd + ['gaia1_0.dll'], stdout=nul_file)
subprocess.check_call(cmd + ['gcp_setup.exe'], stdout=nul_file) subprocess.check_call(cmd + ['gcp_setup.exe'], stdout=nul_file)
...@@ -118,8 +132,11 @@ def main(): ...@@ -118,8 +132,11 @@ def main():
# Combine the SFX module with the archive to make a self extracting # Combine the SFX module with the archive to make a self extracting
# executable. # executable.
command = 'copy /b %s + %s %s > nul' % (sfx_fn, gcp_7z_fn, gcp_installer_fn) with open(gcp_installer_fn, 'wb') as output:
subprocess.check_call(command, shell=True) with open (sfx_fn, 'rb') as input:
shutil.copyfileobj(input, output)
with open (gcp_7z_fn, 'rb') as input:
shutil.copyfileobj(input, output)
return 0 return 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment