Uploading my Fork of python-neutronclient
Posted on February 10, 2017
For many reasons we’ve found it necessary to upload a fork of python-neutronclient. I do this so rarely that I always forget how to do it and this post is here to remind me. Hopefully other people can get some help from this.
Changing up the setup.cfg
Because this is a fork we need to change a couple things (otherwise it won’t be a fork anymore). The biggest things to change are the name, author, author-email, and home-page.
name = rackspace-python-neutronclient author = Rackspace author-email = email@example.com home-page = http://www.rackspace.com
Commit these changes and push to whatever branch you need to. I push here.
Preventing the PBR “git installed?” Problem
This is caused by
version.py looking for the wrong distribution name. Simply modify
target = 'rackspace-python-neutronclient' __version__ = pbr.version.VersionInfo(target).version_string()
Setting the Version with Tags (no longer necessary)
This used to be the only known way to get sdist to populate the version in PKG-INFO. It is now recommended to set the version with an environment variable passed during the upload step. This is here just in case that trick stops working.
When you attempt to upload to pypi it fails with random reasons. It appears that some part of the setup process requires for there to be a tag on the commit you’re currently on.
Create a tag with the version using a X.Y.Z format:
git tag -a 2.4.1 -m "Rackspace OpenStack Network Client"
Now upload to pypitest then pypi
If this part is confusing check out this guide on pypiy before continuing. I assume by this point you have pypitest and pypi setup as target repositories.
If your tag is setup correctly all you should need to do is run the following:
PBR_VERSION=x.y.z python setup.py sdist upload -r pypitest
You should be able to goto testpypi and find your package at this point. If the version looks like what you want then you can continue to upload to the real pypi. At one point I had weird additional things appended to my version. The solution to this was to delete the tag,
git tag -d, recreate it as above, then upload it again to pypitest.
To upload to pypi run:
PBR_VERSION=x.y.z python setup.py sdist upload -r pypi
That should be it!
Because of the way that pypi works, the version that you choose during the upload step must be different than any version you have ever loaded. There is no known way to get beyond this only-append feature of pypi.
If anyone knows how to get beyond this please leave a comment. It is really annoying.