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

Unified Diff: sdk/lib/html/scripts/idlsync.py

Issue 11691009: Moved most of html lib generating scripts into tools. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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
« no previous file with comments | « sdk/lib/html/scripts/idlrenderer_test.py ('k') | sdk/lib/html/scripts/logging.conf » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/scripts/idlsync.py
diff --git a/sdk/lib/html/scripts/idlsync.py b/sdk/lib/html/scripts/idlsync.py
deleted file mode 100755
index ba4c4eeb3b80046986a0fa10942bb8b63f56975b..0000000000000000000000000000000000000000
--- a/sdk/lib/html/scripts/idlsync.py
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/usr/bin/python
-# Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-# for details. All rights reserved. Use of this source code is governed by a
-# BSD-style license that can be found in the LICENSE file.
-
-import optparse
-import os
-import os.path
-import re
-import shutil
-import subprocess
-import sys
-
-SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__))
-DART_PATH = os.path.abspath(os.path.join(SCRIPT_PATH, '..', '..', '..', '..'))
-
-# Path to install latest IDL.
-IDL_PATH = os.path.join(DART_PATH, 'third_party', 'WebCore')
-
-# Whitelist of files to keep.
-WHITELIST = [
- r'LICENSE(\S+)',
- r'(\S+)\.idl']
-
-# README file to generate.
-README = os.path.join(IDL_PATH, 'README')
-
-# SVN URL to latest Dartium version of WebKit.
-DEPS = 'http://dart.googlecode.com/svn/branches/bleeding_edge/deps/dartium.deps/DEPS'
-URL_PATTERN = r'"dartium_webkit_trunk": "(\S+)",'
-REV_PATTERN = r'"dartium_webkit_revision": "(\d+)",'
-WEBCORE_SUBPATH = 'Source/WebCore'
-
-
-def RunCommand(cmd):
- """Executes a shell command and return its stdout."""
- print ' '.join(cmd)
- pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- output = pipe.communicate()
- if pipe.returncode == 0:
- return output[0]
- else:
- print output[1]
- print 'FAILED. RET_CODE=%d' % pipe.returncode
- sys.exit(pipe.returncode)
-
-
-def GetWebkitSvnRevision():
- """Returns a tuple with the (dartium webkit repo, latest revision)."""
- deps = RunCommand(['svn', 'cat', DEPS])
- url = re.search(URL_PATTERN, deps).group(1)
- revision = re.search(REV_PATTERN, deps).group(1)
- return (url, revision)
-
-
-def RefreshIDL(url, revision):
- """Refreshes the IDL to specific WebKit url / revision."""
- cwd = os.getcwd()
- try:
- shutil.rmtree(IDL_PATH)
- os.chdir(os.path.dirname(IDL_PATH))
- RunCommand(['svn', 'export', '-r', revision, url + '/' + WEBCORE_SUBPATH])
- finally:
- os.chdir(cwd)
-
-
-def PruneExtraFiles():
- """Removes all files that do not match the whitelist."""
- pattern = re.compile(reduce(lambda x,y: '%s|%s' % (x,y),
- map(lambda z: '(%s)' % z, WHITELIST)))
- for (root, dirs, files) in os.walk(IDL_PATH, topdown=False):
- for f in files:
- if not pattern.match(f):
- os.remove(os.path.join(root, f))
- for d in dirs:
- dirpath = os.path.join(root, d)
- if not os.listdir(dirpath):
- shutil.rmtree(dirpath)
-
-
-def ParseOptions():
- parser = optparse.OptionParser()
- parser.add_option('--revision', '-r', dest='revision',
- help='Revision to install', default=None)
- args, _ = parser.parse_args()
- return args.revision
-
-
-def GenerateReadme(url, revision):
- readme = """This directory contains a copy of WebKit/WebCore IDL files.
-See the attached LICENSE-* files in this directory.
-
-Please do not modify the files here. They are periodically copied
-using the script: $DART_ROOT/sdk/lib/html/scripts/%(script)s
-
-The current version corresponds to:
-URL: %(url)s
-Current revision: %(revision)s
-""" % {
- 'script': os.path.basename(__file__),
- 'url': url,
- 'revision': revision }
- out = open(README, 'w')
- out.write(readme)
- out.close()
-
-
-def main():
- revision = ParseOptions()
- url, latest = GetWebkitSvnRevision()
- if not revision:
- revision = latest
- RefreshIDL(url, revision)
- PruneExtraFiles()
- GenerateReadme(url, revision)
-
-
-if __name__ == '__main__':
- main()
« no previous file with comments | « sdk/lib/html/scripts/idlrenderer_test.py ('k') | sdk/lib/html/scripts/logging.conf » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698