0

As part of a Continuous Integration pipeline, I'm trying to build a Python wheel file from a repository, upload it to a custom devpi server, and run tests on the wheel file from there.

One method I've tried is to build and upload the wheel file in one line with setuptools, but this returns a 404 Not Found message.

Working on Windows, my .pypirc is at C:\Users\buildbot\.pypirc

[distutils]
index-servers =
    staging

[staging]
repository: http://pypi/root/staging
username: buildbot
password: 12345678

From the root of my project repo, I try to build and upload with:

python.exe .\setup.py bdist_wheel upload --repository http://pypi/root/staging

But, while the wheel is placed in dist\proj-20141216.2.dev0-py2-none-any.whl just fine, the upload step results in:

running upload Submitting C:\var\buildminion\build_proj-dev\build\dist\proj-20141216.2.dev0-py2-none-any.whl to http://pypi/root/staging

Upload failed (404): Not Found

Running setuptools register results in a similar:

Registering snail to http://pypi/root/staging

Server response (404): Not Found

I know that the devpi server is running correctly, because I can upload the file manually with

devpi use http://pypi/root/staging
devpi login buildbot --password 12345678
devpi upload dist\proj-20141216.2.dev0-py2-none-any.whl

Any ideas why setuptools upload doesn't work?

Also, is there anyway of using this upload feature without a .pypirc (or of automatically populating that file)? In the future, I would like to be able to automatically provision buildbot minions, and that's an extra bit of configuration I'd avoid if I could.

If there's no way of making this work, I can script the manual upload using devpi. I would like the same CI code to work for multiple versions of multiple projects, so it would be easier if I didn't have to write code to match against a wheel filename. This is why I would prefer to use setuptools upload. Does pip have any upload capabilities?

laffoyb
  • 1,540
  • 3
  • 22
  • 35
  • Okay, after a bit more research, it seems that devpi itself will _build_ and _upload_ the project. The command I want is `devpi upload --formats bdist_wheel --no-vcs`. I'm still curious as to why setuptools' upload command won't work, but devpi's does, as I believe that the latter calls the former. – laffoyb Jan 07 '15 at 16:13

1 Answers1

4

The issue is the url, for setup.py you need the trailing '/' so change your config to:

[distutils]
index-servers =
    staging

[staging]
repository: http://pypi/root/staging/
username: buildbot
password: 12345678

and you would likeley have to register the projec, which was a tripping point for me:

python.exe .\setup.py bdist_wheel register -r staging
python.exe .\setup.py bdist_wheel upload -r staging
sfossen
  • 4,774
  • 24
  • 18