-
-
Notifications
You must be signed in to change notification settings - Fork 26k
FIX Remove temporary filenames from command list. #20220
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @cmarmo.
When we merge this we should open another issue so that we can test against this to avoid breaking the build instructions again.
setup.py
Outdated
@@ -265,7 +265,8 @@ def setup_package(): | |||
package_data={'': ['*.pxd']}, | |||
**extra_setuptools_args) | |||
|
|||
commands = [arg for arg in sys.argv[1:] if not arg.startswith('-')] | |||
commands = [arg for arg in sys.argv[1:] if not arg.startswith('-') and | |||
not arg.startswith('/')] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the /
come from a file-path or something like that? Will this also work on Windows where the file separator is \
?
Eitherway it would be good to add a small comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Windows filenames would even typically start with r"C:\\"
, r"D:\\"
to r"Z:\\"
as often used for shared folders on virtual machines... (I guess r"A:\\"
and r"B:\\"
also would be possible). And maybe r"\\"
as well but I am not 100% sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right sorry, I'm not very good at Windows fixes... This will definitely not work with Windows. I will try harder.
Before #19650 setup.py command line was parsed: if the argument was one in the list then the action was required to succeed without Numpy. After #19650 the list is built excluding arguments starting with |
After deeper reading of the traceback
So I need to check if this is a directory... |
commands = [arg for arg in sys.argv[1:] if not arg.startswith('-')] | ||
# Exclude from the list of arguments options and temporary directories | ||
commands = [arg for arg in sys.argv[1:] if not arg.startswith('-') and | ||
not os.path.isdir(arg)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or even os.path.exists
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am worried about the extra system calls and the facts that we might have other kinds of command arguments that are not file that we should neither treat as commands themselves.
Maybe it would be more robust to do the opposite and explicitly list commands that require numpy. I assume they are
|
But then you just might want revert #19650? |
I think it's worth trying to implement the strategy described in #20220 (comment) in a dedicated PR and run |
Reference Issues/PRs
Fixes #20212
What does this implement/fix? Explain your changes.
#19650 did not exclude temporary filenames from the argument list.
Any other comments?
ping @NicolasHug ? Thanks!