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

Unified Diff: chrome/common/extensions/docs/server2/build_server.py

Issue 10546078: Extension docs server: APIDataSource (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor changes Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
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..c9a0c53c361ddc52b602950d556ed3947992986a 100755
--- a/chrome/common/extensions/docs/server2/build_server.py
+++ b/chrome/common/extensions/docs/server2/build_server.py
@@ -12,20 +12,45 @@ 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 CopyThirdParty(src, dest, files=None):
+ dest_path = os.path.join(LOCAL_THIRD_PARTY_DIR, dest)
+ if not files:
+ shutil.copytree(src, dest_path)
+ MakeInit(dest_path)
+ return
+ try:
+ os.makedirs(dest_path)
+ except:
+ pass
+ MakeInit(dest_path)
+ for filename in files:
+ shutil.copy(os.path.join(src, filename), os.path.join(dest_path, filename))
def main():
shutil.rmtree(LOCAL_THIRD_PARTY_DIR, True)
- shutil.copytree(os.path.join(THIRD_PARTY_DIR, 'handlebar'),
- os.path.join(LOCAL_THIRD_PARTY_DIR, 'handlebar'))
- 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)
+ CopyThirdParty(os.path.join(THIRD_PARTY_DIR, 'handlebar'), 'handlebar')
+ CopyThirdParty(os.path.join(TOOLS_DIR, 'json_schema_compiler'),
+ 'json_schema_compiler',
+ SCHEMA_COMPILER_FILES)
+ CopyThirdParty(TOOLS_DIR, 'json_schema_compiler', ['json_comment_eater.py'])
+ MakeInit(LOCAL_THIRD_PARTY_DIR)
- 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.
+ with open(os.path.join(LOCAL_THIRD_PARTY_DIR,
+ 'handlebar',
+ '__init__.py'), 'a') as f:
+ f.write('from handlebar import Handlebar\n')
if __name__ == '__main__':
main()
« no previous file with comments | « chrome/common/extensions/docs/server2/api_data_source_test.py ('k') | chrome/common/extensions/docs/server2/echo_handler.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698