Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python subprocess invocation to inject setuptools pollutes setuptools argument list #1890

Closed
marcusva opened this issue Jun 23, 2014 · 10 comments
Labels
auto-locked Outdated issues that have been locked by automation good first issue A good item for first time contributors to work on project: setuptools Related to setuptools type: enhancement Improvements to functionality

Comments

@marcusva
Copy link

setuptools (and probably distutils) assume the very first argument from sys.argv to be the executed setup file. Invoking a python subprocess with -c to execute a command will set '-c' to be the very first argument to sys.argv (see the docs). This leads to the manifest_maker warning noted at

r"^warning: manifest_maker: standard file '-c' not found$"]:
and also will cause arguments to the setuptools (or distutils) commands to be polluted with an additional '-c', whether it's wanted or not.

As a workaround, manipulate the argument list prior to exec() in

"import setuptools, tokenize; __file__=%r; exec(compile("
and similar invocations within pip:

import sys, setuptools, tokenize
sys.argv[0] = %r; ....
@koobs
Copy link

koobs commented Jun 23, 2014

For more details, see our review and diff here: https://phabric.freebsd.org/D270

@dstufft
Copy link
Member

dstufft commented Mar 22, 2017

The diff above is no longer available, however this should be pretty easy to fix. It should just require modifying the shim code so that it munges sys.argv to remove the -c and such from it.

@xavfernandez xavfernandez added the good first issue A good item for first time contributors to work on label Mar 22, 2017
@pradyunsg pradyunsg added type: enhancement Improvements to functionality project: setuptools Related to setuptools labels Oct 2, 2017
@kynan
Copy link
Contributor

kynan commented Oct 28, 2018

@bertilhatt are you working on this?

@kynan
Copy link
Contributor

kynan commented Oct 28, 2018

@pradyunsg Please mark as in progress

@kynan
Copy link
Contributor

kynan commented Oct 28, 2018

@bertilhatt you need to claim this issue on http://gg.gg/PyPASprint2018

@bertilhatt
Copy link

Sorry @kynan, the link to gg.gg doesn’t seem to work for me.

I am not working on it anymore.

The pull request is marked as LGTM, so I expect it to go through.

@kynan
Copy link
Contributor

kynan commented Oct 29, 2018

Odd, the short link appears to have expired. https://hackmd.io/JugBUcU6QdCR8QK9fTBfug

@koobs
Copy link

koobs commented Jul 8, 2019

Happy 5 year birthday for this issue (last month)! Thank you for resolving this @cjerdonek :)

FWIW, the review/diff URL mentioned in my earlier comment is now https://reviews.freebsd.org/D270

@cjerdonek
Copy link
Member

@koobs, per your comment on that thread, would a change to setuptools make for a cleaner fix? Is there a corresponding issue in setuptools' tracker?

@koobs
Copy link

koobs commented Jul 8, 2019

@cjerdonek I think the best way to answer that question is wherever the issue is found/reproducible, which at the time of the report, was distutils, setuptools, pip.

I looked through @marcusva's history around the time this issue was created and couldn't see a referenced setuptools bug report

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Aug 7, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Aug 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation good first issue A good item for first time contributors to work on project: setuptools Related to setuptools type: enhancement Improvements to functionality
Projects
None yet
Development

No branches or pull requests

8 participants