diff options
-rw-r--r-- | chromium_tools.py | 28 | ||||
-rwxr-xr-x | scripts/v8-create-tarball | 30 | ||||
-rwxr-xr-x | scripts/v8-extract-version | 11 | ||||
-rw-r--r-- | setup.py | 43 |
4 files changed, 31 insertions, 81 deletions
diff --git a/chromium_tools.py b/chromium_tools.py deleted file mode 100644 index 9fbf9f9..0000000 --- a/chromium_tools.py +++ /dev/null @@ -1,28 +0,0 @@ -"""Common utilities for chromium-tools scripts.""" - -import re - -_V8_MAJOR_VERSION_PATTERN = re.compile(r"#define\s+MAJOR_VERSION\s+(.*)") -_V8_MINOR_VERSION_PATTERN = re.compile(r"#define\s+MINOR_VERSION\s+(.*)") -_V8_BUILD_NUMBER_PATTERN = re.compile(r"#define\s+BUILD_NUMBER\s+(.*)") -_V8_PATCH_LEVEL_PATTERN = re.compile(r"#define\s+PATCH_LEVEL\s+(.*)") - -_V8_PATTERNS = [ - _V8_MAJOR_VERSION_PATTERN, - _V8_MINOR_VERSION_PATTERN, - _V8_BUILD_NUMBER_PATTERN, - _V8_PATCH_LEVEL_PATTERN] - -def v8_extract_version(version_contents): - """ - Returns version number as string based on the string - contents of version.cc file. - """ - version_components = [] - for pattern in _V8_PATTERNS: - version_components.append(pattern.search(version_contents).group(1).strip()) - - if version_components[len(version_components) - 1] == '0': - version_components.pop() - - return '.'.join(version_components) diff --git a/scripts/v8-create-tarball b/scripts/v8-create-tarball index 8306819..0f7f6bb 100755 --- a/scripts/v8-create-tarball +++ b/scripts/v8-create-tarball @@ -1,5 +1,5 @@ #!/usr/bin/python2 -# Copyright 2010 Gentoo Foundation +# Copyright 2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 """Creates a tarball containing V8 sources based on an SVN tag.""" @@ -7,11 +7,35 @@ import optparse import os.path import pysvn +import re import shutil import tarfile import tempfile -import chromium_tools +_V8_MAJOR_VERSION_PATTERN = re.compile(r"#define\s+MAJOR_VERSION\s+(.*)") +_V8_MINOR_VERSION_PATTERN = re.compile(r"#define\s+MINOR_VERSION\s+(.*)") +_V8_BUILD_NUMBER_PATTERN = re.compile(r"#define\s+BUILD_NUMBER\s+(.*)") +_V8_PATCH_LEVEL_PATTERN = re.compile(r"#define\s+PATCH_LEVEL\s+(.*)") + +_V8_PATTERNS = [ + _V8_MAJOR_VERSION_PATTERN, + _V8_MINOR_VERSION_PATTERN, + _V8_BUILD_NUMBER_PATTERN, + _V8_PATCH_LEVEL_PATTERN] + +def v8_extract_version(version_contents): + """ + Returns version number as string based on the string + contents of version.cc file. + """ + version_components = [] + for pattern in _V8_PATTERNS: + version_components.append(pattern.search(version_contents).group(1).strip()) + + if version_components[len(version_components) - 1] == '0': + version_components.pop() + + return '.'.join(version_components) parser = optparse.OptionParser(usage="%prog <v8-version>") (options, args) = parser.parse_args() @@ -32,7 +56,7 @@ try: svn_client.checkout(checkout_url, checkout_dir) version_contents = open(os.path.join(checkout_dir, 'src', 'version.cc')).read() - actual_version = chromium_tools.v8_extract_version(version_contents) + actual_version = v8_extract_version(version_contents) if actual_version != args[0]: print 'Version info inside version.cc does not match!' print 'Expected %s, got %s. Exiting' % (args[0], actual_version) diff --git a/scripts/v8-extract-version b/scripts/v8-extract-version deleted file mode 100755 index 277df29..0000000 --- a/scripts/v8-extract-version +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/python2 -# Copyright 2010 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -"""Extracts V8 version number based on given version.cc file.""" - -import sys - -import chromium_tools - -print chromium_tools.v8_extract_version(open(sys.argv[1]).read()) @@ -12,10 +12,7 @@ def get_version_from_file(): return open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'VERSION')).read() def get_version_from_git(): - # TODO: replace with check_output when python-2.7 is stable. - output = subprocess.Popen( - ['git', 'describe'], - stdout=subprocess.PIPE).communicate()[0] + output = subprocess.check_output(['git', 'describe']) chunks = output.split('-') return '.'.join(chunks[:2]) @@ -25,23 +22,6 @@ def get_version(): except IOError: return get_version_from_git() -def get_option(args, name, default=False): - disable_arg = "--disable-" + name - enable_arg = "--enable-" + name - if disable_arg in args and enable_arg in args: - raise DistutilsArgError( - "Conflicting flags: %s, %s" % (disable_arg, enable_arg)) - - if disable_arg in args: - args.remove(disable_arg) - return False - - if enable_arg in args: - args.remove(enable_arg) - return True - - return default - class my_sdist(sdist): def make_release_tree(self, base_dir, files): sdist.make_release_tree(self, base_dir, files) @@ -55,25 +35,10 @@ class my_install_data(install_data): os.path.join('..', 'libexec', 'chromium-depot-tool'), os.path.join(self.install_dir, 'bin', tool)) -scripts = ["scripts/v8-extract-version"] -data_files = [] - -cmdclass = {'sdist': my_sdist} - -args = sys.argv[1:] - -enable_subversion = get_option(args, 'subversion', default=True) -if enable_subversion: - scripts += ["scripts/v8-create-tarball"] - data_files += [["libexec", ["scripts/chromium-depot-tool"]]] - cmdclass['install_data'] = my_install_data - setup( name="chromium-tools", version=get_version(), - py_modules=["chromium_tools"], - scripts=scripts, - data_files=data_files, - cmdclass=cmdclass, - script_args=args + scripts=["scripts/v8-create-tarball"], + data_files=[["libexec", ["scripts/chromium-depot-tool"]]], + cmdclass={'install_data': my_install_data, 'sdist': my_sdist}, ) |