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.

Closes-Bug: 1415106
Change-Id: I56e7bea60df8a59d859575d426ce93c45ffee314
This commit is contained in:
Monty Taylor 2015-01-28 06:57:06 -08:00
parent aef4f7ef4f
commit 1457aafa60
3 changed files with 21 additions and 0 deletions

View File

@ -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

View File

@ -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'

View File

@ -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