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

Wrong python version is used to run setup.py #73

Closed UnkindPartition closed 7 years ago

UnkindPartition commented 7 years ago

I am trying to package a Python 2-only tool, qiime. I'm getting the following error:

% pyp2rpm -s qiime -b 2  
INFO  Pyp2rpm initialized.
INFO  Using /home/feuerbach/rpmbuild/SOURCES as directory to save source.
INFO  Downloaded package from PyPI: /home/feuerbach/rpmbuild/SOURCES/qiime-1.9.1.tar.gz.
INFO  Getting metadata from setup.py using DistMetadataExtractor.
Traceback (most recent call last):
  File "/bin/pyp2rpm", line 9, in <module>
    load_entry_point('pyp2rpm==3.1.2', 'console_scripts', 'pyp2rpm')()
  File "/usr/lib/python3.5/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3.5/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.5/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3.5/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.5/site-packages/pyp2rpm/bin.py", line 99, in main
    converted = convertor.convert()
  File "/usr/lib/python3.5/site-packages/pyp2rpm/convertor.py", line 83, in convert
    data = self.metadata_extractor.extract_data(self.client)
  File "/usr/lib/python3.5/site-packages/pyp2rpm/convertor.py", line 191, in metadata_extractor
    self.base_python_version)
  File "/usr/lib/python3.5/site-packages/pyp2rpm/metadata_extractors.py", line 394, in __init__
    extract_distribution.run_setup(setup_py, 'bdist_rpm')
  File "/usr/lib/python3.5/site-packages/pyp2rpm/extract_distribution.py", line 82, in run_setup
    runpy.run_module(filename, run_name='__main__', alter_sys=True)
  File "/usr/lib64/python3.5/runpy.py", line 178, in run_module
    mod_name, mod_spec, code = _get_module_details(mod_name)
  File "/usr/lib64/python3.5/runpy.py", line 126, in _get_module_details
    code = loader.get_code(mod_name)
  File "<frozen importlib._bootstrap_external>", line 764, in get_code
  File "<frozen importlib._bootstrap_external>", line 724, in source_to_code
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/tmp/tmpyba5j_gx/qiime-1.9.1/setup.py", line 363
    if all([e not in sys.argv for e in 'egg_info', 'sdist', 'register']):
                                                 ^
SyntaxError: invalid syntax

I may be completely off here, but it seems to me that the error is caused by setup.py being run with Python 3, not Python 2, even though I requested only a Python 2 build.

% rpm -q pyp2rpm 
pyp2rpm-3.1.2-1.fc24.noarch
mcyprian commented 7 years ago

The same problem has been reported before #47.

UnkindPartition commented 7 years ago

Ok, thanks, feel free to close this one then.