Re: Deal with pip setup.py name and rpm packaging

Petr Viktorin <[email protected]> Wed, 15 Jan 2020 11:55:05 +0100
Newsgroups gmane.comp.python.distutils.devel,gmane.linux.redhat.fedora.python
Message-ID <[email protected]>
On 2020-01-15 10:33, Marco Favero wrote:
> Hello,
> 
>    recently I started to develop a tool in python.
> I discovered pip and setuptool with setup.py. It's fantastic! I can provide packaging  to pypi and to rpm all in a row.
> I follow these guidelines:
> - https://packaging.python.org/tutorials/packaging-projects/#generating-distribution-archives
> - https://docs.python.org/3/distutils/builtdist.html?highlight=rpm
> - https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/
> 
> With %{?python_enable_dependency_generator} the RPM provides the dependecies itself. Fantastic!
> 
> But how to force the developers to use consistent names? :D
> 
> For instance these python-magic and redis client packages:
> 
>    https://pypi.org/project/python-magic
>    https://pypi.org/project/redis/
> 
> use names which conflict with already existent rpm packages names. In particular, "redis" in rpm is the name of the Redis server package! If I make "bdist_rpm" of python Redis client and I "yum install" the package I damage my system deleting the Redis server!
> The Redis client developer says that he can't change the name because this will break existent installations:
> https://github.com/andymccurdy/redis-py/pull/385
> 
> I think this is not a good situation. Python environment should help to improve an "inconsistent" setup.
> 
> As a result, I have to make bdist_rpm of the dependencies, then I have to install the source rpm, change the name in SPEC file and rebuild the rpm package. In my package I can't use %{?python_enable_dependency_generator}, because it uses the fault pypi names, I have to provide them myself. :(
> 
> Thank you for reading this noise
> Have a fantastic python day

Hi!
Guessing by the guideline you follow, you're packaging for Fedora. It 
would be best to use the [email protected] mailing 
list for that.

PyPI and distro repositories are different namespaces. They contain 
different packages (Python packages vs. distro-maintained ones in any 
language). They're governed by different people and different 
guidelines. The packages are often maintained by different people 
(developers vs. distro maintainers).
It would be great if the names for similar things were similar across 
namespaces, but it's not feasible to always be in sync.

To solve this issue, Fedora uses virtual provides. A RPM with a package 
from PyPI should provide:

     python3.7dist(<name on PiPI>) = <version>

... and any packages can depend on that. That's what the Python 
dependency generator uses; the names of RPMs are not relevant.
For the name of the RPM, it's conventional to use "python3-<name on 
PYPI>", but you can use something else to prevent conflicts.

The bdist_rpm command is unlikely to be improved. It will give you a RPM 
that can probably be installed, but doesn't really conform to any distro 
guidelines. It's also part of setuptools, which is quite hard to work on 
and is being slowly deprecated.

You could try pyp2rpm ( https://github.com/fedora-python/pyp2rpm ), 
which generates a spec file that you can then edit.
--
Distutils-SIG mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/distutils-sig.python.org/
Message archived at https://mail.python.org/archives/list/[email protected]/message/BAKFPGNGD3PUWK2SUS2MNAOMSEUI2N2L/