Skip to content

Unable to correctly extract version from pypi distributed tarball #244

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

Closed
harlowja opened this issue Aug 10, 2015 · 7 comments
Closed

Unable to correctly extract version from pypi distributed tarball #244

harlowja opened this issue Aug 10, 2015 · 7 comments

Comments

@harlowja
Copy link

Trying to use jsonschema's version support, I am unable to actually get the version number.

Here is what I did to reproduce this:

Seems like something is busted here (wheels seem to work):

$ virtualenv-2.7 .venv;
New python executable in .venv/bin/python
Installing setuptools, pip, wheel...done.
harlowja@buildingbuild:/tmp/d$ source .venv/bin/activate
(.venv)harlowja@buildingbuild:/tmp/d$ ls
(.venv)harlowja@buildingbuild:/tmp/d$ wget https://pypi.python.org/packages/source/j/jsonschema/jsonschema-2.5.1.tar.gz#md5=374e848fdb69a3ce8b7e778b47c30640 --no-check-certificate
--2015-08-10 14:32:04--  https://pypi.python.org/packages/source/j/jsonschema/jsonschema-2.5.1.tar.gz
Resolving pypi.python.org (pypi.python.org)... 199.27.79.223
Connecting to pypi.python.org (pypi.python.org)|199.27.79.223|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 50855 (50K) [application/octet-stream]
Saving to: ‘jsonschema-2.5.1.tar.gz’

100%[==================================================================================================================================>] 50,855      --.-K/s   in 0.03s   

2015-08-10 14:32:04 (1.93 MB/s) - ‘jsonschema-2.5.1.tar.gz’ saved [50855/50855]

(.venv)harlowja@buildingbuild:/tmp/d$ tar -xzvf jsonschema-2.5.1.tar.gz 
jsonschema-2.5.1/
jsonschema-2.5.1/CHANGELOG.rst
jsonschema-2.5.1/COPYING
jsonschema-2.5.1/json/
jsonschema-2.5.1/json/.gitignore
jsonschema-2.5.1/json/.travis.yml
jsonschema-2.5.1/json/bin/
jsonschema-2.5.1/json/bin/jsonschema_suite
jsonschema-2.5.1/json/LICENSE
jsonschema-2.5.1/json/README.md
jsonschema-2.5.1/json/remotes/
jsonschema-2.5.1/json/remotes/folder/
jsonschema-2.5.1/json/remotes/folder/folderInteger.json
jsonschema-2.5.1/json/remotes/integer.json
jsonschema-2.5.1/json/remotes/subSchemas.json
jsonschema-2.5.1/json/tests/
jsonschema-2.5.1/json/tests/draft3/
jsonschema-2.5.1/json/tests/draft3/additionalItems.json
jsonschema-2.5.1/json/tests/draft3/additionalProperties.json
jsonschema-2.5.1/json/tests/draft3/default.json
jsonschema-2.5.1/json/tests/draft3/dependencies.json
jsonschema-2.5.1/json/tests/draft3/disallow.json
jsonschema-2.5.1/json/tests/draft3/divisibleBy.json
jsonschema-2.5.1/json/tests/draft3/enum.json
jsonschema-2.5.1/json/tests/draft3/extends.json
jsonschema-2.5.1/json/tests/draft3/items.json
jsonschema-2.5.1/json/tests/draft3/maximum.json
jsonschema-2.5.1/json/tests/draft3/maxItems.json
jsonschema-2.5.1/json/tests/draft3/maxLength.json
jsonschema-2.5.1/json/tests/draft3/minimum.json
jsonschema-2.5.1/json/tests/draft3/minItems.json
jsonschema-2.5.1/json/tests/draft3/minLength.json
jsonschema-2.5.1/json/tests/draft3/optional/
jsonschema-2.5.1/json/tests/draft3/optional/bignum.json
jsonschema-2.5.1/json/tests/draft3/optional/format.json
jsonschema-2.5.1/json/tests/draft3/optional/jsregex.json
jsonschema-2.5.1/json/tests/draft3/optional/zeroTerminatedFloats.json
jsonschema-2.5.1/json/tests/draft3/pattern.json
jsonschema-2.5.1/json/tests/draft3/patternProperties.json
jsonschema-2.5.1/json/tests/draft3/properties.json
jsonschema-2.5.1/json/tests/draft3/ref.json
jsonschema-2.5.1/json/tests/draft3/refRemote.json
jsonschema-2.5.1/json/tests/draft3/required.json
jsonschema-2.5.1/json/tests/draft3/type.json
jsonschema-2.5.1/json/tests/draft3/uniqueItems.json
jsonschema-2.5.1/json/tests/draft4/
jsonschema-2.5.1/json/tests/draft4/additionalItems.json
jsonschema-2.5.1/json/tests/draft4/additionalProperties.json
jsonschema-2.5.1/json/tests/draft4/allOf.json
jsonschema-2.5.1/json/tests/draft4/anyOf.json
jsonschema-2.5.1/json/tests/draft4/default.json
jsonschema-2.5.1/json/tests/draft4/definitions.json
jsonschema-2.5.1/json/tests/draft4/dependencies.json
jsonschema-2.5.1/json/tests/draft4/enum.json
jsonschema-2.5.1/json/tests/draft4/items.json
jsonschema-2.5.1/json/tests/draft4/maximum.json
jsonschema-2.5.1/json/tests/draft4/maxItems.json
jsonschema-2.5.1/json/tests/draft4/maxLength.json
jsonschema-2.5.1/json/tests/draft4/maxProperties.json
jsonschema-2.5.1/json/tests/draft4/minimum.json
jsonschema-2.5.1/json/tests/draft4/minItems.json
jsonschema-2.5.1/json/tests/draft4/minLength.json
jsonschema-2.5.1/json/tests/draft4/minProperties.json
jsonschema-2.5.1/json/tests/draft4/multipleOf.json
jsonschema-2.5.1/json/tests/draft4/not.json
jsonschema-2.5.1/json/tests/draft4/oneOf.json
jsonschema-2.5.1/json/tests/draft4/optional/
jsonschema-2.5.1/json/tests/draft4/optional/bignum.json
jsonschema-2.5.1/json/tests/draft4/optional/format.json
jsonschema-2.5.1/json/tests/draft4/optional/zeroTerminatedFloats.json
jsonschema-2.5.1/json/tests/draft4/pattern.json
jsonschema-2.5.1/json/tests/draft4/patternProperties.json
jsonschema-2.5.1/json/tests/draft4/properties.json
jsonschema-2.5.1/json/tests/draft4/ref.json
jsonschema-2.5.1/json/tests/draft4/refRemote.json
jsonschema-2.5.1/json/tests/draft4/required.json
jsonschema-2.5.1/json/tests/draft4/type.json
jsonschema-2.5.1/json/tests/draft4/uniqueItems.json
jsonschema-2.5.1/jsonschema/
jsonschema-2.5.1/jsonschema/__init__.py
jsonschema-2.5.1/jsonschema/__main__.py
jsonschema-2.5.1/jsonschema/_format.py
jsonschema-2.5.1/jsonschema/_reflect.py
jsonschema-2.5.1/jsonschema/_utils.py
jsonschema-2.5.1/jsonschema/_validators.py
jsonschema-2.5.1/jsonschema/_version.py
jsonschema-2.5.1/jsonschema/cli.py
jsonschema-2.5.1/jsonschema/compat.py
jsonschema-2.5.1/jsonschema/exceptions.py
jsonschema-2.5.1/jsonschema/schemas/
jsonschema-2.5.1/jsonschema/schemas/draft3.json
jsonschema-2.5.1/jsonschema/schemas/draft4.json
jsonschema-2.5.1/jsonschema/tests/
jsonschema-2.5.1/jsonschema/tests/__init__.py
jsonschema-2.5.1/jsonschema/tests/compat.py
jsonschema-2.5.1/jsonschema/tests/test_cli.py
jsonschema-2.5.1/jsonschema/tests/test_exceptions.py
jsonschema-2.5.1/jsonschema/tests/test_format.py
jsonschema-2.5.1/jsonschema/tests/test_jsonschema_test_suite.py
jsonschema-2.5.1/jsonschema/tests/test_validators.py
jsonschema-2.5.1/jsonschema/validators.py
jsonschema-2.5.1/jsonschema.egg-info/
jsonschema-2.5.1/jsonschema.egg-info/dependency_links.txt
jsonschema-2.5.1/jsonschema.egg-info/entry_points.txt
jsonschema-2.5.1/jsonschema.egg-info/pbr.json
jsonschema-2.5.1/jsonschema.egg-info/PKG-INFO
jsonschema-2.5.1/jsonschema.egg-info/requires.txt
jsonschema-2.5.1/jsonschema.egg-info/SOURCES.txt
jsonschema-2.5.1/jsonschema.egg-info/top_level.txt
jsonschema-2.5.1/MANIFEST.in
jsonschema-2.5.1/PKG-INFO
jsonschema-2.5.1/README.rst
jsonschema-2.5.1/setup.cfg
jsonschema-2.5.1/setup.py
jsonschema-2.5.1/tox.ini
jsonschema-2.5.1/version.txt
(.venv)harlowja@buildingbuild:/tmp/d$ cd jsonschema-2.5.1/
(.venv)harlowja@buildingbuild:/tmp/d/jsonschema-2.5.1$ ls
CHANGELOG.rst  COPYING  json  jsonschema  jsonschema.egg-info  MANIFEST.in  PKG-INFO  README.rst  setup.cfg  setup.py  tox.ini  version.txt
(.venv)harlowja@buildingbuild:/tmp/d/jsonschema-2.5.1$ python setup.py --version
zip_safe flag not set; analyzing archive contents...

Installed /tmp/d/jsonschema-2.5.1/.eggs/vcversioner-2.14.0.0-py2.7.egg
Traceback (most recent call last):
  File "setup.py", line 44, in <module>
    vcversioner={"version_module_paths" : ["jsonschema/_version.py"]},
  File "/usr/lib/python2.7/distutils/core.py", line 137, in setup
    ok = dist.parse_command_line()
  File "/tmp/d/.venv/local/lib/python2.7/site-packages/setuptools/dist.py", line 299, in parse_command_line
    result = _Distribution.parse_command_line(self)
  File "/usr/lib/python2.7/distutils/dist.py", line 459, in parse_command_line
    args = parser.getopt(args=self.script_args, object=self)
  File "/usr/lib/python2.7/distutils/fancy_getopt.py", line 285, in getopt
    val = getattr(object, attr, 0) + 1
TypeError: coercing to Unicode: need string or buffer, int found
@harlowja
Copy link
Author

Also I'm not even sure if the version in version.txt is right?

cat version.txt 
v2.5.1-0-g3f459b7

@Julian
Copy link
Member

Julian commented Oct 25, 2015

Hey, I don't think I've ever used or seen that flag -- can you tell me a bit more about what you want to use it for? Generally if you want the version number you can use from jsonschema import __version__ or yes look in version.txt, both of which are autogenerated by vcversioner

@Julian
Copy link
Member

Julian commented Oct 28, 2015

To answer my own question, it looks like devpi does this for some bizarre reason, so maybe that's what you're using.

There's also now an upstream ticket: habnabit/vcversioner#6

@harlowja
Copy link
Author

Thanks, so just for common knowledge this is a pretty basic command,

Just run the following on a project:

$ python setup.py -h
Common commands: (see '--help-commands' for more)

  setup.py build      will build the package underneath 'build/'
  setup.py install    will install the package

Global options:
  --verbose (-v)      run verbosely (default)
  --quiet (-q)        run quietly (turns verbosity off)
  --dry-run (-n)      don't actually do anything
  --help (-h)         show detailed help message
  --no-user-cfg       ignore pydistutils.cfg in your home directory
  --command-packages  list of packages that provide distutils commands

Information display options (just display information, ignore any commands)
  --help-commands     list all available commands
  --name              print package name
  --version (-V)      print package version

...

@nhuray
Copy link

nhuray commented Dec 3, 2015

@Julian @harlowja Any news to fix this issue ?

@Julian
Copy link
Member

Julian commented Dec 28, 2015

@nhuray I left a comment on the upstream issue. It looks like this is still waiting for someone with some distutils knowledge to look at.

@Julian
Copy link
Member

Julian commented Aug 28, 2016

This is (as of a bit ago) now fixed upstream. Sorry for the delay.

@Julian Julian closed this as completed Aug 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants