[Rpm-maint] [rpm-software-management/rpm] Not all console_scripts entry points need pkg_resources from setuptools (#954)

Miro Hrončok notifications at github.com
Wed Nov 27 20:05:53 UTC 2019


This is a followup after https://github.com/rpm-software-management/rpm/issues/664

Apparently, not all entry_points console_scripts have the pkg_resources import.

It seems to me that packages installed via pip from a wheel have this:

```
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import re
import sys

from pytest import main

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(main())
```

While packages installed via python setup.py install have:

```
#!/usr/bin/python3
# EASY-INSTALL-ENTRY-SCRIPT: 'pytest==...','console_scripts','pytest'
__requires__ = 'pytest==...'
import re
import sys
from pkg_resources import load_entry_point

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(
        load_entry_point('pytest==...', 'console_scripts', 'pytest')()
    )
```

We could do it the proper way:

 - when console_scripts entrypoints are found, grep them for pkg_resources import and only require setuptools if it is in there

Or the heuristic way:

 - when dist-info, don't add setuptools, when egg-info, do add it

The second way is certainly easier and faster, however I am not yet sure whether the situation is that simple

cc @encukou @ignatenkobrain @Conan-Kudo @gordonmessmer 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/954
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20191127/c8ba1a13/attachment-0001.html>


More information about the Rpm-maint mailing list