I am building several Python packages and would like to upload them only if all the packages have been successfully built. I have a separate stage for each Python package, whose sdist
is carried to the last stage where all collected sdist
s should be uploaded (if the build reaches the final stage, then all packages were built successfully).
Now, is there a way to execute python setup.py sdist
, then python setup.py upload [path]
in order to achieve what I need? Or is there a better way for this?
P.S.: I am using Bamboo, if it helps.
Currently, upload will only push files that are created by a distutils sdist/bdist command run from the same command line than upload, e.g. python setup.py sdist upload
. If you run sdist
, check the result, and then do sdist upload
, the second sdist should be exactly the same, unless your setup.py is buggy, you made changes to your files or you have a computer problem. (I agree that’s a lot of unless).
A trick can be used to avoid the second sdist to redo all its work: Fist you run python setup.py sdist --keep-temp
, then you check the sdist, and to upload you call python setup.py sdist --dry-run upload
.
There is an open enhancement request to improve this in the next feature release: http://bugs.python.org/issue12944
In the meantime, you can use twine.