OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2013 The LUCI Authors. All rights reserved. | 2 # Copyright 2013 The LUCI Authors. All rights reserved. |
3 # Use of this source code is governed under the Apache License, Version 2.0 | 3 # Use of this source code is governed under the Apache License, Version 2.0 |
4 # that can be found in the LICENSE file. | 4 # that can be found in the LICENSE file. |
5 | 5 |
6 """Archives a set of files or directories to an Isolate Server.""" | 6 """Archives a set of files or directories to an Isolate Server.""" |
7 | 7 |
8 __version__ = '0.8.0' | 8 __version__ = '0.8.0' |
9 | 9 |
10 import errno | 10 import errno |
(...skipping 1690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1701 return bundle | 1701 return bundle |
1702 | 1702 |
1703 | 1703 |
1704 def directory_to_metadata(root, algo, blacklist): | 1704 def directory_to_metadata(root, algo, blacklist): |
1705 """Returns the FileItem list and .isolated metadata for a directory.""" | 1705 """Returns the FileItem list and .isolated metadata for a directory.""" |
1706 root = file_path.get_native_path_case(root) | 1706 root = file_path.get_native_path_case(root) |
1707 paths = isolated_format.expand_directory_and_symlink( | 1707 paths = isolated_format.expand_directory_and_symlink( |
1708 root, '.' + os.path.sep, blacklist, sys.platform != 'win32') | 1708 root, '.' + os.path.sep, blacklist, sys.platform != 'win32') |
1709 metadata = { | 1709 metadata = { |
1710 relpath: isolated_format.file_to_metadata( | 1710 relpath: isolated_format.file_to_metadata( |
1711 os.path.join(root, relpath), {}, 0, algo) | 1711 os.path.join(root, relpath), {}, 0, algo, False) |
1712 for relpath in paths | 1712 for relpath in paths |
1713 } | 1713 } |
1714 for v in metadata.itervalues(): | 1714 for v in metadata.itervalues(): |
1715 v.pop('t') | 1715 v.pop('t') |
1716 items = [ | 1716 items = [ |
1717 FileItem( | 1717 FileItem( |
1718 path=os.path.join(root, relpath), | 1718 path=os.path.join(root, relpath), |
1719 digest=meta['h'], | 1719 digest=meta['h'], |
1720 size=meta['s'], | 1720 size=meta['s'], |
1721 high_priority=relpath.endswith('.isolated')) | 1721 high_priority=relpath.endswith('.isolated')) |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2028 return dispatcher.execute(OptionParserIsolateServer(), args) | 2028 return dispatcher.execute(OptionParserIsolateServer(), args) |
2029 | 2029 |
2030 | 2030 |
2031 if __name__ == '__main__': | 2031 if __name__ == '__main__': |
2032 subprocess42.inhibit_os_error_reporting() | 2032 subprocess42.inhibit_os_error_reporting() |
2033 fix_encoding.fix_encoding() | 2033 fix_encoding.fix_encoding() |
2034 tools.disable_buffering() | 2034 tools.disable_buffering() |
2035 colorama.init() | 2035 colorama.init() |
2036 file_path.enable_symlink() | 2036 file_path.enable_symlink() |
2037 sys.exit(main(sys.argv[1:])) | 2037 sys.exit(main(sys.argv[1:])) |
OLD | NEW |