Merge "Also patch easy_install script creation"

This commit is contained in:
Jenkins 2013-07-27 14:42:36 +00:00 committed by Gerrit Code Review
commit 9e3af631e0
3 changed files with 31 additions and 2 deletions

View File

@ -17,6 +17,8 @@
import os
from setuptools.command import easy_install
from pbr.hooks import base
from pbr import packaging
@ -39,6 +41,8 @@ class CommandsConfig(base.BaseConfig):
def hook(self):
self.add_command('pbr.packaging.LocalSDist')
self.add_command('pbr.packaging.LocalInstallScripts')
if os.name != 'nt':
easy_install.get_script_args = packaging.override_get_script_args
if packaging.have_sphinx():
self.add_command('pbr.packaging.LocalBuildDoc')

View File

@ -444,7 +444,8 @@ if __name__ == "__main__":
"""
def _get_script_args(dist, executable, is_wininst):
def override_get_script_args(
dist, executable=os.path.normpath(sys.executable), is_wininst=False):
"""Override entrypoints console_script."""
header = easy_install.get_script_header("", executable, is_wininst)
for group in 'console_scripts', 'gui_scripts':
@ -462,7 +463,7 @@ class LocalInstallScripts(install_scripts.install_scripts):
def run(self):
if os.name != 'nt':
get_script_args = _get_script_args
get_script_args = override_get_script_args
else:
get_script_args = easy_install.get_script_args

View File

@ -98,3 +98,27 @@ class TestCore(tests.BaseTestCase):
stdout, _, return_code = self._run_cmd(
os.path.join(self.temp_dir, 'pbr_test_cmd'))
self.assertIn("PBR", stdout)
def test_console_script_develop(self):
"""Test that we develop a non-pkg-resources console script."""
if os.name == 'nt':
self.skipTest('Windows support is passthrough')
self.useFixture(
fixtures.EnvironmentVariable(
'PYTHONPATH', ".:%s" % self.temp_dir))
stdout, _, return_code = self.run_setup(
'develop', '--install-dir=%s' % self.temp_dir)
self.assertIn(
'Installing pbr_test_cmd script to %s' % self.temp_dir,
stdout)
self.assertNotIn(
'pkg_resources',
open(os.path.join(self.temp_dir, 'pbr_test_cmd'), 'r').read())
stdout, _, return_code = self._run_cmd(
os.path.join(self.temp_dir, 'pbr_test_cmd'))
self.assertIn("PBR", stdout)