diff --git a/modules/openstack_project/files/slave_scripts/pypi-extract-name.py b/modules/openstack_project/files/slave_scripts/pypi-extract-name.py index 864e625832..fd1b8b143e 100644 --- a/modules/openstack_project/files/slave_scripts/pypi-extract-name.py +++ b/modules/openstack_project/files/slave_scripts/pypi-extract-name.py @@ -15,9 +15,18 @@ # Extract Python package name from setup.cfg import ConfigParser +import sys + +import wheel.bdist_wheel setup_cfg = ConfigParser.SafeConfigParser() setup_cfg.read("setup.cfg") distname = setup_cfg.get("metadata", "name") assert distname -print(distname) +if not len(sys.argv) or sys.argv[1] == "--tarball": + print(distname) +elif sys.argv[1] == "--wheel": + print(wheel.bdist_wheel.safer_name(distname)) +else: + sys.stderr.write("ERROR: Valid options are --tarball and --wheel") + sys.exit(1) diff --git a/modules/openstack_project/files/slave_scripts/pypi-extract-universal.py b/modules/openstack_project/files/slave_scripts/pypi-extract-universal.py index 7101c2edb5..e4fd7b8398 100644 --- a/modules/openstack_project/files/slave_scripts/pypi-extract-universal.py +++ b/modules/openstack_project/files/slave_scripts/pypi-extract-universal.py @@ -25,4 +25,4 @@ if setup_cfg.has_section("wheel"): if universal: print("py2.py3") else: - print("py27") + print("py2") diff --git a/modules/openstack_project/files/slave_scripts/pypi-tarball-upload.sh b/modules/openstack_project/files/slave_scripts/pypi-tarball-upload.sh index 815bd1ea84..25372b080e 100755 --- a/modules/openstack_project/files/slave_scripts/pypi-tarball-upload.sh +++ b/modules/openstack_project/files/slave_scripts/pypi-tarball-upload.sh @@ -23,7 +23,7 @@ TAG=`echo $ZUUL_REF | sed 's/^refs.tags.//'` # Look in the setup.cfg to determine if a package name is specified, but # fall back on the project name if necessary -DISTNAME=`/usr/local/jenkins/slave_scripts/pypi-extract-name.py \ +DISTNAME=`/usr/local/jenkins/slave_scripts/pypi-extract-name.py --tarball \ || echo $PROJECT` FILENAME="$DISTNAME-$TAG.tar.gz" diff --git a/modules/openstack_project/files/slave_scripts/pypi-wheel-upload.sh b/modules/openstack_project/files/slave_scripts/pypi-wheel-upload.sh index 7b235a94da..3ba3ca1589 100755 --- a/modules/openstack_project/files/slave_scripts/pypi-wheel-upload.sh +++ b/modules/openstack_project/files/slave_scripts/pypi-wheel-upload.sh @@ -23,11 +23,11 @@ TAG=`echo $ZUUL_REF | sed 's/^refs.tags.//'` # Look in the setup.cfg to determine if a package name is specified, but # fall back on the project name if necessary -DISTNAME=`/usr/local/jenkins/slave_scripts/pypi-extract-name.py \ +DISTNAME=`/usr/local/jenkins/slave_scripts/pypi-extract-name.py --wheel \ || echo $PROJECT` # Look in the setup.cfg to see if this is a universal wheel or not WHEELTYPE=`/usr/local/jenkins/slave_scripts/pypi-extract-universal.py` -FILENAME="$DISTNAME-$TAG.$WHEELTYPE-none-any.whl" +FILENAME="$DISTNAME-$TAG-$WHEELTYPE-none-any.whl" rm -rf *.whl curl --fail -o $FILENAME http://$TARBALL_SITE/$PROJECT/$FILENAME diff --git a/modules/openstack_project/manifests/pypi_slave.pp b/modules/openstack_project/manifests/pypi_slave.pp index dbb1ed9beb..6f9a0f8de6 100644 --- a/modules/openstack_project/manifests/pypi_slave.pp +++ b/modules/openstack_project/manifests/pypi_slave.pp @@ -31,8 +31,14 @@ class openstack_project::pypi_slave ( include pip package { 'twine': - ensure => present, - provider => 'pip', + ensure => latest, + provider => pip, + require => Class['pip'], + } + + package { 'wheel': + ensure => latest, + provider => pip, require => Class['pip'], }