-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
TST: Use meson
for testing f2py
#25111
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
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
8d04cbf
MAINT,TST: Use meson for compiler checks [f2py]
HaoZeke 5a2fa25
MAINT: Cache the compiler checks [f2py]
HaoZeke 1fdc2f8
MAINT,TST: Always use meson [f2py]
HaoZeke babda1d
TST: Rework to have a build_meson [f2py]
HaoZeke 278890e
MAINT,TST: Simplify the meson backend [f2py]
HaoZeke 2f1b5c8
TST: Use the build_meson function [f2py]
HaoZeke 9f75919
MAINT,TST: Minor cleanup [f2py]
HaoZeke 73edb6f
TST: Ensure TestDocAdvanced runs with spin [f2py]
HaoZeke 51a760a
TST: Use cleanup meson backend [f2py]
HaoZeke 4da19cf
MAINT,TST: Generalize build_meson [f2py]
HaoZeke 6122eb7
TST: Use a helper for spin tests [f2py]
HaoZeke d678b61
MAINT: Simplify meson backend [f2py]
HaoZeke 0397ee4
TST: Handle unsupported compilers [f2py]
HaoZeke 74934a5
TST: Fix gibberish in [f2py] documentation test
HaoZeke 4154877
CI: Add meson for cygwin runs
HaoZeke fe5bf64
TST: Skips for 32-bit errors [f2py]
HaoZeke 6cdecd0
TST: Skip for cygwin since meson is old [f2py]
HaoZeke dd6f221
CI: Revert grabbing meson on cygwin
HaoZeke ef17ab5
TST: Cleanup old distutils builder [f2py]
HaoZeke 8d7ec08
TST: Skip cygwin better [f2py]
HaoZeke b0f418e
TST: Don't touch distutils
HaoZeke 5bce3b4
MAINT: Vendor in distutils testing requirement
HaoZeke 9fc2006
TST: Try removing cygwin restrictions
HaoZeke 2ac2902
MAINT: Cleanup some tests [f2py]
HaoZeke 63cbffb
TST: Try to use concurrency for i/o bounds [f2py]
HaoZeke 64f4fd2
TST: Mark slow tests [f2py]
HaoZeke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# Kanged out of numpy.f2py.tests.util for test_build_ext | ||
from numpy.testing import IS_WASM | ||
import textwrap | ||
import shutil | ||
import tempfile | ||
import os | ||
import re | ||
import subprocess | ||
import sys | ||
|
||
# | ||
# Check if compilers are available at all... | ||
# | ||
|
||
_compiler_status = None | ||
|
||
|
||
def _get_compiler_status(): | ||
global _compiler_status | ||
if _compiler_status is not None: | ||
return _compiler_status | ||
|
||
_compiler_status = (False, False, False) | ||
if IS_WASM: | ||
# Can't run compiler from inside WASM. | ||
return _compiler_status | ||
|
||
# XXX: this is really ugly. But I don't know how to invoke Distutils | ||
# in a safer way... | ||
code = textwrap.dedent( | ||
f"""\ | ||
import os | ||
import sys | ||
sys.path = {repr(sys.path)} | ||
|
||
def configuration(parent_name='',top_path=None): | ||
global config | ||
from numpy.distutils.misc_util import Configuration | ||
config = Configuration('', parent_name, top_path) | ||
return config | ||
|
||
from numpy.distutils.core import setup | ||
setup(configuration=configuration) | ||
|
||
config_cmd = config.get_config_cmd() | ||
have_c = config_cmd.try_compile('void foo() {{}}') | ||
print('COMPILERS:%%d,%%d,%%d' %% (have_c, | ||
config.have_f77c(), | ||
config.have_f90c())) | ||
sys.exit(99) | ||
""" | ||
) | ||
code = code % dict(syspath=repr(sys.path)) | ||
|
||
tmpdir = tempfile.mkdtemp() | ||
try: | ||
script = os.path.join(tmpdir, "setup.py") | ||
|
||
with open(script, "w") as f: | ||
f.write(code) | ||
|
||
cmd = [sys.executable, "setup.py", "config"] | ||
p = subprocess.Popen( | ||
cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=tmpdir | ||
) | ||
out, err = p.communicate() | ||
finally: | ||
shutil.rmtree(tmpdir) | ||
|
||
m = re.search(rb"COMPILERS:(\d+),(\d+),(\d+)", out) | ||
if m: | ||
_compiler_status = ( | ||
bool(int(m.group(1))), | ||
bool(int(m.group(2))), | ||
bool(int(m.group(3))), | ||
) | ||
# Finished | ||
return _compiler_status | ||
|
||
|
||
def has_c_compiler(): | ||
return _get_compiler_status()[0] | ||
|
||
|
||
def has_f77_compiler(): | ||
return _get_compiler_status()[1] | ||
|
||
|
||
def has_f90_compiler(): | ||
return _get_compiler_status()[2] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is this required for this PR?
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.
For F2PY, yes, these tests are currently skipped, but for
meson
and F2PY, not really..