From 4ad51ba59c24233e62e68f7c8957041f2ddfd8c0 Mon Sep 17 00:00:00 2001 From: David Hewitt <1939362+davidhewitt@users.noreply.github.com> Date: Mon, 9 Nov 2020 15:53:45 +0000 Subject: [PATCH 1/3] Release 0.11.5 --- .github/workflows/ci.yml | 2 +- CHANGELOG.md | 4 ++++ html-py-ever/requirements-dev.txt | 2 +- setup.py | 4 +++- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3aa36c3c..93980051 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: [3.6, 3.7, 3.8, 3.9, pypy3] + python-version: [3.5, 3.6, 3.7, 3.8, 3.9, pypy3] steps: - uses: actions/checkout@master - name: Setup python diff --git a/CHANGELOG.md b/CHANGELOG.md index 033db71d..46058d61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 0.11.5 (2020-11-09) + + - Fix support for Python 3.5. [#86](https://github.com/PyO3/setuptools-rust/pull/86) + ## 0.11.4 (2020-11-03) - Fix `tomlgen` functionality on Windows. [#78](https://github.com/PyO3/setuptools-rust/pull/78) diff --git a/html-py-ever/requirements-dev.txt b/html-py-ever/requirements-dev.txt index 2738d726..602163c8 100644 --- a/html-py-ever/requirements-dev.txt +++ b/html-py-ever/requirements-dev.txt @@ -1,5 +1,5 @@ setuptools -setuptools-rust +-e ../ # use local setuptools-rust package wheel pytest-benchmark[historgram] pytest>=3.6 diff --git a/setup.py b/setup.py index 25536050..d240c0fd 100755 --- a/setup.py +++ b/setup.py @@ -3,4 +3,6 @@ from setuptools import setup if __name__ == "__main__": - setup() + setup( + python_requires='>=3.5' + ) From 9291ae91f15b111c02491db5640f48b22299f484 Mon Sep 17 00:00:00 2001 From: David Hewitt <1939362+davidhewitt@users.noreply.github.com> Date: Mon, 9 Nov 2020 17:25:35 +0000 Subject: [PATCH 2/3] Fix html-py-ever in CI --- .github/workflows/ci.yml | 20 +++++++++----------- html-py-ever/MANIFEST.in | 2 ++ html-py-ever/README.md | 2 +- html-py-ever/pyproject.toml | 2 -- html-py-ever/requirements-dev.txt | 7 ------- html-py-ever/setup.py | 22 +++++----------------- html-py-ever/test/test_parsing.py | 8 ++++++-- html-py-ever/test/test_selector.py | 8 ++++++-- html-py-ever/tox.ini | 11 +++++++++++ 9 files changed, 40 insertions(+), 42 deletions(-) create mode 100644 html-py-ever/MANIFEST.in delete mode 100644 html-py-ever/pyproject.toml delete mode 100644 html-py-ever/requirements-dev.txt create mode 100644 html-py-ever/tox.ini diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 93980051..6f83fae2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,11 +23,6 @@ jobs: toolchain: stable override: true - # Install dependencies on ubuntu - - if: matrix.os == 'ubuntu-latest' - name: Install build dependencies - run: sudo apt-get install -y libxml2-dev libxslt-dev - # Install 32-bit windows target for pypy3 - if: matrix.os == 'windows-latest' && matrix.python-version == 'pypy3' name: Install 32-bit Rust target @@ -48,15 +43,18 @@ jobs: cd example_tomlgen python setup.py tomlgen_rust -w build - # FIXME: Can't test easily on windows 3.9 or pypy because have to build lxml from source! + # Install lxml build dependencies on ubuntu for pypy + - if: matrix.os == 'ubuntu-latest' && matrix.python-version == 'pypy3' + name: Install lxml build dependencies + run: sudo apt-get install -y libxml2-dev libxslt-dev + + # Can't test easily on windows pypy because have to build lxml from source! - name: Test html-py-ever - if: ${{ !(matrix.os == 'windows-latest' && (matrix.python-version == 'pypy3' || matrix.python-version == '3.9-dev')) }} + if: ${{ !(matrix.os == 'windows-latest' && matrix.python-version == 'pypy3') }} shell: bash run: | - cd html-py-ever - pip install -r requirements-dev.txt - python setup.py install - cd test && pytest + pip install tox + tox -c html-py-ever -e py - name: Test other examples shell: bash diff --git a/html-py-ever/MANIFEST.in b/html-py-ever/MANIFEST.in new file mode 100644 index 00000000..7c68298b --- /dev/null +++ b/html-py-ever/MANIFEST.in @@ -0,0 +1,2 @@ +include Cargo.toml +recursive-include src * diff --git a/html-py-ever/README.md b/html-py-ever/README.md index 07a2e45c..ba3fbd2d 100644 --- a/html-py-ever/README.md +++ b/html-py-ever/README.md @@ -8,7 +8,7 @@ Demoing hot to use [html5ever](https://github.com/servo/html5ever) through [kuch ## Benchmarking -Create a python 3.6+ venv and activate it. Install html-py-ever in there (`python setup.py install`). To get a readable benchmark, run `test/run_all.py`. To get a real benchmark, run `pytest test_parsing.py` or `pytest test_selector.py`. Both have a `--benchmark-histogram` option. +Run `tox -e py`. ## Example benchmark results diff --git a/html-py-ever/pyproject.toml b/html-py-ever/pyproject.toml deleted file mode 100644 index 31ffe048..00000000 --- a/html-py-ever/pyproject.toml +++ /dev/null @@ -1,2 +0,0 @@ -[build-system] -requires = ["setuptools", "wheel", "setuptools-rust"] diff --git a/html-py-ever/requirements-dev.txt b/html-py-ever/requirements-dev.txt deleted file mode 100644 index 602163c8..00000000 --- a/html-py-ever/requirements-dev.txt +++ /dev/null @@ -1,7 +0,0 @@ -setuptools --e ../ # use local setuptools-rust package -wheel -pytest-benchmark[historgram] -pytest>=3.6 -beautifulsoup4 -lxml diff --git a/html-py-ever/setup.py b/html-py-ever/setup.py index 313ef313..6093c4b4 100755 --- a/html-py-ever/setup.py +++ b/html-py-ever/setup.py @@ -2,21 +2,7 @@ import sys from setuptools import setup - -try: - from setuptools_rust import RustExtension -except ImportError: - import subprocess - - errno = subprocess.call([sys.executable, "-m", "pip", "install", "setuptools-rust"]) - if errno: - print("Please install setuptools-rust package") - raise SystemExit(errno) - else: - from setuptools_rust import RustExtension - -setup_requires = ["setuptools-rust>=0.10.1", "wheel"] -install_requires = [] +from setuptools_rust import RustExtension setup( name="html-py-ever", @@ -31,9 +17,11 @@ "Operating System :: MacOS :: MacOS X", ], packages=["html_py_ever"], + install_requires=[ + "beautifulsoup4", + "lxml" + ], rust_extensions=[RustExtension("html_py_ever.html_py_ever")], - install_requires=install_requires, - setup_requires=setup_requires, include_package_data=True, zip_safe=False, ) diff --git a/html-py-ever/test/test_parsing.py b/html-py-ever/test/test_parsing.py index db45105e..02852de1 100755 --- a/html-py-ever/test/test_parsing.py +++ b/html-py-ever/test/test_parsing.py @@ -1,5 +1,6 @@ #!/usr/bin/env python from glob import glob +import os import html_py_ever import pytest @@ -7,6 +8,9 @@ from html_py_ever import Document +HTML_FILES = glob(os.path.join(os.path.dirname(__file__), "*.html")) + + def rust(filename: str) -> Document: return html_py_ever.parse_file(filename) @@ -18,11 +22,11 @@ def python(filename: str) -> BeautifulSoup: return soup -@pytest.mark.parametrize("filename", list(glob("*.html"))) +@pytest.mark.parametrize("filename", HTML_FILES) def test_bench_parsing_rust(benchmark, filename): benchmark(rust, filename) -@pytest.mark.parametrize("filename", list(glob("*.html"))) +@pytest.mark.parametrize("filename", HTML_FILES) def test_bench_parsing_python(benchmark, filename): benchmark(python, filename) diff --git a/html-py-ever/test/test_selector.py b/html-py-ever/test/test_selector.py index cecc2159..ce2c5b56 100755 --- a/html-py-ever/test/test_selector.py +++ b/html-py-ever/test/test_selector.py @@ -1,18 +1,22 @@ #!/usr/bin/env python from glob import glob +import os import html_py_ever import pytest from bs4 import BeautifulSoup -@pytest.mark.parametrize("filename", list(glob("*.html"))) +HTML_FILES = glob(os.path.join(os.path.dirname(__file__), "*.html")) + + +@pytest.mark.parametrize("filename", HTML_FILES) def test_bench_selector_rust(benchmark, filename): document = html_py_ever.parse_file(filename) benchmark(document.select, "a[href]") -@pytest.mark.parametrize("filename", list(glob("*.html"))) +@pytest.mark.parametrize("filename", HTML_FILES) def test_bench_selector_python(benchmark, filename): with open(filename, encoding='utf8') as fp: soup = BeautifulSoup(fp, "html.parser") diff --git a/html-py-ever/tox.ini b/html-py-ever/tox.ini new file mode 100644 index 00000000..5d5aaccd --- /dev/null +++ b/html-py-ever/tox.ini @@ -0,0 +1,11 @@ +[tox] +requires = + setuptools-rust @ file://{toxinidir}/../ + +[testenv] +description = Run the unit tests under {basepython} +deps = + setuptools-rust @ file://{toxinidir}/../ + pytest-benchmark[historgram] + pytest>=3.6 +commands = pytest {posargs} From 1df2ed70a9a8ed8691dbca9afb02b354b7603730 Mon Sep 17 00:00:00 2001 From: David Hewitt <1939362+davidhewitt@users.noreply.github.com> Date: Mon, 9 Nov 2020 22:36:44 +0000 Subject: [PATCH 3/3] further CI fixes --- .github/workflows/ci.yml | 96 ++++++++++--------- CHANGELOG.md | 3 +- .../html-py-ever}/Cargo.lock | 0 .../html-py-ever}/Cargo.toml | 0 .../html-py-ever}/MANIFEST.in | 0 .../html-py-ever}/README.md | 0 .../html-py-ever}/build-wheels.sh | 0 .../html-py-ever}/html_py_ever/__init__.py | 0 .../html-py-ever}/setup.py | 0 .../html-py-ever}/src/lib.rs | 0 .../html-py-ever}/src/main.rs | 0 .../html-py-ever}/test/empty.html | 0 .../html-py-ever}/test/monty-python.html | 0 .../html-py-ever}/test/python.html | 0 .../html-py-ever}/test/run_all.py | 0 .../html-py-ever}/test/rust.html | 0 .../html-py-ever}/test/small.html | 0 .../html-py-ever}/test/test_parsing.py | 0 .../html-py-ever}/test/test_selector.py | 0 .../html-py-ever}/tox.ini | 4 +- examples/namespace_package/Cargo.toml | 2 +- examples/namespace_package/MANIFEST.in | 2 + examples/namespace_package/pyproject.toml | 2 - examples/namespace_package/setup.py | 2 +- .../test_namespace_package.py} | 0 examples/namespace_package/tox.ini | 10 ++ examples/rust_with_cffi/MANIFEST.in | 3 + examples/rust_with_cffi/pyproject.toml | 2 - examples/rust_with_cffi/requirements-dev.txt | 1 - examples/rust_with_cffi/setup.py | 8 +- .../test_rust_with_cffi.py} | 0 examples/rust_with_cffi/tox.ini | 11 +++ .../tomlgen}/.gitignore | 0 .../tomlgen}/README.rst | 0 .../tomlgen}/hello/__init__.py | 0 .../tomlgen}/hello/english/lib.rs | 0 .../tomlgen}/hello/french/lib.rs | 0 .../tomlgen}/setup.cfg | 0 .../tomlgen}/setup.py | 0 examples/tomlgen/tox.ini | 8 ++ setuptools_rust/build.py | 7 +- 41 files changed, 98 insertions(+), 63 deletions(-) rename {html-py-ever => examples/html-py-ever}/Cargo.lock (100%) rename {html-py-ever => examples/html-py-ever}/Cargo.toml (100%) rename {html-py-ever => examples/html-py-ever}/MANIFEST.in (100%) rename {html-py-ever => examples/html-py-ever}/README.md (100%) rename {html-py-ever => examples/html-py-ever}/build-wheels.sh (100%) rename {html-py-ever => examples/html-py-ever}/html_py_ever/__init__.py (100%) rename {html-py-ever => examples/html-py-ever}/setup.py (100%) rename {html-py-ever => examples/html-py-ever}/src/lib.rs (100%) rename {html-py-ever => examples/html-py-ever}/src/main.rs (100%) rename {html-py-ever => examples/html-py-ever}/test/empty.html (100%) rename {html-py-ever => examples/html-py-ever}/test/monty-python.html (100%) rename {html-py-ever => examples/html-py-ever}/test/python.html (100%) rename {html-py-ever => examples/html-py-ever}/test/run_all.py (100%) rename {html-py-ever => examples/html-py-ever}/test/rust.html (100%) rename {html-py-ever => examples/html-py-ever}/test/small.html (100%) rename {html-py-ever => examples/html-py-ever}/test/test_parsing.py (100%) rename {html-py-ever => examples/html-py-ever}/test/test_selector.py (100%) rename {html-py-ever => examples/html-py-ever}/tox.ini (63%) create mode 100644 examples/namespace_package/MANIFEST.in delete mode 100644 examples/namespace_package/pyproject.toml rename examples/namespace_package/{tests.py => tests/test_namespace_package.py} (100%) create mode 100644 examples/namespace_package/tox.ini create mode 100644 examples/rust_with_cffi/MANIFEST.in delete mode 100644 examples/rust_with_cffi/pyproject.toml delete mode 100644 examples/rust_with_cffi/requirements-dev.txt rename examples/rust_with_cffi/{tests.py => tests/test_rust_with_cffi.py} (100%) create mode 100644 examples/rust_with_cffi/tox.ini rename {example_tomlgen => examples/tomlgen}/.gitignore (100%) rename {example_tomlgen => examples/tomlgen}/README.rst (100%) rename {example_tomlgen => examples/tomlgen}/hello/__init__.py (100%) rename {example_tomlgen => examples/tomlgen}/hello/english/lib.rs (100%) rename {example_tomlgen => examples/tomlgen}/hello/french/lib.rs (100%) rename {example_tomlgen => examples/tomlgen}/setup.cfg (100%) rename {example_tomlgen => examples/tomlgen}/setup.py (100%) create mode 100644 examples/tomlgen/tox.ini diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f83fae2..e4b79ee8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,70 +1,75 @@ name: CI -on: - pull_request: {} - push: {} +on: [push] jobs: - test: - runs-on: ${{ matrix.os }} + build: + name: ${{ matrix.python-version }} ${{ matrix.platform.os }}-${{ matrix.platform.python-architecture }} + runs-on: ${{ matrix.platform.os }} strategy: + fail-fast: false # If one platform fails, allow the rest to keep testing. matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - python-version: [3.5, 3.6, 3.7, 3.8, 3.9, pypy3] + python-version: [3.6, 3.7, 3.8, 3.9, pypy3] + platform: [ + { os: "macOS-latest", python-architecture: "x64", rust-target: "x86_64-apple-darwin" }, + { os: "ubuntu-latest", python-architecture: "x64", rust-target: "x86_64-unknown-linux-gnu" }, + { os: "windows-latest", python-architecture: "x64", rust-target: "x86_64-pc-windows-msvc" }, + { os: "windows-latest", python-architecture: "x86", rust-target: "i686-pc-windows-msvc" }, + ] + exclude: + # No 64-bit pypy on windows + - python-version: pypy3 + platform: { os: "windows-latest", python-architecture: "x64" } + # Example rust_with_cffi broken on Python 3.5 for Windows, never mind! + - python-version: 3.5 + platform: { os: "windows-latest" } + steps: - - uses: actions/checkout@master - - name: Setup python + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} + architecture: ${{ matrix.platform.python-architecture }} - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - # Install 32-bit windows target for pypy3 - - if: matrix.os == 'windows-latest' && matrix.python-version == 'pypy3' - name: Install 32-bit Rust target + - name: Install Rust toolchain uses: actions-rs/toolchain@v1 with: - profile: minimal toolchain: stable - override: true - target: i686-pc-windows-msvc + target: ${{ matrix.platform.rust-target }} + profile: minimal + default: true + + - name: Install test dependencies + run: pip install --upgrade tox setuptools - name: Build package run: pip install -e . - - name: Test tomlgen_rust + - name: Test examples + if: matrix.python-version != 'pypy3' shell: bash + env: + PYTHON: ${{ matrix.python-version }} run: | - pip install wheel - cd example_tomlgen - python setup.py tomlgen_rust -w build - - # Install lxml build dependencies on ubuntu for pypy - - if: matrix.os == 'ubuntu-latest' && matrix.python-version == 'pypy3' - name: Install lxml build dependencies - run: sudo apt-get install -y libxml2-dev libxslt-dev + for example_dir in examples/*; do + tox -c $example_dir -e py + done - # Can't test easily on windows pypy because have to build lxml from source! - - name: Test html-py-ever - if: ${{ !(matrix.os == 'windows-latest' && matrix.python-version == 'pypy3') }} + - name: Test examples (pypy) + # FIXME: issues with tox + pypy + windows + if: matrix.python-version == 'pypy3' && matrix.platform.os != 'windows-latest' shell: bash run: | - pip install tox - tox -c html-py-ever -e py + for example_dir in examples/*; do + if [[ $example_dir = "examples/html-py-ever" ]]; then + echo "skipping html-py-ever on pypy3 - lxml is hard to build from source" + continue + fi + + tox -c $example_dir -e py + done - - name: Test other examples - shell: bash - run: | - cd examples/ - # PEP517 build isolation means we don't use the setuptools-rust locally, - # instead it installs from PyPI! - pip install --no-use-pep517 -e rust_with_cffi/ - pip install -r rust_with_cffi/requirements-dev.txt - pytest rust_with_cffi/tests.py test-abi3: runs-on: ${{ matrix.os }} strategy: @@ -91,11 +96,12 @@ jobs: run: | cd examples/rust_with_cffi/ python --version + pip install wheel python setup.py bdist_wheel --py-limited-api=cp35 ls -la dist/ # Now we switch to a differnet Python version and ensure we can install - # the wheel we just buitl. + # the wheel we just built. - name: Setup python uses: actions/setup-python@v2 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index 46058d61..04fb8611 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,9 @@ # Changelog -## 0.11.5 (2020-11-09) +## 0.11.5 (2020-11-10) - Fix support for Python 3.5. [#86](https://github.com/PyO3/setuptools-rust/pull/86) + - Fix further cases of building for 32-bit Python on 64-bit Windows. [#87](https://github.com/PyO3/setuptools-rust/pull/87) ## 0.11.4 (2020-11-03) diff --git a/html-py-ever/Cargo.lock b/examples/html-py-ever/Cargo.lock similarity index 100% rename from html-py-ever/Cargo.lock rename to examples/html-py-ever/Cargo.lock diff --git a/html-py-ever/Cargo.toml b/examples/html-py-ever/Cargo.toml similarity index 100% rename from html-py-ever/Cargo.toml rename to examples/html-py-ever/Cargo.toml diff --git a/html-py-ever/MANIFEST.in b/examples/html-py-ever/MANIFEST.in similarity index 100% rename from html-py-ever/MANIFEST.in rename to examples/html-py-ever/MANIFEST.in diff --git a/html-py-ever/README.md b/examples/html-py-ever/README.md similarity index 100% rename from html-py-ever/README.md rename to examples/html-py-ever/README.md diff --git a/html-py-ever/build-wheels.sh b/examples/html-py-ever/build-wheels.sh similarity index 100% rename from html-py-ever/build-wheels.sh rename to examples/html-py-ever/build-wheels.sh diff --git a/html-py-ever/html_py_ever/__init__.py b/examples/html-py-ever/html_py_ever/__init__.py similarity index 100% rename from html-py-ever/html_py_ever/__init__.py rename to examples/html-py-ever/html_py_ever/__init__.py diff --git a/html-py-ever/setup.py b/examples/html-py-ever/setup.py similarity index 100% rename from html-py-ever/setup.py rename to examples/html-py-ever/setup.py diff --git a/html-py-ever/src/lib.rs b/examples/html-py-ever/src/lib.rs similarity index 100% rename from html-py-ever/src/lib.rs rename to examples/html-py-ever/src/lib.rs diff --git a/html-py-ever/src/main.rs b/examples/html-py-ever/src/main.rs similarity index 100% rename from html-py-ever/src/main.rs rename to examples/html-py-ever/src/main.rs diff --git a/html-py-ever/test/empty.html b/examples/html-py-ever/test/empty.html similarity index 100% rename from html-py-ever/test/empty.html rename to examples/html-py-ever/test/empty.html diff --git a/html-py-ever/test/monty-python.html b/examples/html-py-ever/test/monty-python.html similarity index 100% rename from html-py-ever/test/monty-python.html rename to examples/html-py-ever/test/monty-python.html diff --git a/html-py-ever/test/python.html b/examples/html-py-ever/test/python.html similarity index 100% rename from html-py-ever/test/python.html rename to examples/html-py-ever/test/python.html diff --git a/html-py-ever/test/run_all.py b/examples/html-py-ever/test/run_all.py similarity index 100% rename from html-py-ever/test/run_all.py rename to examples/html-py-ever/test/run_all.py diff --git a/html-py-ever/test/rust.html b/examples/html-py-ever/test/rust.html similarity index 100% rename from html-py-ever/test/rust.html rename to examples/html-py-ever/test/rust.html diff --git a/html-py-ever/test/small.html b/examples/html-py-ever/test/small.html similarity index 100% rename from html-py-ever/test/small.html rename to examples/html-py-ever/test/small.html diff --git a/html-py-ever/test/test_parsing.py b/examples/html-py-ever/test/test_parsing.py similarity index 100% rename from html-py-ever/test/test_parsing.py rename to examples/html-py-ever/test/test_parsing.py diff --git a/html-py-ever/test/test_selector.py b/examples/html-py-ever/test/test_selector.py similarity index 100% rename from html-py-ever/test/test_selector.py rename to examples/html-py-ever/test/test_selector.py diff --git a/html-py-ever/tox.ini b/examples/html-py-ever/tox.ini similarity index 63% rename from html-py-ever/tox.ini rename to examples/html-py-ever/tox.ini index 5d5aaccd..be9fabbf 100644 --- a/html-py-ever/tox.ini +++ b/examples/html-py-ever/tox.ini @@ -1,11 +1,11 @@ [tox] requires = - setuptools-rust @ file://{toxinidir}/../ + setuptools-rust @ file://{toxinidir}/../../ [testenv] description = Run the unit tests under {basepython} deps = - setuptools-rust @ file://{toxinidir}/../ + setuptools-rust @ file://{toxinidir}/../../ pytest-benchmark[historgram] pytest>=3.6 commands = pytest {posargs} diff --git a/examples/namespace_package/Cargo.toml b/examples/namespace_package/Cargo.toml index 6d4bac94..60b81c82 100644 --- a/examples/namespace_package/Cargo.toml +++ b/examples/namespace_package/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "namespace_package_bar" +name = "namespace_package_rust" version = "0.1.0" edition = "2018" diff --git a/examples/namespace_package/MANIFEST.in b/examples/namespace_package/MANIFEST.in new file mode 100644 index 00000000..7c68298b --- /dev/null +++ b/examples/namespace_package/MANIFEST.in @@ -0,0 +1,2 @@ +include Cargo.toml +recursive-include src * diff --git a/examples/namespace_package/pyproject.toml b/examples/namespace_package/pyproject.toml deleted file mode 100644 index 8abb304a..00000000 --- a/examples/namespace_package/pyproject.toml +++ /dev/null @@ -1,2 +0,0 @@ -[build-system] -requires = ["setuptools", "wheel", "setuptools-rust", "cffi"] diff --git a/examples/namespace_package/setup.py b/examples/namespace_package/setup.py index 5e7ecc10..0f9fd97d 100644 --- a/examples/namespace_package/setup.py +++ b/examples/namespace_package/setup.py @@ -7,5 +7,5 @@ version="0.1.0", packages=find_namespace_packages(include=['namespace_package.*']), zip_safe=False, - rust_extensions=[RustExtension("namespace_package.bar", path="Cargo.toml", binding=Binding.PyO3, debug=False)], + rust_extensions=[RustExtension("namespace_package.rust", path="Cargo.toml", binding=Binding.PyO3, debug=False)], ) diff --git a/examples/namespace_package/tests.py b/examples/namespace_package/tests/test_namespace_package.py similarity index 100% rename from examples/namespace_package/tests.py rename to examples/namespace_package/tests/test_namespace_package.py diff --git a/examples/namespace_package/tox.ini b/examples/namespace_package/tox.ini new file mode 100644 index 00000000..5e9f9b33 --- /dev/null +++ b/examples/namespace_package/tox.ini @@ -0,0 +1,10 @@ +[tox] +requires = + setuptools-rust @ file://{toxinidir}/../../ + +[testenv] +description = Run the unit tests under {basepython} +deps = + setuptools-rust @ file://{toxinidir}/../../ + pytest +commands = pytest {posargs} diff --git a/examples/rust_with_cffi/MANIFEST.in b/examples/rust_with_cffi/MANIFEST.in new file mode 100644 index 00000000..0e80770b --- /dev/null +++ b/examples/rust_with_cffi/MANIFEST.in @@ -0,0 +1,3 @@ +include Cargo.toml +include cffi_module.py +recursive-include src * diff --git a/examples/rust_with_cffi/pyproject.toml b/examples/rust_with_cffi/pyproject.toml deleted file mode 100644 index 8abb304a..00000000 --- a/examples/rust_with_cffi/pyproject.toml +++ /dev/null @@ -1,2 +0,0 @@ -[build-system] -requires = ["setuptools", "wheel", "setuptools-rust", "cffi"] diff --git a/examples/rust_with_cffi/requirements-dev.txt b/examples/rust_with_cffi/requirements-dev.txt deleted file mode 100644 index e079f8a6..00000000 --- a/examples/rust_with_cffi/requirements-dev.txt +++ /dev/null @@ -1 +0,0 @@ -pytest diff --git a/examples/rust_with_cffi/setup.py b/examples/rust_with_cffi/setup.py index fcceb49a..f9b3742e 100644 --- a/examples/rust_with_cffi/setup.py +++ b/examples/rust_with_cffi/setup.py @@ -3,12 +3,8 @@ import sys from setuptools import setup - from setuptools_rust import RustExtension -setup_requires = ["setuptools-rust>=0.10.1", "wheel", "cffi"] -install_requires = ["cffi"] - setup( name="rust-with-cffi", version="0.1.0", @@ -30,8 +26,8 @@ ), ], cffi_modules=["cffi_module.py:ffi"], - install_requires=install_requires, - setup_requires=setup_requires, + install_requires=["cffi"], + setup_requires=["cffi"], include_package_data=True, zip_safe=False, ) diff --git a/examples/rust_with_cffi/tests.py b/examples/rust_with_cffi/tests/test_rust_with_cffi.py similarity index 100% rename from examples/rust_with_cffi/tests.py rename to examples/rust_with_cffi/tests/test_rust_with_cffi.py diff --git a/examples/rust_with_cffi/tox.ini b/examples/rust_with_cffi/tox.ini new file mode 100644 index 00000000..38c971e9 --- /dev/null +++ b/examples/rust_with_cffi/tox.ini @@ -0,0 +1,11 @@ +[tox] +requires = + setuptools-rust @ file://{toxinidir}/../../ + +[testenv] +description = Run the unit tests under {basepython} +deps = + setuptools-rust @ file://{toxinidir}/../../ + pytest + cffi +commands = pytest {posargs} diff --git a/example_tomlgen/.gitignore b/examples/tomlgen/.gitignore similarity index 100% rename from example_tomlgen/.gitignore rename to examples/tomlgen/.gitignore diff --git a/example_tomlgen/README.rst b/examples/tomlgen/README.rst similarity index 100% rename from example_tomlgen/README.rst rename to examples/tomlgen/README.rst diff --git a/example_tomlgen/hello/__init__.py b/examples/tomlgen/hello/__init__.py similarity index 100% rename from example_tomlgen/hello/__init__.py rename to examples/tomlgen/hello/__init__.py diff --git a/example_tomlgen/hello/english/lib.rs b/examples/tomlgen/hello/english/lib.rs similarity index 100% rename from example_tomlgen/hello/english/lib.rs rename to examples/tomlgen/hello/english/lib.rs diff --git a/example_tomlgen/hello/french/lib.rs b/examples/tomlgen/hello/french/lib.rs similarity index 100% rename from example_tomlgen/hello/french/lib.rs rename to examples/tomlgen/hello/french/lib.rs diff --git a/example_tomlgen/setup.cfg b/examples/tomlgen/setup.cfg similarity index 100% rename from example_tomlgen/setup.cfg rename to examples/tomlgen/setup.cfg diff --git a/example_tomlgen/setup.py b/examples/tomlgen/setup.py similarity index 100% rename from example_tomlgen/setup.py rename to examples/tomlgen/setup.py diff --git a/examples/tomlgen/tox.ini b/examples/tomlgen/tox.ini new file mode 100644 index 00000000..e5b07f58 --- /dev/null +++ b/examples/tomlgen/tox.ini @@ -0,0 +1,8 @@ +[tox] +skipsdist=true + +[testenv] +description = Run the unit tests under {basepython} +deps = + setuptools-rust @ file://{toxinidir}/../../ +commands = python setup.py tomlgen_rust -w build diff --git a/setuptools_rust/build.py b/setuptools_rust/build.py index cdbd88c2..907fb609 100644 --- a/setuptools_rust/build.py +++ b/setuptools_rust/build.py @@ -3,7 +3,6 @@ import json import os import shutil -import platform import sys import subprocess from distutils.cmd import Command @@ -96,8 +95,12 @@ def build_extension(self, ext): # TODO: include --target for all platforms so env vars can't break the build target_triple = None target_args = [] - if platform.machine() == "AMD64" and self.plat_name == "win32": + if self.plat_name == "win32": target_triple = "i686-pc-windows-msvc" + elif self.plat_name == "win-amd64": + target_triple = "x86_64-pc-windows-msvc" + + if target_triple is not None: target_args = ["--target", target_triple] # Find where to put the temporary build files created by `cargo`