From de41961d90d97193e2a1e70218c1f4d4d95ae19d Mon Sep 17 00:00:00 2001 From: messense Date: Sun, 17 Jul 2022 08:53:13 +0800 Subject: [PATCH] Add support for invoking with `python3 -m maturin` --- .github/workflows/test.yml | 2 ++ Changelog.md | 1 + maturin/__main__.py | 9 +++++++++ 3 files changed, 12 insertions(+) create mode 100644 maturin/__main__.py diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 907ace6c7..e6a021d1a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -385,6 +385,8 @@ jobs: if: steps.changes.outputs.changed == 'true' - run: maturin --version if: steps.changes.outputs.changed == 'true' + - run: python3 -m maturin --version + if: steps.changes.outputs.changed == 'true' - name: Upload wheel artifacts if: steps.changes.outputs.changed == 'true' uses: actions/upload-artifact@v2 diff --git a/Changelog.md b/Changelog.md index 08862be1e..dd6c55621 100644 --- a/Changelog.md +++ b/Changelog.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] * Add 64-bit RISC-V support by felixonmars in [#1001](https://github.com/PyO3/maturin/pull/1001) +* Add support for invoking with `python3 -m maturin` in [#1008](https://github.com/PyO3/maturin/pull/1008) ## [0.13.0] - 2022-07-09 diff --git a/maturin/__main__.py b/maturin/__main__.py new file mode 100644 index 000000000..6c2cdde0e --- /dev/null +++ b/maturin/__main__.py @@ -0,0 +1,9 @@ +import os +import sys +from pathlib import Path +import sysconfig + +if __name__ == "__main__": + scripts_dir = sysconfig.get_path("scripts") + maturin = Path(scripts_dir) / "maturin" + os.execv(maturin, [str(maturin)] + sys.argv[1:])