macports / upt-macports

The Universal Packaging Tool (upt) backend for MacPorts
https://framagit.org/upt/upt
BSD 3-Clause "New" or "Revised" License
8 stars 12 forks source link

setuptools #15

Closed Korusuke closed 2 years ago

Korusuke commented 5 years ago

In some cases setuptools is returned both in build and lib which should not be there.

Test ports: py-zope-deprecation (pypi_name : zope-deprecation) py-buildbot-pkg (pypi_name : buildbot-pkg) py-fs (pypi_name : fs)

mojca commented 5 years ago

Note that some ports might in fact need this at runtime, and it's valid to have it both for runtime and build, it's just strange to have it for build + lib as that's overlapping.

But I assume that most of the python dependencies are in fact runtime dependencies rather than libraries being linked against, so it might as well be a nomenclature issue.

reneeotten commented 5 years ago

I think we could/should do a few things to alert the maintainer to double check: 1) add a note stating that (a) we add setuptools by default to depends_build since PyPI doesn't provide the information and it's actually most often -but not always- true, (b) that if the package installs a console_script it should instead be added to depends_lib. Right now we cannot do much more I think and it's up to the maintainer to make sure. 2) if upt tells us that it's a depends_lib dependency we should not add it as build-dependency (but again the maintainer should check if it's actually true).

jmroot commented 5 years ago

(b) that if the package installs a console_script it should instead be added to depends_lib

Using entry_points will also create a runtime dependency on pkg_resources.

reneeotten commented 5 years ago

thanks Josh, that's indeed true and should be included in the comment. @Steap do you think my suggestions above make sense or is there anything else to consider? @Korusuke you could probably draft a PR to resolve this?

For example, if the json data from PyPI doesn't provide this, could we just parse the setup.py/setup.cfg file(s) and check for the occurrence of setuptools being imported and the existence of console_script or entry_points to get the information with respect to build/lib-dependencies correct?

Steap commented 5 years ago

I'm not sure whether 1)b) can easily be detected.

reneeotten commented 5 years ago

@Korusuke okay, so short-term we can add a comment for in the python.Portfile regarding py-setuptools and remove the depends_build-append in the template when upt detects it as depends_lib. We can later see if we want to parse the setup.py/setup.cfg (could be done in the MacPorts backend).