-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'topic/default/fix-version' into 'branch/default'
Fix version + transonic-get-include See merge request fluiddyn/transonic!132
- Loading branch information
Showing
8 changed files
with
106 additions
and
59 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 |
---|---|---|
|
@@ -4,7 +4,7 @@ build-backend = "pdm.backend" | |
|
||
[project] | ||
name = "transonic" | ||
version = "0.6.0" | ||
version = "0.6.1" | ||
description = "Make your Python code fly at transonic speeds!" | ||
authors = [ | ||
{ name = "Pierre Augier", email = "[email protected]" }, | ||
|
@@ -33,6 +33,7 @@ mpi = ["mpi4py"] | |
|
||
[project.scripts] | ||
transonic = "transonic.run:run" | ||
transonic-get-include = "transonic_cl.get_includes:main" | ||
|
||
[tool.pdm] | ||
package-dir = "src" | ||
|
This file contains 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 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,35 @@ | ||
import argparse | ||
import sys | ||
from pathlib import Path | ||
|
||
from importlib import import_module | ||
|
||
|
||
def main(): | ||
parser = argparse.ArgumentParser( | ||
prog="transonic-get-include", | ||
description="Get include directory for packages", | ||
) | ||
|
||
parser.add_argument("package", type=str, help="Package name") | ||
|
||
args = parser.parse_args() | ||
|
||
try: | ||
mod = import_module(args.package) | ||
except ImportError: | ||
print("ImportError") | ||
sys.exit(1) | ||
|
||
try: | ||
path_include = Path(mod.get_include()) | ||
except AttributeError: | ||
print(f"No {args.package}.get_include") | ||
sys.exit(1) | ||
|
||
try: | ||
path_include = path_include.relative_to(Path.cwd()) | ||
except ValueError: | ||
pass | ||
|
||
print(path_include) |
This file contains 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,22 @@ | ||
import pytest | ||
|
||
from transonic_cl.get_includes import main | ||
|
||
|
||
class MyException(Exception): | ||
pass | ||
|
||
|
||
def test_get_include(monkeypatch): | ||
monkeypatch.setattr("sys.argv", ["transonic-get-include", "numpy"]) | ||
main() | ||
|
||
def _exit(exit_code): | ||
if exit_code == 1: | ||
raise MyException | ||
|
||
monkeypatch.setattr("sys.exit", _exit) | ||
monkeypatch.setattr("sys.argv", ["transonic-get-include", "numpyyyy"]) | ||
|
||
with pytest.raises(MyException): | ||
main() |