From 4279171f4778c853c13011fad901f3e81d743961 Mon Sep 17 00:00:00 2001 From: Juan Altmayer Pizzorno Date: Fri, 12 Apr 2024 16:50:26 -0400 Subject: [PATCH] - making builds for Python 3.12+ "pure" Python, as these use sys.monitoring and no longer need a native probe; --- .github/workflows/build-and-upload.yml | 7 ++++--- setup.py | 8 +++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-and-upload.yml b/.github/workflows/build-and-upload.yml index 5923b45..4a29a92 100644 --- a/.github/workflows/build-and-upload.yml +++ b/.github/workflows/build-and-upload.yml @@ -30,14 +30,15 @@ jobs: container: ${{ matrix.container }} strategy: matrix: - python_version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + python_version: ['3.8', '3.9', '3.10', '3.11'] os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] include: - os: ubuntu-latest container: quay.io/pypa/manylinux2014_x86_64 # https://github.com/pypa/manylinux + # just need ONE build from 3.12 onwards; also only one needs to upload sources - os: macos-latest - python_version: 3.8 - upload_source: true # just need ONE of them to do it + python_version: 3.12 + upload_source: true steps: - uses: actions/checkout@v3 diff --git a/setup.py b/setup.py index 2c092a0..bcdc816 100644 --- a/setup.py +++ b/setup.py @@ -8,6 +8,7 @@ def get_version(): v = re.findall(r"\nVERSION *= *\"([^\"]+)\"", Path("src/slipcover/slipcover.py").read_text())[0] return v +PYTHON_VERSION = sys.version_info[0:2] VERSION = get_version() REPO_URL = "https://github.com/plasma-umass/slipcover" @@ -74,7 +75,7 @@ def limited_api_args(): language='c++', ) -if sys.argv[1].startswith('bdist') and sys.platform == 'darwin' and \ +if sys.argv[1].startswith('bdist') and sys.platform == 'darwin' and PYTHON_VERSION < (3,12) and\ sum(arg == '-arch' for arg in platform_compile_args()) > 1: # Build universal wheels on MacOS. # --- @@ -99,8 +100,9 @@ def limited_api_args(): license="Apache License 2.0", packages=['slipcover'], package_dir={'': 'src'}, - ext_modules=([probe]), - python_requires=">=3.8,<3.14", + ext_modules=([probe] if PYTHON_VERSION < (3,12) else []), + python_requires=f">=3.{PYTHON_VERSION[1]},<3.{PYTHON_VERSION[1]+1}" if PYTHON_VERSION < (3,12) \ + else ">=3.12,<3.14", install_requires=[ "tabulate" ],