Page MenuHomeFreeBSD

Use a proper argument list in PYDISTUTILS_SETUP
ClosedPublic

Authored by mva on Jun 23 2014, 11:35 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Oct 21, 8:43 PM
Unknown Object (File)
Oct 4 2024, 6:41 PM
Unknown Object (File)
Sep 8 2024, 7:51 AM
Unknown Object (File)
Sep 8 2024, 5:30 AM
Unknown Object (File)
Sep 3 2024, 12:17 AM
Unknown Object (File)
Sep 3 2024, 12:17 AM
Unknown Object (File)
Sep 3 2024, 12:17 AM
Unknown Object (File)
Aug 10 2024, 9:23 PM
Subscribers

Details

Reviewers
mva
sbz
koobs
Group Reviewers
Python
Summary

The PYDISTUTILS_SETUP command does not strip arguments properly, which causes setuptools and distutils to jump to wrong conclusions, since they always will receive a "-c" as first argument (sys.argv[0])

sys.argv[0] however is specified as either

  • being the executed script
  • "-c" for a command

We inject (enforce) a setuptools import in PYDISTUTILS_SETUP, to ensure that every python package follows the same way of being installed. The injection causes the setuptools and distutils command chain to receive "-c" as first argument instead of a setup file. At least setuptools assumes sys.argv[0] to be a file, though, which causes the well-known

warning: manifest_maker: standard file '-c' not found

warning. Some distutils commands however will handle "-c" as a different argument, which may pollute the chosen PYDISTUTILS_*ARGS.
The proposed fix will set the first argument of sys.argv to the defined setup file, which should restore the original and intended behaviour for setuptools and distutils.

On a side note: pip's subprocess calls to inject setuptools also suffer from that bug

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

mva retitled this revision from to Use a proper argument list in PYDISTUTILS_SETUP.
mva updated this object.
mva edited the test plan for this revision. (Show Details)
mva added a reviewer: Python.
mva set the repository for this revision to rP FreeBSD ports repository.
mva added a reviewer: mva.
This revision is now accepted and ready to land.Jun 23 2014, 11:46 AM
sbz added a reviewer: sbz.
sbz added a subscriber: sbz.

lgtm

koobs added a reviewer: koobs.
koobs added a subscriber: koobs.

Looks good @mva, do we want to submit a PR upstream too?

In D270#13, @koobs wrote:

Looks good @mva, do we want to submit a PR upstream too?

pip (https://github.com/pypa/pip) might need the PR, it does not seem to be relevant for the default distutils implementation or setuptools. I did not check the 500 outstanding pip issues for a related one, though. We might just add another issue with our way of fixing things for adoption.

Fixed in pypa/pip today: https://github.com/pypa/pip/issues/1890

Unsure of distutils/setuptools status, but it would 'be nice' to get rid of this hack eventually