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

unable to process wlc package #80

Closed glensc closed 7 years ago

glensc commented 7 years ago

with d9e0965

[~/rpm/packages/pyp2rpm/pyp2rpm (master)⚡] ➔ ./mybin.py wlc 
Traceback (most recent call last):
  File "./mybin.py", line 4, in <module>
    main()
  File "/usr/share/python2.7/site-packages/click/core.py", line 716, in __call__
  File "/usr/share/python2.7/site-packages/click/core.py", line 696, in main
  File "/usr/share/python2.7/site-packages/click/core.py", line 889, in invoke
  File "/usr/share/python2.7/site-packages/click/core.py", line 534, in invoke
  File "/home/users/glen/rpm/packages/pyp2rpm/pyp2rpm/pyp2rpm/bin.py", line 99, in main
    converted = convertor.convert()
  File "/home/users/glen/rpm/packages/pyp2rpm/pyp2rpm/pyp2rpm/convertor.py", line 108, in convert
    data = self.metadata_extractor.extract_data(self.client)
  File "/home/users/glen/rpm/packages/pyp2rpm/pyp2rpm/pyp2rpm/convertor.py", line 210, in metadata_extractor
    self.base_python_version)
  File "/home/users/glen/rpm/packages/pyp2rpm/pyp2rpm/pyp2rpm/metadata_extractors.py", line 412, in __init__
    extract_distribution.run_setup(setup_py, 'bdist_rpm')
  File "/home/users/glen/rpm/packages/pyp2rpm/pyp2rpm/pyp2rpm/extract_distribution.py", line 86, in run_setup
    runpy.run_module(filename, run_name='__main__', alter_sys=True)
  File "/usr/lib64/python2.7/runpy.py", line 176, in run_module
    fname, loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 82, in _run_module_code
    mod_name, mod_fname, mod_loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/users/glen/tmp/tmp1pTjZz/wlc-0.5/setup.py", line 25, in <module>
    url='https://github.com/fedora-python/pyp2rpm',
  File "/home/users/glen/tmp/tmp1pTjZz/wlc-0.5/wlc/__init__.py", line 22, in <module>
ImportError: No module named request

package in question info:

glensc commented 7 years ago
[~/relup/wlc] ➔ python2
Python 2.7.11 (default, May  4 2016, 09:58:29) 
[GCC 5.3.0 20151204 (release)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from urllib.request import Request, urlopen
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named request
>>> 
[~/relup/wlc] ➔ python3
Python 3.5.2 (default, Aug 14 2016, 22:33:54) 
[GCC 5.4.0 20160603 (release)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from urllib.request import Request, urlopen
>>> 
[~/relup/wlc] ➔ 

offending line: https://github.com/WeblateOrg/wlc/blob/0.5/wlc/__init__.py#L22

glensc commented 7 years ago

i suppose upstream should be informed not to import libraries from setup.py ... or?

glensc commented 7 years ago

also that package is python3 only https://github.com/WeblateOrg/wlc/commit/e6c637e99d89d13825c29213c3a9620b1c6fe687

and i run pyp2rpm as python2, perhaps pyp2rpm should detect this and fail early?

mcyprian commented 7 years ago

pyp2rpm now tries to execute extract_dist command using alternative python interpreter 116cacee3023d71099b0eb if it fails, and removes failing version from metadata d1597eff843a28d.