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

Side by Side Diff: build/scripts/common/chromium_utils.py

Issue 158543002: Let MakeZip() copy mtimes for toplevel build directory files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« 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) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """ Set of basic operations/utilities that are used by the build. """ 5 """ Set of basic operations/utilities that are used by the build. """
6 6
7 from contextlib import contextmanager 7 from contextlib import contextmanager
8 import copy 8 import copy
9 import cStringIO 9 import cStringIO
10 import errno 10 import errno
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 Raises PathNotFound if either the file or the directory is not found. 480 Raises PathNotFound if either the file or the directory is not found.
481 """ 481 """
482 # Verify the file and directory separately so we can tell them apart and 482 # Verify the file and directory separately so we can tell them apart and
483 # raise PathNotFound rather than shutil.copyfile's IOError. 483 # raise PathNotFound rather than shutil.copyfile's IOError.
484 if not os.path.isfile(src_path): 484 if not os.path.isfile(src_path):
485 raise PathNotFound('Unable to find file %s' % src_path) 485 raise PathNotFound('Unable to find file %s' % src_path)
486 if not os.path.isdir(dest_dir): 486 if not os.path.isdir(dest_dir):
487 raise PathNotFound('Unable to find dir %s' % dest_dir) 487 raise PathNotFound('Unable to find dir %s' % dest_dir)
488 src_file = os.path.basename(src_path) 488 src_file = os.path.basename(src_path)
489 if dest_fn: 489 if dest_fn:
490 shutil.copy(src_path, os.path.join(dest_dir, dest_fn)) 490 shutil.copy2(src_path, os.path.join(dest_dir, dest_fn))
491 else: 491 else:
492 shutil.copy(src_path, os.path.join(dest_dir, src_file)) 492 shutil.copy2(src_path, os.path.join(dest_dir, src_file))
Drew Haven 2014/02/09 23:36:32 Dunno if maybe we should document that this also c
Nico 2014/02/09 23:41:01 Done.
493 493
494 494
495 def MakeZip(output_dir, archive_name, file_list, file_relative_dir, 495 def MakeZip(output_dir, archive_name, file_list, file_relative_dir,
496 raise_error=True, remove_archive_directory=True, path_filter=None): 496 raise_error=True, remove_archive_directory=True, path_filter=None):
497 """Packs files into a new zip archive. 497 """Packs files into a new zip archive.
498 498
499 Files are first copied into a directory within the output_dir named for 499 Files are first copied into a directory within the output_dir named for
500 the archive_name, which will be created if necessary and emptied if it 500 the archive_name, which will be created if necessary and emptied if it
501 already exists. The files are then then packed using archive names 501 already exists. The files are then then packed using archive names
502 relative to the output_dir. That is, if the zipfile is unpacked in place, 502 relative to the output_dir. That is, if the zipfile is unpacked in place,
503 it will create a directory identical to the new archiev_name directory, in 503 it will create a directory identical to the new archive_name directory, in
504 the output_dir. The zip file will be named as the archive_name, plus 504 the output_dir. The zip file will be named as the archive_name, plus
505 '.zip'. 505 '.zip'.
506 506
507 Args: 507 Args:
508 output_dir: Absolute path to the directory in which the archive is to 508 output_dir: Absolute path to the directory in which the archive is to
509 be created. 509 be created.
510 archive_dir: Subdirectory of output_dir holding files to be added to 510 archive_dir: Subdirectory of output_dir holding files to be added to
511 the new zipfile. 511 the new zipfile.
512 file_list: List of paths to files or subdirectories, relative to the 512 file_list: List of paths to files or subdirectories, relative to the
513 file_relative_dir. 513 file_relative_dir.
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 """ 1356 """
1357 try: 1357 try:
1358 pool = multiprocessing.Pool(processes=processes) 1358 pool = multiprocessing.Pool(processes=processes)
1359 yield pool 1359 yield pool
1360 pool.close() 1360 pool.close()
1361 except: 1361 except:
1362 pool.terminate() 1362 pool.terminate()
1363 raise 1363 raise
1364 finally: 1364 finally:
1365 pool.join() 1365 pool.join()
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