summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pbr/packaging.py28
-rw-r--r--pbr/tests/test_setup.py14
-rw-r--r--setup.cfg9
-rw-r--r--tools/integration.sh100
4 files changed, 94 insertions, 57 deletions
diff --git a/pbr/packaging.py b/pbr/packaging.py
index 5ba3848..f8ad5ef 100644
--- a/pbr/packaging.py
+++ b/pbr/packaging.py
@@ -148,29 +148,37 @@ def parse_requirements(requirements_files=None):
if (not line.strip()) or line.startswith('#'):
continue
+ try:
+ project_name = pkg_resources.Requirement.parse(line).project_name
+ except ValueError:
+ project_name = None
+
# For the requirements list, we need to inject only the portion
# after egg= so that distutils knows the package it's looking for
# such as:
# -e git://github.com/openstack/nova/master#egg=nova
# -e git://github.com/openstack/nova/master#egg=nova-1.2.3
if re.match(r'\s*-e\s+', line):
- requirements.append(re.sub(r'\s*-e\s+.*#egg=(.*)$',
- egg_fragment,
- line))
+ line = re.sub(r'\s*-e\s+.*#egg=(.*)$', egg_fragment, line)
# such as:
# http://github.com/openstack/nova/zipball/master#egg=nova
# http://github.com/openstack/nova/zipball/master#egg=nova-1.2.3
elif re.match(r'\s*https?:', line):
- requirements.append(re.sub(r'\s*https?:.*#egg=(.*)$',
- egg_fragment,
- line))
+ line = re.sub(r'\s*https?:.*#egg=(.*)$', egg_fragment, line)
# -f lines are for index locations, and don't get used here
elif re.match(r'\s*-f\s+', line):
- pass
- elif line in BROKEN_ON_27 and sys.version_info >= (2, 7):
- pass
- else:
+ line = None
+ reason = 'Index Location'
+ elif (project_name and
+ project_name in BROKEN_ON_27 and sys.version_info >= (2, 7)):
+ line = None
+ reason = 'Python 2.6 only dependency'
+
+ if line is not None:
requirements.append(line)
+ else:
+ log.info(
+ '[pbr] Excluding %s: %s' % (project_name, reason))
return requirements
diff --git a/pbr/tests/test_setup.py b/pbr/tests/test_setup.py
index 0ca9a46..6a9add3 100644
--- a/pbr/tests/test_setup.py
+++ b/pbr/tests/test_setup.py
@@ -335,6 +335,20 @@ class ParseRequirementsTest(base.BaseTestCase):
if sys.version_info >= (2, 7):
self.assertEqual([], packaging.parse_requirements([self.tmp_file]))
+ def test_parse_requirements_removes_versioned_ordereddict(self):
+ self.useFixture(fixtures.MonkeyPatch('sys.version_info', (2, 7)))
+ with open(self.tmp_file, 'w') as fh:
+ fh.write("ordereddict==1.0.1")
+ self.assertEqual([], packaging.parse_requirements([self.tmp_file]))
+
+ def test_parse_requirements_keeps_versioned_ordereddict(self):
+ self.useFixture(fixtures.MonkeyPatch('sys.version_info', (2, 6)))
+ with open(self.tmp_file, 'w') as fh:
+ fh.write("ordereddict==1.0.1")
+ self.assertEqual([
+ "ordereddict==1.0.1"],
+ packaging.parse_requirements([self.tmp_file]))
+
def test_parse_requirements_override_with_env(self):
with open(self.tmp_file, 'w') as fh:
fh.write("foo\nbar")
diff --git a/setup.cfg b/setup.cfg
index efd3489..e2db946 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -7,8 +7,8 @@ description-file =
README.rst
home-page = http://pypi.python.org/pypi/pbr
requires-python = >=2.6
-classifier =
- Development Status :: 4 - Beta
+classifier =
+ Development Status :: 5 - Production/Stable
Environment :: Console
Environment :: OpenStack
Intended Audience :: Developers
@@ -29,10 +29,13 @@ setup-hooks =
warnerrors = True
[entry_points]
-distutils.setup_keywords =
+distutils.setup_keywords =
pbr = pbr.core:pbr
[build_sphinx]
all_files = 1
build-dir = doc/build
source-dir = doc/source
+
+[wheel]
+universal = 1
diff --git a/tools/integration.sh b/tools/integration.sh
index 6fa9f10..53c0602 100644
--- a/tools/integration.sh
+++ b/tools/integration.sh
@@ -2,20 +2,14 @@
function mkvenv {
venv=$1
- setuptools=$2
rm -rf $venv
- if [ "$setuptools" == 'distribute' ] ; then
- virtualenv --distribute $venv
- elif [ "$setuptools" == 'setuptools' ] ; then
- virtualenv $venv
- else
- virtualenv $venv
- $venv/bin/pip install -v -U $setuptools
- fi
- $venv/bin/pip install -U pip
+ virtualenv $venv
+ $venv/bin/pip install -U pip wheel
}
+export PIP_USE_WHEEL=true
+
# BASE should be a directory with a subdir called "new" and in that
# dir, there should be a git repository for every entry in PROJECTS
BASE=${BASE:-/opt/stack}
@@ -31,8 +25,9 @@ whoami=$(whoami)
tmpdownload=$tmpdir/download
mkdir -p $tmpdownload
-pypidir=$tmpdir/pypi
-mkdir -p $pypidir
+pypidir=/var/www/pypi
+sudo mkdir -p $pypidir
+sudo chown $USER $pypidir
pypimirrorvenv=$tmpdir/pypi-mirror
@@ -49,7 +44,7 @@ EOF
pypimirrorsourcedir=$tmpdir/pypimirrorsourcedir
git clone $REPODIR/pypi-mirror $pypimirrorsourcedir
-mkvenv $pypimirrorvenv setuptools
+mkvenv $pypimirrorvenv
$pypimirrorvenv/bin/pip install -e $pypimirrorsourcedir
cat <<EOF > $tmpdir/mirror.yaml
@@ -66,6 +61,25 @@ EOF
# because the wheel format itself does not distinguish
distro=`lsb_release -i -r -s | xargs | tr ' ' '-'`
+# set up local apache to serve the mirror we're about to create
+if [ ! -d /etc/apache2/sites-enabled/ ] ; then
+ echo "Apache does not seem to be installed!!!"
+ exit 1
+fi
+
+sudo rm /etc/apache2/sites-enabled/*
+cat <<EOF > $tmpdir/pypi.conf
+<VirtualHost *:80>
+ ServerAdmin webmaster@localhost
+ DocumentRoot /var/www
+ Options Indexes FollowSymLinks
+</VirtualHost>
+EOF
+sudo mv $tmpdir/pypi.conf /etc/apache2/sites-available/pypi
+sudo chown root:root /etc/apache2/sites-available/pypi
+sudo a2ensite pypi
+sudo service apache2 reload
+
# PROJECTS is a list of projects that we're testing
PROJECTS=$*
@@ -82,10 +96,13 @@ $pypimirrorvenv/bin/python setup.py sdist -d $tmpdownload/pip/openstack
$pypimirrorvenv/bin/run-mirror -b remotes/origin/master --verbose -c $tmpdir/mirror.yaml --no-download
+find $pypidir -type f -name '*.html' -delete
find $pypidir
+
# Make pypi thing
-pypiurl=file://$pypidir
+pypiurl=http://localhost/pypi
+export no_proxy=$no_proxy${no_proxy:+,}localhost
cat <<EOF > ~/.pydistutils.cfg
[easy_install]
@@ -132,7 +149,7 @@ def main():
EOF
epvenv=$eptest/venv
-mkvenv $epvenv setuptools
+mkvenv $epvenv
eppbrdir=$tmpdir/eppbrdir
git clone $REPODIR/pbr $eppbrdir
@@ -148,11 +165,19 @@ mkdir -p $projectdir
for PROJECT in $PROJECTS ; do
SHORT_PROJECT=$(basename $PROJECT)
- if ! grep 'pbr' $REPODIR/$SHORT_PROJECT/requirements.txt >/dev/null 2>&1
+ if ! grep 'pbr' $REPODIR/$SHORT_PROJECT/setup.py >/dev/null 2>&1
then
# project doesn't use pbr
continue
fi
+ if [ $SHORT_PROJECT = 'pypi-mirror' ]; then
+ # pypi-mirror doesn't consume the mirror
+ continue
+ fi
+ if [ $SHORT_PROJECT = 'jeepyb' ]; then
+ # pypi-mirror doesn't consume the mirror
+ continue
+ fi
if [ $SHORT_PROJECT = 'tempest' ]; then
# Tempest doesn't really install
continue
@@ -161,7 +186,8 @@ for PROJECT in $PROJECTS ; do
# requirements doesn't really install
continue
fi
- shortprojectdir=$projectdir/$SHORT_PROJECT
+
+ # set up the project synced with the global requirements
sudo chown -R $USER $REPODIR/$SHORT_PROJECT
(cd $REPODIR/requirements && python update.py $REPODIR/$SHORT_PROJECT)
pushd $REPODIR/$SHORT_PROJECT
@@ -169,33 +195,35 @@ for PROJECT in $PROJECTS ; do
git commit -a -m'Update requirements'
fi
popd
- git clone $REPODIR/$SHORT_PROJECT $shortprojectdir
- sdistvenv=$tmpdir/sdist
+ # Clone from synced repo
+ shortprojectdir=$projectdir/$SHORT_PROJECT
+ git clone $REPODIR/$SHORT_PROJECT $shortprojectdir
# Test that we can make a tarball from scratch
- mkvenv $sdistvenv distribute
+ sdistvenv=$tmpdir/sdist
+ mkvenv $sdistvenv
cd $shortprojectdir
$sdistvenv/bin/python setup.py sdist
- # Test that the tarball installs
cd $tmpdir
+
+ # Test that the tarball installs
tarballvenv=$tmpdir/tarball
- mkvenv $tarballvenv setuptools
+ mkvenv $tarballvenv
$tarballvenv/bin/pip install $shortprojectdir/dist/*tar.gz
# Test pip installing
pipvenv=$tmpdir/pip
- mkvenv $pipvenv setuptools
- cd $tmpdir
- echo $pipvenv/bin/pip install git+file://$REPODIR/$SHORT_PROJECT
- $pipvenv/bin/pip install git+file://$REPODIR/$SHORT_PROJECT
+ mkvenv $pipvenv
+ $pipvenv/bin/pip install git+file://$shortprojectdir
# Test python setup.py install
installvenv=$tmpdir/install
- mkvenv $installvenv setuptools
+ mkvenv $installvenv
+
installprojectdir=$projectdir/install$SHORT_PROJECT
- git clone $REPODIR/$SHORT_PROJECT $installprojectdir
+ git clone $shortprojectdir $installprojectdir
cd $installprojectdir
$installvenv/bin/python setup.py install
@@ -203,20 +231,4 @@ for PROJECT in $PROJECTS ; do
if [ $SHORT_PROJECT = 'nova' ]; then
find $installvenv | grep migrate.cfg
fi
-
- # TODO(mordred): extend script to do a better job with the mirrir
- # easy_install to a file:/// can't handle name case insensitivity
- # Test python setup.py develop
- # developvenv=$tmpdir/develop
- # mkvenv $developvenv setuptools
- # developprojectdir=$projectdir/develop$SHORT_PROJECT
- # git clone $REPODIR/$SHORT_PROJECT $developprojectdir
- # cd $developprojectdir
- # $developvenv/bin/python setup.py develop
-
- # TODO(mordred): need to implement egg filtering
- # Because install will have caused eggs to be locally downloaded
- # pbr can get excluded from being in the actual venv
- # test that this did not happen
- # $tempvenv/bin/python -c 'import pkg_resources as p; import sys; pbr=p.working_set.find(p.Requirement.parse("pbr")) is None; sys.exit(pbr or 0)'
done