diff options
author | Roman Lacko <backup.rlacko@gmail.com> | 2012-09-13 15:35:27 +0200 |
---|---|---|
committer | Roman Lacko <backup.rlacko@gmail.com> | 2012-09-13 15:35:27 +0200 |
commit | efc041c05f24bf5e585264a4432cf11f6d701ddd (patch) | |
tree | 942059748dfe1662df28faaf11951b9b14c38d97 /setup.py | |
parent | c4ba25184f9920cab69e40f5bc572b135edbc137 (diff) |
Option --version is available only when pyside-setup was cloned from git repository
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 46 |
1 files changed, 26 insertions, 20 deletions
@@ -83,6 +83,7 @@ from utils import run_process from utils import has_option from utils import option_value +# Declare options OPTION_DEBUG = has_option("debug") OPTION_QMAKE = option_value("qmake") OPTION_CMAKE = option_value("cmake") @@ -97,6 +98,7 @@ if OPTION_QMAKE is None: if OPTION_CMAKE is None: OPTION_CMAKE = find_executable("cmake") +# Show available versions if OPTION_LISTVERSIONS: for v in submodules: print("%s" % (v)) @@ -104,13 +106,6 @@ if OPTION_LISTVERSIONS: print(" %s %s" % (m[0], m[1])) sys.exit(1) -if OPTION_VERSION: - if not OPTION_VERSION in submodules: - print("""Invalid version specified %s -Use --list-versions option to get list of available versions""" % OPTION_VERSION) - sys.exit(1) - __version__ = OPTION_VERSION - # Change the cwd to our source dir try: this_file = __file__ @@ -121,20 +116,18 @@ if os.path.dirname(this_file): os.chdir(os.path.dirname(this_file)) script_dir = os.getcwd() -# Clean temp build folders -for n in ["build", "PySide.egg-info", "PySide-%s" % __version__, - "PySide", "pysideuic"]: - d = os.path.join(script_dir, n) - if os.path.isdir(d): - print("Removing %s" % d) - rmtree(d) - -# Create empty package folders -for pkg in ["PySide", "pysideuic"]: - pkg_dir = os.path.join(script_dir, pkg) - os.makedirs(pkg_dir) +# Change package version +if OPTION_VERSION: + if not os.path.isdir(".git"): + print("Option --version is available only when pyside-setup was cloned from git repository") + sys.exit(1) + if not OPTION_VERSION in submodules: + print("""Invalid version specified %s +Use --list-versions option to get list of available versions""" % OPTION_VERSION) + sys.exit(1) + __version__ = OPTION_VERSION -# Ensure that git submodules are initialized, if this is the git repo clone +# Initialize, pull and checkout submodules if os.path.isdir(".git"): print("Initializing submodules for PySide version %s" % __version__) git_update_cmd = ["git", "submodule", "update", "--init"] @@ -155,6 +148,19 @@ if os.path.isdir(".git"): raise DistutilsSetupError("Failed to initialize the git submodule %s" % module_name) os.chdir(script_dir) +# Clean up temp and package folders +for n in ["build", "PySide.egg-info", "PySide-%s" % __version__, + "PySide", "pysideuic"]: + d = os.path.join(script_dir, n) + if os.path.isdir(d): + print("Removing %s" % d) + rmtree(d) + +# Prepare package folders +for pkg in ["PySide", "pysideuic"]: + pkg_dir = os.path.join(script_dir, pkg) + os.makedirs(pkg_dir) + class pyside_install(_install): def run(self): _install.run(self) |