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

Side by Side Diff: runtime/tools/create_archive.py

Issue 1507923002: - Make sure the tar file for Observatory resources only contains (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: TABS to spaces. Created 5 years 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 # Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 # Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 # for details. All rights reserved. Use of this source code is governed by a 2 # for details. All rights reserved. Use of this source code is governed by a
3 # BSD-style license that can be found in the LICENSE file. 3 # BSD-style license that can be found in the LICENSE file.
4 # 4 #
5 # This python script creates a tar archive and a C++ source file which contains 5 # This python script creates a tar archive and a C++ source file which contains
6 # the tar archive as an array of bytes. 6 # the tar archive as an array of bytes.
7 7
8 import os 8 import os
9 import sys 9 import sys
10 from os.path import join, splitext 10 from os.path import join, splitext
11 import time 11 import time
12 from optparse import OptionParser 12 from optparse import OptionParser
13 from datetime import date 13 from datetime import date
14 import tarfile 14 import tarfile
15 import tempfile 15 import tempfile
16 16
17 def makeArchive(tar_path, client_root, files): 17 def makeArchive(tar_path, client_root, files):
18 tar = tarfile.open(tar_path, mode='w') 18 tar = tarfile.open(tar_path, mode='w')
19 for input_file_name in files: 19 for input_file_name in files:
20 # Chop off client_root. 20 # Chop off client_root.
21 archive_file_name = input_file_name[ len(client_root) : ] 21 archive_file_name = input_file_name[ len(client_root) : ]
22 # Replace back slash with forward slash. So we do not have Windows paths.
23 archive_file_name = archive_file_name.replace("\\", "/")
22 # Open input file and add it to the archive. 24 # Open input file and add it to the archive.
23 with open(input_file_name, 'rb') as input_file: 25 with open(input_file_name, 'rb') as input_file:
24 tarInfo = tarfile.TarInfo(name=archive_file_name) 26 tarInfo = tarfile.TarInfo(name=archive_file_name)
25 input_file.seek(0,2) 27 input_file.seek(0,2)
26 tarInfo.size = input_file.tell() 28 tarInfo.size = input_file.tell()
27 input_file.seek(0) 29 input_file.seek(0)
28 tar.addfile(tarInfo, fileobj=input_file) 30 tar.addfile(tarInfo, fileobj=input_file)
29 tar.close() 31 tar.close()
30 32
31 def writeCCFile(output_file, 33 def writeCCFile(output_file,
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 return 0 144 return 0
143 145
144 except Exception, inst: 146 except Exception, inst:
145 sys.stderr.write('create_resources.py exception\n') 147 sys.stderr.write('create_resources.py exception\n')
146 sys.stderr.write(str(inst)) 148 sys.stderr.write(str(inst))
147 sys.stderr.write('\n') 149 sys.stderr.write('\n')
148 return -1 150 return -1
149 151
150 if __name__ == '__main__': 152 if __name__ == '__main__':
151 sys.exit(main(sys.argv)) 153 sys.exit(main(sys.argv))
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