diff options
author | 2010-11-29 16:54:16 +0100 | |
---|---|---|
committer | 2010-11-29 16:54:16 +0100 | |
commit | 45bddc1a45696feb9177cd9f850276a1b7d38744 (patch) | |
tree | 060b8fdf408f2ae0e3adc7f3a3347b1843620374 | |
parent | Add copyright info to v8-extract-version. (diff) | |
download | chromium-tools-45bddc1a45696feb9177cd9f850276a1b7d38744.tar.gz chromium-tools-45bddc1a45696feb9177cd9f850276a1b7d38744.tar.bz2 chromium-tools-45bddc1a45696feb9177cd9f850276a1b7d38744.zip |
Make subversion dependency optional.
-rw-r--r-- | setup.py | 38 |
1 files changed, 33 insertions, 5 deletions
@@ -1,9 +1,11 @@ import os.path import subprocess +import sys from distutils.command.install_scripts import install_scripts from distutils.command.sdist import sdist from distutils.core import setup +from distutils.errors import * def get_version_from_file(): return open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'VERSION')).read() @@ -22,6 +24,23 @@ 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) @@ -41,12 +60,21 @@ class my_install_scripts(install_scripts): self.__symlink('chromium-depot-tool', 'gcl') self.__symlink('chromium-depot-tool', 'gclient') +scripts = ["v8-extract-version"] + +cmdclass = {'sdist': my_sdist} + +args = sys.argv[1:] + +enable_subversion = get_option(args, 'subversion', default=True) +if enable_subversion: + scripts += ["chromium-depot-tool", "v8-create-tarball"] + cmdclass['install_scripts'] = my_install_scripts + setup( name="chromium-tools", version=get_version(), - scripts=["chromium-depot-tool", "v8-create-tarball", "v8-extract-version"], - cmdclass={ - 'sdist': my_sdist, - 'install_scripts': my_install_scripts, - } + scripts=scripts, + cmdclass=cmdclass, + script_args=args ) |