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

Unified Diff: tools/get_drt.py

Issue 10134070: Get get_drt working on Windows, take 2. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | tools/testing/perf_testing/run_perf_tests.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/get_drt.py
===================================================================
--- tools/get_drt.py (revision 6977)
+++ tools/get_drt.py (working copy)
@@ -14,6 +14,7 @@
import subprocess
import sys
import tempfile
+import zipfile
def NormJoin(path1, path2):
return os.path.normpath(os.path.join(path1, path2))
@@ -22,22 +23,22 @@
dart_src = NormJoin(os.path.dirname(sys.argv[0]), os.pardir)
os.chdir(dart_src)
-GSUTIL_DIR = 'third_party/gsutil'
+GSUTIL_DIR = os.path.join('third_party', 'gsutil')
GSUTIL = GSUTIL_DIR + '/gsutil'
-DRT_DIR = 'client/tests/drt'
-DRT_VERSION = DRT_DIR + '/LAST_VERSION'
+DRT_DIR = os.path.join('client', 'tests', 'drt')
+DRT_VERSION = os.path.join(DRT_DIR, 'LAST_VERSION')
DRT_LATEST_PATTERN = (
'gs://dartium-archive/latest/drt-%(osname)s-inc-*.zip')
DRT_PERMANENT_PREFIX = 'gs://dartium-archive/drt-%(osname)s-inc'
-DARTIUM_DIR = 'client/tests/dartium'
-DARTIUM_VERSION = DARTIUM_DIR + '/LAST_VERSION'
+DARTIUM_DIR = os.path.join('client', 'tests', 'dartium')
+DARTIUM_VERSION = os.path.join(DARTIUM_DIR, 'LAST_VERSION')
DARTIUM_LATEST_PATTERN = (
'gs://dartium-archive/latest/dartium-%(osname)s-inc-*.zip')
DARTIUM_PERMANENT_PREFIX = 'gs://dartium-archive/dartium-%(osname)s-inc'
-sys.path.append(GSUTIL_DIR + '/boto')
+sys.path.append(os.path.join(GSUTIL_DIR, 'boto'))
import boto
@@ -57,11 +58,11 @@
def gsutil(*cmd):
- return execute_command(GSUTIL, *cmd)
+ return execute_command('python', GSUTIL, *cmd)
def gsutil_visible(*cmd):
- execute_command_visible(GSUTIL, *cmd)
+ execute_command_visible('python', GSUTIL, *cmd)
def has_boto_config():
@@ -112,6 +113,8 @@
osname = 'mac'
elif system == 'Linux':
osname = 'lucid64'
+ elif system == 'Windows':
+ osname = 'win'
else:
print >>sys.stderr, ('WARNING: platform "%s" does not support'
'%s for tests') % (system, name)
@@ -149,15 +152,23 @@
# download the zip file to a temporary path, and unzip to the target location
temp_dir = tempfile.mkdtemp()
try:
- temp_zip = temp_dir + '/drt.zip'
+ temp_zip = os.path.join(temp_dir, 'drt.zip')
+ temp_zip_url = 'file://' + temp_zip
# It's nice to show download progress
- gsutil_visible('cp', latest, temp_zip)
+ gsutil_visible('cp', latest, temp_zip_url)
- result, out = execute_command('unzip', temp_zip, '-d', temp_dir)
- if result != 0:
Siggi Cherem (dart-lang) 2012/04/25 23:41:00 why did this check go away?
Emily Fortuna 2012/04/26 15:51:49 Ooops, I took it out when I was debugging and forg
- raise Exception('Execution of "unzip %s -d %s" failed: %s' %
- (temp_zip, temp_dir, str(out)))
- unzipped_dir = temp_dir + '/' + os.path.basename(latest)[:-4] # remove .zip
+ if platform.system() != 'Windows':
+ # The Python zip utility does not preserve executable permissions, but
+ # this does not seem to be a problem for Windows, which does not have a
+ # built in zip utility. :-/
Emily Fortuna 2012/04/25 23:26:13 This branch is the same from the original.
+ result, out = execute_command('unzip', temp_zip, '-d', temp_dir)
+ unzipped_dir = temp_dir + '/' + os.path.basename(latest)[:-4] #Remove .zip
+ else:
Emily Fortuna 2012/04/25 23:26:13 This branch is what I added for Windows. :-/ Every
+ z = zipfile.ZipFile(temp_zip)
+ z.extractall(temp_dir)
+ # -4 = remove .zip for dir name
+ unzipped_dir = os.path.join(temp_dir, os.path.basename(latest)[:-4])
+ z.close()
shutil.move(unzipped_dir, directory)
finally:
shutil.rmtree(temp_dir)
« no previous file with comments | « no previous file | tools/testing/perf_testing/run_perf_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698