diff options
author | Monty Taylor <mordred@inaugust.com> | 2015-01-28 06:57:06 -0800 |
---|---|---|
committer | Monty Taylor <mordred@inaugust.com> | 2015-02-03 17:05:30 -0500 |
commit | 1457aafa6095da4e33a6eb0a52218f077d991a67 (patch) | |
tree | 44ed6690b91bb1d4003b50a3b486c081a832ba71 | |
parent | aef4f7ef4faec987d553d1ca40b55951235af0b1 (diff) | |
download | pbr-1457aafa6095da4e33a6eb0a52218f077d991a67.tar.gz |
Support script text override for newer develop0.10.8
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.
Closes-Bug: 1415106
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 3033119..e8b0c3f 100644 --- a/pbr/hooks/commands.py +++ b/pbr/hooks/commands.py @@ -43,6 +43,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 9a8f1c5..592ad32 100644 --- a/pbr/packaging.py +++ b/pbr/packaging.py @@ -30,6 +30,7 @@ import sys from distutils.command import install as du_install from distutils import log 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 @@ -321,6 +322,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 58ffac8..6f79541 100644 --- a/tools/integration.sh +++ b/tools/integration.sh @@ -80,6 +80,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 |