Determine wheel names for PyPI uploading

* .../files/slave_scripts/pypi-extract-name.py: Add --tarball and
--wheel switches to return the proper corresponding name versions,
since they differ in some cases in the presence of non-alphanumeric
characters. Make --tarball the default for backward-compatibility.
This adds a dependency on the wheel module.

* .../files/slave_scripts/pypi-extract-universal.py: Use the correct
py2 indicator for non-universal wheel types rather than the old py27
fallback.

* .../files/slave_scripts/pypi-tarball-upload.sh: Request the
tarball version of the package name prefix.

* .../files/slave_scripts/pypi-wheel-upload.sh: Request the wheel
version of the package name prefix, and also correct the
version/type separator character.

* .../manifests/pypi_slave.pp: Always install the latest versions of
the wheel and twine packages.

Change-Id: I2ae724f1f4d0a88b602e3581a0b06b999fb4833c
This commit is contained in:
Jeremy Stanley 2014-06-06 14:00:53 +00:00
parent 33b3f87932
commit b6c833b82a
5 changed files with 22 additions and 7 deletions

View File

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

View File

@ -25,4 +25,4 @@ if setup_cfg.has_section("wheel"):
if universal:
print("py2.py3")
else:
print("py27")
print("py2")

View File

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

View File

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

View File

@ -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'],
}