fedora-python / pyp2rpm

Tool to convert a package from PyPI to RPM SPECFILE or to generate SRPM.
MIT License
125 stars 39 forks source link

ValueError: unknown url type: 'UNKNOWN' #70

Closed frenzymadness closed 7 years ago

frenzymadness commented 7 years ago

When I try to use pyp2rpm on Pymacs package I get following error: ValueError: unknown url type: 'UNKNOWN'

In get_url function in package_getters.py release_urls variable is empty list and release_data contains this:

{'platform': 'UNKNOWN', 'requires_python': None, 'cheesecake_installability_id': None, 'author': 'François Pinard', 'package_url': 'http://pypi.python.org/pypi/Pymacs', 'release_url': 'http://pypi.python.org/pypi/Pymacs/0.25', 'classifiers': [], 'home_page': 'UNKNOWN', 'maintainer_email': None, 'keywords': None, 'cheesecake_code_kwalitee_id': None, '_pypi_ordering': 0, 'description': 'False', **'download_url': 'UNKNOWN'**, 'maintainer': None, 'version': '0.25', 'license': 'GPLv2', 'cheesecake_documentation_id': None, 'docs_url': None, 'name': 'Pymacs', 'bugtrack_url': None, 'summary': 'Interface between Emacs Lisp and Python', 'author_email': 'pinard@iro.umontreal.ca', '_pypi_hidden': False, 'downloads': {'last_day': 0, 'last_month': 0, 'last_week': 0}}

This data comes from

        release_urls = client.release_urls(name, version)
        release_data = client.release_data(name, version)

But I cannot find definition of client.release_[data|urls] so I cannot go more to deep.

pyp2rpm version = '3.1.2'

frenzymadness commented 7 years ago

Original traceback:

Traceback (most recent call last):
  File "/home/lbalhar/.virtualenvs/py3-packaging-porting/bin/pyp2rpm", line 11, in <module>
    sys.exit(main())
  File "/home/lbalhar/.virtualenvs/py3-packaging-porting/lib/python3.5/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/home/lbalhar/.virtualenvs/py3-packaging-porting/lib/python3.5/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/home/lbalhar/.virtualenvs/py3-packaging-porting/lib/python3.5/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/lbalhar/.virtualenvs/py3-packaging-porting/lib/python3.5/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/lbalhar/.virtualenvs/py3-packaging-porting/lib/python3.5/site-packages/pyp2rpm/bin.py", line 99, in main
    converted = convertor.convert()
  File "/home/lbalhar/.virtualenvs/py3-packaging-porting/lib/python3.5/site-packages/pyp2rpm/convertor.py", line 71, in convert
    local_file = self.getter.get()
  File "/home/lbalhar/.virtualenvs/py3-packaging-porting/lib/python3.5/site-packages/pyp2rpm/package_getters.py", line 163, in get
    request.urlretrieve(url, save_file)
  File "/usr/lib64/python3.5/urllib/request.py", line 187, in urlretrieve
    with contextlib.closing(urlopen(url, data)) as fp:
  File "/usr/lib64/python3.5/urllib/request.py", line 162, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib64/python3.5/urllib/request.py", line 450, in open
    req = Request(fullurl, data)
  File "/usr/lib64/python3.5/urllib/request.py", line 268, in __init__
    self.full_url = url
  File "/usr/lib64/python3.5/urllib/request.py", line 294, in full_url
    self._parse()
  File "/usr/lib64/python3.5/urllib/request.py", line 323, in _parse
    raise ValueError("unknown url type: %r" % self.full_url)
ValueError: unknown url type: 'UNKNOWN'
mcyprian commented 7 years ago

Sources of the Pymacs package are missing on PyPI that's why data extracted using xmlrpc API contains empty list and download_url': 'UNKNOWN'. The only thing we can do here is showing nicer error message and maybe we could ask the author of the package to add sources to PyPI.

hroncok commented 7 years ago

Display an error message such as:

XYZ package has no sources on PyPI, cannot proceed. Please ask the maintainer to upload sources.

frenzymadness commented 7 years ago

Thanks for the explanation. I will try to make PR with this error handling. Also, I will ask maintainer to add sources to PyPI.

frenzymadness commented 7 years ago

Unfortunately, developer of Pymacs is dead and I cannot find a contact to somebody who takes care about this package. Pymacs will remain without sources on PyPI.

frenzymadness commented 7 years ago

Fixed by PR https://github.com/fedora-python/pyp2rpm/pull/75