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 setupext [backport to 1.4.x] #3510
Conversation
My version actually does check for def getstatusoutput(cmd):
"""Return (status, output) of executing cmd in a shell."""
import os
pipe = os.popen('{ ' + cmd + '; } 2>&1', 'r')
text = pipe.read()
sts = pipe.close()
if sts is None: sts = 0
if text[-1:] == '\n': text = text[:-1]
return sts, text |
Or, we could just use a dummy if it is not available: try:
if sys.version_info[0] < 3:
from commands import getstatusoutput
else:
from subprocess import getstatusoutput
except ImportError:
def getstatusoutput(text):
return 1, '' |
I have merged 1.4.x into master (which may have generated a conflict on the link correction which I think this is the third time it has been fixed). @blink1073 @jbmohler Can you two reach a consensus on how to deal with this? |
The latest reflects what I vote to do. It respects the
|
raise CheckFailed( | ||
"pkg-config information for '%s' could not be found." % | ||
package) | ||
msg = "pkg-config information for '%s' could not be found." |
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 don't think this fits in the spirit of what this function does. It is checking for pkg-config data and not if the header exists. The function which calls this has the responsibility of doing any additional checks (like looking for a header file if that is the correct behavior for the particular dependency).
There was an issue building on windows, but #3503 fixes some of the same things on this PR and now I'm a little unsure what else this PR is addressing. I have a couple of comments in general after reading this in some more detail:
(BTW, getstatusoutput actually exists on windows, but it is known not to work -- I'd vote to call that a bug in the standard library.) |
@cimarronm, does that look better? |
@jbmohler, I added an implementation of |
@jbmohler, I'm back with you on the separate code path way. What do you think now? |
@@ -1003,6 +1011,10 @@ class Png(SetupPackage): | |||
name = "png" | |||
|
|||
def check(self): | |||
if sys.platform == 'win32': | |||
check_include_file(get_include_dirs(), 'png.h', 'png') |
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 merged all of the other branches up into master. This seems to have introduced a conflict here. Can you rebase this PR?
5817724
to
b45be96
Compare
Rebased. |
not quite what I meant, but it seems to have worked. |
Do you not use |
Never mind, it looks right now. Either I was confused or gh was showing me strangely cached results. |
I like this PR -- it errors early now as appropriate & tests just fine on my win7 box. The commit message should more succintly say what it currently is. A very minor grumble is that in Png.check (and Freetype.check), it seems that the check_include_file check and has_include_file check could become the same code. However, I can't see an easy way to get the equivalent flow with the conditionals and exceptions that is really any clearer than what you have. |
Great, unless there are protests I will merge this tomorrow. |
Allow for getstatusoutput on win32 and use INCLUDE and LIB env vars Back off on the use of the environmental variables Pinpointed necessary location for INCLUDE Fix link to matplotlib-winbuild Normalize handling of library location finding Include more paths in the search Restore _check for_pkg_config behavior Implement getstatusoutput on win32 Remove win32 getstatusoutput in favor of explicit check_include_file
b45be96
to
3c99de4
Compare
I updated the commit message and PR description. |
LGTM 👍 good work to improve the build for windows |
BLD : improve setupext.py on windows
BLD : improve setupext.py on windows
cherry-picked as d10e26e |
Indeed. @blink1073 - incidentally do you have any experience of appveyor? (e.g. https://github.com/sunpy/sunpy/blob/master/appveyor.yml) |
@pelson, not personally, but we are looking to add it to scikit-image. |
Cleanup for build process on win32. Detects
libpng
andfreetype
and raises an error if they are not found. Also adds convenience methodget_include_dirs
to capture a pattern that was used several times insetupext.py
.This addresses #3509.