| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 # This script is used to copy all dependencies into the local directory. | 6 # This script is used to copy all dependencies into the local directory. |
| 7 # The package of files can then be uploaded to App Engine. | 7 # The package of files can then be uploaded to App Engine. |
| 8 import os | 8 import os |
| 9 import shutil | 9 import shutil |
| 10 import sys | 10 import sys |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 os.utime(os.path.join(path), None) | 22 os.utime(os.path.join(path), None) |
| 23 | 23 |
| 24 def CopyThirdParty(src, dest, files=None): | 24 def CopyThirdParty(src, dest, files=None): |
| 25 dest_path = os.path.join(LOCAL_THIRD_PARTY_DIR, dest) | 25 dest_path = os.path.join(LOCAL_THIRD_PARTY_DIR, dest) |
| 26 if not files: | 26 if not files: |
| 27 shutil.copytree(src, dest_path) | 27 shutil.copytree(src, dest_path) |
| 28 MakeInit(dest_path) | 28 MakeInit(dest_path) |
| 29 return | 29 return |
| 30 try: | 30 try: |
| 31 os.makedirs(dest_path) | 31 os.makedirs(dest_path) |
| 32 except: | 32 except Exception: |
| 33 pass | 33 pass |
| 34 MakeInit(dest_path) | 34 MakeInit(dest_path) |
| 35 for filename in files: | 35 for filename in files: |
| 36 shutil.copy(os.path.join(src, filename), os.path.join(dest_path, filename)) | 36 shutil.copy(os.path.join(src, filename), os.path.join(dest_path, filename)) |
| 37 | 37 |
| 38 def main(): | 38 def main(): |
| 39 shutil.rmtree(LOCAL_THIRD_PARTY_DIR, True) | 39 shutil.rmtree(LOCAL_THIRD_PARTY_DIR, True) |
| 40 | 40 |
| 41 CopyThirdParty(os.path.join(THIRD_PARTY_DIR, 'handlebar'), 'handlebar') | 41 CopyThirdParty(os.path.join(THIRD_PARTY_DIR, 'handlebar'), 'handlebar') |
| 42 CopyThirdParty(os.path.join(SRC_DIR, 'ppapi', 'generators'), | 42 CopyThirdParty(os.path.join(SRC_DIR, 'ppapi', 'generators'), |
| 43 'json_schema_compiler') | 43 'json_schema_compiler') |
| 44 CopyThirdParty(os.path.join(THIRD_PARTY_DIR, 'ply'), | 44 CopyThirdParty(os.path.join(THIRD_PARTY_DIR, 'ply'), |
| 45 os.path.join('json_schema_compiler', 'ply')) | 45 os.path.join('json_schema_compiler', 'ply')) |
| 46 CopyThirdParty(os.path.join(TOOLS_DIR, 'json_schema_compiler'), | 46 CopyThirdParty(os.path.join(TOOLS_DIR, 'json_schema_compiler'), |
| 47 'json_schema_compiler', | 47 'json_schema_compiler', |
| 48 SCHEMA_COMPILER_FILES) | 48 SCHEMA_COMPILER_FILES) |
| 49 CopyThirdParty(TOOLS_DIR, 'json_schema_compiler', ['json_comment_eater.py']) | 49 CopyThirdParty(TOOLS_DIR, 'json_schema_compiler', ['json_comment_eater.py']) |
| 50 MakeInit(LOCAL_THIRD_PARTY_DIR) | 50 MakeInit(LOCAL_THIRD_PARTY_DIR) |
| 51 | 51 |
| 52 # To be able to use the Handlebar class we need this import in __init__.py. | 52 # To be able to use the Handlebar class we need this import in __init__.py. |
| 53 with open(os.path.join(LOCAL_THIRD_PARTY_DIR, | 53 with open(os.path.join(LOCAL_THIRD_PARTY_DIR, |
| 54 'handlebar', | 54 'handlebar', |
| 55 '__init__.py'), 'a') as f: | 55 '__init__.py'), 'a') as f: |
| 56 f.write('from handlebar import Handlebar\n') | 56 f.write('from handlebar import Handlebar\n') |
| 57 | 57 |
| 58 if __name__ == '__main__': | 58 if __name__ == '__main__': |
| 59 main() | 59 main() |
| OLD | NEW |