summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pbr/hooks/commands.py4
-rw-r--r--pbr/packaging.py5
-rw-r--r--pbr/tests/test_core.py24
-rw-r--r--pbr/tests/util.py4
-rw-r--r--pbr/util.py4
-rw-r--r--tools/integration.sh12
6 files changed, 42 insertions, 11 deletions
diff --git a/pbr/hooks/commands.py b/pbr/hooks/commands.py
index a5ed4a6..0171d0d 100644
--- a/pbr/hooks/commands.py
+++ b/pbr/hooks/commands.py
@@ -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')
diff --git a/pbr/packaging.py b/pbr/packaging.py
index c33f401..8afbde7 100644
--- a/pbr/packaging.py
+++ b/pbr/packaging.py
@@ -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
diff --git a/pbr/tests/test_core.py b/pbr/tests/test_core.py
index 4b6c49b..f8e5989 100644
--- a/pbr/tests/test_core.py
+++ b/pbr/tests/test_core.py
@@ -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)
diff --git a/pbr/tests/util.py b/pbr/tests/util.py
index e657508..de5a740 100644
--- a/pbr/tests/util.py
+++ b/pbr/tests/util.py
@@ -44,9 +44,9 @@ import shutil
import stat
try:
- import configparser
-except ImportError:
import ConfigParser as configparser
+except ImportError:
+ import configparser
@contextlib.contextmanager
diff --git a/pbr/util.py b/pbr/util.py
index 3faa58e..6339116 100644
--- a/pbr/util.py
+++ b/pbr/util.py
@@ -73,9 +73,9 @@ from setuptools.dist import Distribution
from setuptools.extension import Extension
try:
- import configparser
-except ImportError:
import ConfigParser as configparser
+except ImportError:
+ import configparser
import pbr.hooks
diff --git a/tools/integration.sh b/tools/integration.sh
index 178144b..b32b303 100644
--- a/tools/integration.sh
+++ b/tools/integration.sh
@@ -48,8 +48,11 @@ cat <<EOF > ~/.pip/pip.conf
log = $HOME/pip.log
EOF
-mkvenv $jeepybvenv 'setuptools>=0.7' pip
-$jeepybvenv/bin/pip install -U git+https://review.openstack.org/p/openstack-infra/jeepyb.git
+jeepybsourcedir=$tmpdir/jeepybsourcedir
+git clone $REPODIR/jeepyb $jeepybsourcedir
+
+mkvenv $jeepybvenv setuptools pip
+$jeepybvenv/bin/pip install -e $jeepybsourcedir
cat <<EOF > $tmpdir/mirror.yaml
cache-root: $tmpdownload
@@ -57,7 +60,7 @@ cache-root: $tmpdownload
mirrors:
- name: openstack
projects:
- - https://github.com/openstack/requirements
+ - file://$REPODIR/requirements
output: $pypidir
EOF
@@ -68,7 +71,6 @@ cd $pbrsdistdir
$jeepybvenv/bin/run-mirror -b remotes/origin/master --verbose -c $tmpdir/mirror.yaml --no-process
$jeepybvenv/bin/pip install -i http://pypi.python.org/simple -d $tmpdownload/pip/openstack 'pip==1.0' 'setuptools>=0.7'
-$jeepybvenv/bin/pip install -i http://pypi.python.org/simple -d $tmpdownload/pip/openstack 'setuptools<0.7'
$jeepybvenv/bin/pip install -i http://pypi.python.org/simple -d $tmpdownload/pip/openstack -r requirements.txt
$jeepybvenv/bin/python setup.py sdist -d $tmpdownload/pip/openstack
@@ -164,7 +166,7 @@ for PROJECT in $PROJECTS ; do
# Test that the tarball installs
cd $tmpdir
tarballvenv=$tmpdir/tarball
- mkvenv $tarballvenv 'setuptools>=0.7' 'pip>=1.3,<1.4'
+ mkvenv $tarballvenv setuptools pip
$tarballvenv/bin/pip install $shortprojectdir/dist/*tar.gz
# Test pip installing