Chromium Code Reviews| Index: chrome/common/extensions/docs/server2/build_server.py |
| diff --git a/chrome/common/extensions/docs/server2/build_server.py b/chrome/common/extensions/docs/server2/build_server.py |
| index db9d869e358ef7d79ae9411753d16227ffbd60b0..0fe17d856771d80369263186a55e32576e697e6c 100755 |
| --- a/chrome/common/extensions/docs/server2/build_server.py |
| +++ b/chrome/common/extensions/docs/server2/build_server.py |
| @@ -12,20 +12,43 @@ import sys |
| THIRD_PARTY_DIR = os.path.join(sys.path[0], os.pardir, os.pardir, os.pardir, |
| os.pardir, os.pardir, 'third_party') |
| LOCAL_THIRD_PARTY_DIR = os.path.join(sys.path[0], 'third_party') |
| +TOOLS_DIR = os.path.join(sys.path[0], os.pardir, os.pardir, os.pardir, |
| + os.pardir, os.pardir, 'tools') |
| + |
| +SCHEMA_COMPILER_FILES = ['model.py'] |
| + |
| +def MakeInit(path): |
| + path = os.path.join(path, '__init__.py') |
| + with open(os.path.join(path), 'w') as f: |
| + os.utime(os.path.join(path), None) |
| def main(): |
| shutil.rmtree(LOCAL_THIRD_PARTY_DIR, True) |
| + |
| + # Get handlebar. |
| + local_handlebar_path = os.path.join(LOCAL_THIRD_PARTY_DIR, 'handlebar') |
| shutil.copytree(os.path.join(THIRD_PARTY_DIR, 'handlebar'), |
| - os.path.join(LOCAL_THIRD_PARTY_DIR, 'handlebar')) |
| + local_handlebar_path) |
| + |
| + # Get json_schema_compiler files. |
| + local_schema_compiler_path = os.path.join(LOCAL_THIRD_PARTY_DIR, |
| + 'json_schema_compiler') |
| + os.makedirs(local_schema_compiler_path) |
| + for filename in SCHEMA_COMPILER_FILES: |
| + shutil.copy(os.path.join(TOOLS_DIR, 'json_schema_compiler', filename), |
| + os.path.join(local_schema_compiler_path, filename)) |
|
not at google - send to devlin
2012/06/10 06:58:22
Could you have some kind of CopyThirdParty functio
cduvall
2012/06/18 19:13:46
Done.
|
| + |
| + # We will need the comment eater to load JSON. |
| + shutil.copy(os.path.join(TOOLS_DIR, 'json_comment_eater.py'), |
| + os.path.join(local_schema_compiler_path, 'json_comment_eater.py')) |
| - with open(os.path.join(LOCAL_THIRD_PARTY_DIR, '__init__.py'), 'w') as f: |
| - os.utime(os.path.join(LOCAL_THIRD_PARTY_DIR, '__init__.py'), None) |
| + MakeInit(LOCAL_THIRD_PARTY_DIR) |
| + MakeInit(local_schema_compiler_path) |
| + MakeInit(local_handlebar_path) |
| - shutil.copy(os.path.join(LOCAL_THIRD_PARTY_DIR, '__init__.py'), |
| - os.path.join(LOCAL_THIRD_PARTY_DIR, 'handlebar')) |
| - with open( |
| - os.path.join(LOCAL_THIRD_PARTY_DIR, 'handlebar/__init__.py'), 'a') as f: |
| - f.write('\nfrom handlebar import Handlebar\n') |
| + # To be able to use the Handlebar class we need this import in __init__.py. |
|
not at google - send to devlin
2012/06/10 06:58:22
Why do you need it in __init__ (I'm curious / lack
cduvall
2012/06/18 19:13:46
For some reason python won't let you import classe
|
| + with open(os.path.join(local_handlebar_path, '__init__.py'), 'a') as f: |
| + f.write('from handlebar import Handlebar\n') |
| if __name__ == '__main__': |
| main() |