fedora-python / pyp2rpm

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

[3.3.2] unable to build numexpr package #183

Open tuxmaster5000 opened 5 years ago

tuxmaster5000 commented 5 years ago

An call to pyp2rpm -o epel7 numexpr only results in: Failed to extract data from setup.py script.

hroncok commented 5 years ago

This is most likely caused by https://github.com/pydata/numexpr/blob/master/requirements.txt having an extra line and https://github.com/pydata/numexpr/blob/364bac13d84524e0e01db892301b2959d822dcff/setup.py#L25 adding an empty requirement to install_requires.

The requirements are now:

['numpy>=1.7', '']

And pyp2rpm blows on the second one with:

WARNING  Unparsable dependency .
Traceback (most recent call last):
  File "/home/churchyard/Dokumenty/RedHat/pyp2rpm/pyp2rpm/dependency_parser.py", line 61, in deps_from_pyp_format
    parsed.append(Requirement.parse(req))
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3088, in parse
    req, = parse_requirements(s)
ValueError: not enough values to unpack (expected 1, got 0)
tuxmaster5000 commented 5 years ago

Can we add an warning an catch empty entry's in the array?

hroncok commented 5 years ago

This project is on life support. If you send a Pull Request, I can review it, but I'm not available to do any fixes now.

hroncok commented 5 years ago

Hint: search for parse_requirements function and add a conditional in there.

tuxmaster5000 commented 5 years ago

For testing I have remove the empty line, but it will not resolve it. Exists there an debug function for it? --help will not shown something like that.

tuxmaster5000 commented 5 years ago

After searching the source code, I found the log file. It will be nicer when the name of the logfile will shown on run.

hroncok commented 5 years ago

I agree.

gordonmessmer commented 4 years ago

In case someone else finds this bug report:

When I run pyp2rpm for numexpr, the log records:

INFO  Downloaded package from PyPI: /tmp/numexpr-2.6.9.tar.gz.
INFO  Getting metadata from setup.py using SetupPyMetadataExtractor.
INFO  Running extract_dist command with: /home/gordon/git/pyp2rpm/.tox/py37/bin/python3
ERROR  Subprocess failed, stdout: , stderr: Traceback (most recent call last):
  File "setup.py", line 228, in <module>
    setup_package()
  File "setup.py", line 65, in setup_package
    from numpy.distutils.core import setup
ModuleNotFoundError: No module named 'numpy'

I think the other failure conditions already have useful error output. If it would be helpful to show the debug logs in this failure condition, I've created PR #203 for consideration.

00willo commented 3 years ago

Just tried this, and the original issue appears resolved. Once you install numpy into the site-packages used by the interpreter, the spec file generates fine. So, no remaining issues.