Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Step #2 in the usage section raises ValueError #65

Closed
thebjorn opened this issue Dec 4, 2014 · 10 comments · Fixed by #66
Closed

Step #2 in the usage section raises ValueError #65

thebjorn opened this issue Dec 4, 2014 · 10 comments · Fixed by #66
Assignees
Labels

Comments

@thebjorn
Copy link

thebjorn commented Dec 4, 2014

I'm just following the steps in the README.rst file.

Step 1 "Create some distributions in the normal way:"

c:\srv\lib\dkconfig>python setup.py sdist bdist_wininst bdist_wheel
....
c:\srv\lib\dkconfig>ll dist
total 756
-rw-rw-rw-  1 bjorn 0   5848 2014-11-30 02:37 dkconfig-0.1.0-py2.py3-none-any.whl
-rwxrwxrwx  1 bjorn 0 238971 2014-11-30 02:37 dkconfig-0.1.0.win32.exe*
-rw-rw-rw-  1 bjorn 0   7107 2014-11-30 02:37 dkconfig-0.1.0.zip
-rw-rw-rw-  1 bjorn 0   6097 2014-11-30 16:59 dkconfig-0.1.2-py2.py3-none-any.whl
-rwxrwxrwx  1 bjorn 0 239326 2014-11-30 16:59 dkconfig-0.1.2.win32.exe*
-rw-rw-rw-  1 bjorn 0   7417 2014-11-30 16:59 dkconfig-0.1.2.zip
-rw-rw-rw-  1 bjorn 0   6328 2014-12-04 05:35 dkconfig-0.1.4-py2.py3-none-any.whl
-rwxrwxrwx  1 bjorn 0 239536 2014-12-04 05:35 dkconfig-0.1.4.win32.exe*
-rw-rw-rw-  1 bjorn 0   7641 2014-12-04 05:35 dkconfig-0.1.4.zip

Step 2 "Upload with twine:"

c:\srv\lib\dkconfig>twine upload dist/*
Uploading distributions to https://pypi.python.org/pypi
ValueError: Unknown distribution format: '*'

It's fine if you don't support windows, but when Windows is listed in setup's classifiers it would be nice if there was an asterisk in the docs saying that the steps as listed are not going to work...

@sigmavirus24
Copy link
Member

This is a duplicate of #64 (opened yesterday). In the future, please check for existing issues before filing a new one.

@merwok
Copy link

merwok commented Dec 4, 2014

Are you sure this is a duplicate? The error message in the other bug says that wininst/exe is not a supported format, but here it looks like the issue is that neither the shell nor twine expand the * pattern, and don’t match any file. If it is the same bug, the error message is misleading, and that’s what this bug should be about.

@thebjorn
Copy link
Author

thebjorn commented Dec 4, 2014

The bug report was primarily against the usage section in the readme (https://github.com/pypa/twine#usage), which simply doesn't work as presented on Windows.

This doesn't seem to be related to exe installers, since I get the same error after I remove them:

c:\srv\lib\dkconfig>dir dist
 Volume in drive C has no label.
 Volume Serial Number is 74BA-5873

 Directory of c:\srv\lib\dkconfig\dist

2014-12-04  22:08    <DIR>          .
2014-12-04  22:08    <DIR>          ..
2014-11-30  02:37             5,848 dkconfig-0.1.0-py2.py3-none-any.whl
2014-11-30  02:37             7,107 dkconfig-0.1.0.zip
2014-11-30  16:59             6,097 dkconfig-0.1.2-py2.py3-none-any.whl
2014-11-30  16:59             7,417 dkconfig-0.1.2.zip
2014-12-04  05:39             6,328 dkconfig-0.1.4-py2.py3-none-any.whl
2014-12-04  05:39             7,641 dkconfig-0.1.4.zip
               6 File(s)         40,438 bytes
               2 Dir(s)  115,470,413,824 bytes free

c:\srv\lib\dkconfig>twine upload dist/*
Uploading distributions to https://pypi.python.org/pypi
ValueError: Unknown distribution format: '*'

c:\srv\lib\dkconfig>

It looks like @merwok's analysis is correct, and that there is missing a glob.glob() call somewhere, since I can upload a fully specified filename:

c:\srv\lib\dkconfig\dist>twine upload dkconfig-0.1.4-py2.py3-none-any.whl
Uploading distributions to https://pypi.python.org/pypi
Uploading dkconfig-0.1.4-py2.py3-none-any.whl
HTTPError: 400 Client Error: A file named "dkconfig-0.1.4-py2.py3-none-any.whl" already exists     for  dkconfig-0.1.4. To fix problems with that file you should create a new release.

The usage steps in the readme is still non-functioning on Windows however, and you'll need to be a pretty dedicated Windows user if you want to figure it out -- I know I would never expect that file globbing wouldn't work as expected... still, twine is functional for Windows users with a small documentation change.

@dstufft
Copy link
Member

dstufft commented Dec 4, 2014

The instructions in the README depend on the shell expanding the globbing. I guess windows shell doesn't do that?

@sigmavirus24
Copy link
Member

You're right @merwok. I'm sorry for the confusion @thebjorn.

As for Windows shell not expanding *, I'm not sure how to achieve the same functionality but I'm sure Google knows. :)

@thebjorn
Copy link
Author

thebjorn commented Dec 4, 2014

For expanding * (called globbing for some reason), use the glob module (available in all Pythons) or the newer pathlib module (it's been backported to Python 2.7).

@sigmavirus24
Copy link
Member

So I think @thebjorn is right. This affects more than just windows. If you, for example, use tox and create an environment like so:

[testenv:release]
deps =
    twine
commands =
    python setup.py sdist
    pip wheel --wheel-dir dist
    twine upload {posags} dist/*

You're going to get the same error because tox also doesn't provide shell expansion. I would think simply checking for something ending in /* and replacing it with the contents of glob.glob would be sufficient.

@sigmavirus24 sigmavirus24 self-assigned this Dec 6, 2014
@dstufft
Copy link
Member

dstufft commented Dec 6, 2014

You probably don't want to check for something ending in /* because people might also do dist/*.whl or so. Perhaps the solution is to first check if a file exists by the name passed in (so that if you have a filename with * in it that it works correctly) and then if that doesn't exist just call glob.glob on it and then look for a file that exists by that name?

@sigmavirus24
Copy link
Member

True. That's probably a better idea.

@sigmavirus24
Copy link
Member

This is actually a duplicate of #40. (For future reference.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants