Search code examples
pythonjenkinssetuptools

python`setup.py upload` error code on Linux


I'm trying to publish a python package from jenkins. When publishing to an already published version, I see:

Submitting dist/mylib-0.2.13.tar.gz to http://mypypiserver/api/pypi/pypi-release-local Upload failed (403): Forbidden

However, the shell script that calls this is unable to determine that an error occured, because setup.py doesn't exit with an error code in this case. Is this a bug, or am I using setuptools incorrectly?

I'm on setuptools version 23.0.0, but can also reproduce with versions 20.2.2 and 21.0.0. Curiously, this doesn't happen on OS X.


Solution

  • After some research, I discovered this is a bug in distutils. See https://bugs.python.org/issue21722 teach distutils "upload" to exit with code != 0 when error occurs

    This was patched and backported to python 2.7.7

    I was running python 2.7.6 on my Linux machine, and 2.7.10 on my Mac, which was the reason for the discrepancy that I noted.