diff options
author | Monty Taylor <mordred@inaugust.com> | 2015-01-28 06:57:06 -0800 |
---|---|---|
committer | Monty Taylor <mordred@inaugust.com> | 2015-01-28 07:05:53 -0800 |
commit | 381b6471b6dddce6bf741ee3795957e25d977b40 (patch) | |
tree | c372bdd73d8d9619aa640d264b3bdffdaa87f7f4 | |
parent | 0a92e4d0dc4c69db0f758e9e557a4318314240d2 (diff) | |
download | pbr-381b6471b6dddce6bf741ee3795957e25d977b40.tar.gz |
Support script text override for newer develop
setuptools > 12 has a new flow for writing out generated script text.
It's nicer, actually, because it means we can just subclass and extend
one method instead of monekypatching.
Change-Id: I56e7bea60df8a59d859575d426ce93c45ffee314
-rw-r--r-- | pbr/hooks/commands.py | 1 | ||||
-rw-r--r-- | pbr/packaging.py | 13 | ||||
-rw-r--r-- | tools/integration.sh | 7 |
3 files changed, 21 insertions, 0 deletions
diff --git a/pbr/hooks/commands.py b/pbr/hooks/commands.py index 617c6a8..8e651e6 100644 --- a/pbr/hooks/commands.py +++ b/pbr/hooks/commands.py @@ -41,6 +41,7 @@ class CommandsConfig(base.BaseConfig): self.add_command('pbr.packaging.LocalEggInfo') self.add_command('pbr.packaging.LocalSDist') self.add_command('pbr.packaging.LocalInstallScripts') + self.add_command('pbr.packaging.LocalDevelop') if os.name != 'nt': easy_install.get_script_args = packaging.override_get_script_args diff --git a/pbr/packaging.py b/pbr/packaging.py index c42600e..90d603b 100644 --- a/pbr/packaging.py +++ b/pbr/packaging.py @@ -31,6 +31,7 @@ import re import sys import pkg_resources +from setuptools.command import develop from setuptools.command import easy_install from setuptools.command import egg_info from setuptools.command import install @@ -339,6 +340,18 @@ def override_get_script_args( yield (name, header + script_text) +class LocalDevelop(develop.develop): + + command_name = 'develop' + + def install_wrapper_scripts(self, dist): + if sys.platform == 'win32': + return develop.develop.install_wrapper_scripts(self, dist) + if not self.exclude_scripts: + for args in override_get_script_args(dist): + self.write_script(*args) + + class LocalInstallScripts(install_scripts.install_scripts): """Intercepts console scripts entry_points.""" command_name = 'install_scripts' diff --git a/tools/integration.sh b/tools/integration.sh index df055d8..a385203 100644 --- a/tools/integration.sh +++ b/tools/integration.sh @@ -115,6 +115,13 @@ eppbrdir=$tmpdir/eppbrdir git clone $REPODIR/pbr $eppbrdir $epvenv/bin/pip install -e $eppbrdir +# First check develop +PBR_VERSION=0.0 $epvenv/bin/python setup.py develop +cat $epvenv/bin/test_cmd +grep 'PBR Generated' $epvenv/bin/test_cmd +PBR_VERSION=0.0 $epvenv/bin/python setup.py develop --uninstall + +# Now check install PBR_VERSION=0.0 $epvenv/bin/python setup.py install cat $epvenv/bin/test_cmd grep 'PBR Generated' $epvenv/bin/test_cmd |