fedora-python / pyp2rpm

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

Name conversion is too complex #278

Open gordonmessmer opened 2 years ago

gordonmessmer commented 2 years ago

Name conversion is hard to understand, especially since names are converted once in Convertor.name_convertor() during metadata extraction, and then again during spec template rendering, by the dependencies macro in pyp2rpm/templates/macros.spec. The first name conversion may use one of several classes, but the final conversion always uses the base NameConvertor class (in pyp2rpm/filters.py)

Consider keeping dependencies in their raw format until template rendering time, and then converting them once, or converting them during metadata extraction, but not both.

Additionally, consider whether retaining the DandifiedNameConvertor makes sense. It's only available when the "dnf" python module is, but is never used when the output is for fedora or mageia. It searches the repositories defined on the host where it runs, rather than the target system. Its output is less stable than is probably desirable, there are too few scenarios where it will be used, and too many scenarios where it will produce the wrong result.