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

Fix $(PYTHON) paths for native windows executable or cygwin #34984

Merged
merged 8 commits into from
Mar 4, 2020

Conversation

staticfloat
Copy link
Sponsor Member

We auto-detect by inspecting the output of platform.system()

We auto-detect by inspecting the output of `platform.system()`
@staticfloat staticfloat changed the title $(PYTHON) can be a native windows executable or a cygwin Fix $(PYTHON) paths for native windows executable or cygwin Mar 3, 2020
Make.inc Outdated
@@ -1013,13 +1013,23 @@ endif
# We need python for things like BB triplet recognition. We don't really care
# about version, generally, so just find something that works:
PYTHON := $(shell which python 2>/dev/null || which python3 2>/dev/null || which python2 2>/dev/null || echo not found)
PYTHON_SYSTEM := $(PYTHON) -c 'from __future__ import print_function; import platform; print(platform.system())'
ifneq ($(filter $(call lowercase,$(PYTHON_SYSTEM)),cygwin),)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$(shell $(PYTHON_SYSTEM))?

Make.inc Outdated
# If we're running on Cygwin, but using a native-windows Python, we need to use cygpath -w
ifneq ($(and $(filter $(PYTHON_SYSTEM),Windows),$(findstring CYGWIN,$(BUILD_OS))),)
define invoke_python
$(PYTHON) "$(shell cygpath -w "$(1)")"
Copy link
Sponsor Member

@vtjnash vtjnash Mar 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$(PYTHON) "$(shell cygpath -w "$(1)")"
$(PYTHON) "$${cygpath -w \"$(1)\"}"

Copy link
Sponsor Member Author

@staticfloat staticfloat Mar 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what the curly braces here mean? Delaying the expansion seems right though.

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're the same as backticks for the shell

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get "bad substitution" when I try that, because the $$ escapes it all the way down to bash. Here's an example:

$ cat Makefile 
define foo
echo $${echo $(1) | grep b}
endef

all:
        $(call foo,bar)
$ make
echo ${echo bar | grep b}
/bin/sh: ${echo bar | grep b}: bad substitution
make: *** [all] Error 1

I think it's sufficient to just use $$(cygpath -w ...).

@staticfloat staticfloat merged commit 0e8143e into master Mar 4, 2020
@staticfloat staticfloat deleted the sf/win_ci_native_python branch March 4, 2020 05:35
KristofferC pushed a commit that referenced this pull request Mar 4, 2020
@KristofferC KristofferC mentioned this pull request Mar 4, 2020
2 tasks
ravibitsgoa pushed a commit to ravibitsgoa/julia that referenced this pull request Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants