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

Side by Side Diff: bootstrap/get_appengine.py

Issue 489703003: get_appengine.py: fix for go_appengine (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 6 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import datetime
6 import logging 7 import logging
7 import optparse 8 import optparse
8 import os 9 import os
9 import re 10 import re
10 import shutil 11 import shutil
11 import sys 12 import sys
13 import time
12 import tempfile 14 import tempfile
13 import urllib2 15 import urllib2
14 import zipfile 16 import zipfile
15 17
16 BASE_DIR = os.path.dirname(os.path.abspath(__file__)) 18 BASE_DIR = os.path.dirname(os.path.abspath(__file__))
17 19
18 20
19 def get_gae_sdk_version(gae_path): 21 def get_gae_sdk_version(gae_path):
20 """Returns the installed GAE SDK version or None.""" 22 """Returns the installed GAE SDK version or None."""
21 version_path = os.path.join(gae_path, 'VERSION') 23 version_path = os.path.join(gae_path, 'VERSION')
(...skipping 19 matching lines...) Expand all
41 new_version = re.search(re.escape(name) + r'(.+?).zip', url).group(1) 43 new_version = re.search(re.escape(name) + r'(.+?).zip', url).group(1)
42 # Upgrade to https 44 # Upgrade to https
43 return url.replace('http://', 'https://'), new_version 45 return url.replace('http://', 'https://'), new_version
44 46
45 47
46 def extract_zip(z, root_path): 48 def extract_zip(z, root_path):
47 """Extracts files in a zipfile but keep the executable bits.""" 49 """Extracts files in a zipfile but keep the executable bits."""
48 count = 0 50 count = 0
49 for f in z.infolist(): 51 for f in z.infolist():
50 perm = (f.external_attr >> 16L) & 0777 52 perm = (f.external_attr >> 16L) & 0777
53 mtime = time.mktime(datetime.datetime(*f.date_time).timetuple())
51 filepath = os.path.join(root_path, f.filename) 54 filepath = os.path.join(root_path, f.filename)
52 logging.debug('Extracting %s', f.filename) 55 logging.debug('Extracting %s', f.filename)
53 if f.filename.endswith('/'): 56 if f.filename.endswith('/'):
54 os.mkdir(filepath, perm) 57 os.mkdir(filepath, perm)
58 os.utime(filepath, (mtime, mtime))
Paweł Hajdan Jr. 2014/08/21 10:23:05 Since this is the same for both branches, why not
ukai 2014/08/21 14:12:18 Done.
55 else: 59 else:
56 z.extract(f, root_path) 60 z.extract(f, root_path)
57 os.chmod(filepath, perm) 61 os.chmod(filepath, perm)
62 os.utime(filepath, (mtime, mtime))
58 count += 1 63 count += 1
59 print('Extracted %d files' % count) 64 print('Extracted %d files' % count)
60 65
61 66
62 def install_latest_gae_sdk(root_path, fetch_go, dry_run): 67 def install_latest_gae_sdk(root_path, fetch_go, dry_run):
63 if fetch_go: 68 if fetch_go:
64 rootdir = 'go_appengine' 69 rootdir = 'go_appengine'
65 if sys.platform == 'darwin': 70 if sys.platform == 'darwin':
66 name = 'go_appengine_sdk_darwin_amd64-' 71 name = 'go_appengine_sdk_darwin_amd64-'
67 else: 72 else:
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 options, args = parser.parse_args() 127 options, args = parser.parse_args()
123 if args: 128 if args:
124 parser.error('Unsupported args: %s' % ' '.join(args)) 129 parser.error('Unsupported args: %s' % ' '.join(args))
125 logging.basicConfig(level=logging.DEBUG if options.verbose else logging.ERROR) 130 logging.basicConfig(level=logging.DEBUG if options.verbose else logging.ERROR)
126 return install_latest_gae_sdk( 131 return install_latest_gae_sdk(
127 os.path.abspath(options.dest), options.go, options.dry_run) 132 os.path.abspath(options.dest), options.go, options.dry_run)
128 133
129 134
130 if __name__ == '__main__': 135 if __name__ == '__main__':
131 sys.exit(main()) 136 sys.exit(main())
OLDNEW
« 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