Skip to content

Commit f29e7b8

Browse files
authored
feat: drop <3.7 (#461)
Signed-off-by: Henry Schreiner <[email protected]>
1 parent e0df1d5 commit f29e7b8

File tree

8 files changed

+19
-77
lines changed

8 files changed

+19
-77
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -153,49 +153,6 @@ jobs:
153153
name: Wheel-manylinux2010-${{ matrix.arch }}
154154
path: ./wheelhouse/*.whl
155155

156-
test_old_pythons:
157-
name: Test wheel with python ${{ matrix.python }}
158-
needs: [build_wheels]
159-
runs-on: windows-latest
160-
strategy:
161-
fail-fast: false
162-
matrix:
163-
python: ["2.7", "3.5"]
164-
steps:
165-
- uses: actions/checkout@v4
166-
- uses: actions/setup-python@v5
167-
if: matrix.python != '2.7'
168-
name: Install Python ${{ matrix.python }}
169-
with:
170-
python-version: ${{ matrix.python }}
171-
172-
- name: Install Python ${{ matrix.python }}
173-
if: matrix.python == '2.7'
174-
shell: bash
175-
run: |
176-
nuget install python2 -Version 2.7.18 -OutputDirectory '${{ runner.temp }}'
177-
echo '${{ runner.temp }}\python2.2.7.18\tools' >> $GITHUB_PATH
178-
179-
- name: Install dependencies
180-
shell: bash
181-
run: |
182-
python -m pip install -U pip
183-
python -m pip install pytest pytest-cov
184-
185-
- uses: actions/download-artifact@v4
186-
with:
187-
name: Wheel-Windows-AMD64
188-
path: wheelhouse
189-
190-
- name: Install wheel
191-
shell: bash
192-
run: |
193-
python -m pip -V
194-
python -m pip install "$(find wheelhouse -name '*.whl')[test]"
195-
196-
- name: Test installed SDist
197-
run: python -m pytest ./tests
198-
199156
build_sdist:
200157
name: Build source distribution
201158
needs: [lint]
@@ -253,7 +210,7 @@ jobs:
253210

254211
check_dist:
255212
name: Check dist
256-
needs: [build_wheels, build_manylinux2010_wheels, test_old_pythons, build_sdist, test_sdist]
213+
needs: [build_wheels, build_manylinux2010_wheels, build_sdist, test_sdist]
257214
runs-on: ubuntu-latest
258215
steps:
259216
- uses: actions/download-artifact@v4

.pre-commit-config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ repos:
1616
- id: mixed-line-ending
1717
- id: requirements-txt-fixer
1818
- id: trailing-whitespace
19-
- id: fix-encoding-pragma
2019

2120
- repo: https://github.com/astral-sh/ruff-pre-commit
2221
rev: "v0.2.2"

noxfile.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
import argparse
32
from pathlib import Path
43

@@ -10,7 +9,6 @@
109
"MACOSX_DEPLOYMENT_TARGET": "10.10",
1110
}
1211

13-
1412
built = ""
1513

1614

pyproject.toml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ classifiers = [
2525
"Typing :: Typed"
2626
]
2727
dynamic = ["version"]
28-
# requires-python = ">=3.7" this is only required to build the wheel. We're still compatible with python 2.7
28+
requires-python = ">=3.7"
2929

3030
[project.urls]
3131
Homepage = "https://cmake.org"
@@ -53,7 +53,7 @@ build-dir = "build/{wheel_tag}"
5353
metadata.version.provider = "scikit_build_core.metadata.setuptools_scm"
5454
ninja.make-fallback = false
5555
sdist.include = ["src/cmake/_version.py"]
56-
wheel.py-api = "py2.py3"
56+
wheel.py-api = "py3"
5757
wheel.expand-macos-universal-tags = true
5858
wheel.install-dir = "cmake/data"
5959

@@ -120,14 +120,11 @@ extend-select = [
120120
]
121121
ignore = [
122122
"PLR09", # Too many X
123-
"RUF005", # Python 3 needed
124-
"B904", # Python 3 needed
125-
"SIM105", # Python 3 needed
126123
]
127124
exclude = ["src/cmake/_version.py"]
128125
flake8-unused-arguments.ignore-variadic-names = true
129126

130127
[tool.ruff.lint.per-file-ignores]
131128
"docs/conf.py" = ["E402"]
132129
"*.pyi" = ["ARG001"]
133-
"noxfile.py" = ["PLW0603"] # Could be fixed if Python 2 dropped
130+
"noxfile.py" = ["PLW0603"]

scripts/update_cmake_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
raise SystemExit(
1818
"requests not available: "
1919
"consider installing it running 'pip install requests'"
20-
)
20+
) from None
2121

2222
ROOT_DIR = os.path.join(os.path.dirname(__file__), "..")
2323

scripts/update_openssl_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
raise SystemExit(
1717
"requests not available: "
1818
"consider installing it running 'pip install requests'"
19-
)
19+
) from None
2020

2121
ROOT_DIR = os.path.join(os.path.dirname(__file__), "..")
2222

src/cmake/__init__.py

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
# -*- coding: utf-8 -*-
21
import os
32
import subprocess
43
import sys
54

6-
if sys.version_info >= (3, 4):
7-
if sys.version_info < (3, 10):
8-
from importlib_metadata import distribution
9-
else:
10-
from importlib.metadata import distribution
5+
if sys.version_info < (3, 10):
6+
from importlib_metadata import distribution
7+
else:
8+
from importlib.metadata import distribution
119

1210
from ._version import version as __version__
1311

@@ -18,20 +16,13 @@ def __dir__():
1816
return __all__
1917

2018

21-
if sys.version_info >= (3, 4):
22-
cmake_executable_path = None
23-
for script in distribution("cmake").files:
24-
if str(script).startswith("cmake/data/bin/cmake"):
25-
if sys.version_info < (3, 6):
26-
# pre-3.6 behavior is strict
27-
resolved_script = script.locate().resolve()
28-
else:
29-
resolved_script = script.locate().resolve(strict=True)
30-
cmake_executable_path = resolved_script.parents[1]
31-
break
32-
CMAKE_DATA = str(cmake_executable_path) if cmake_executable_path else None
33-
else:
34-
CMAKE_DATA = os.path.join(os.path.dirname(__file__), "data")
19+
cmake_executable_path = None
20+
for script in distribution("cmake").files:
21+
if str(script).startswith("cmake/data/bin/cmake"):
22+
resolved_script = script.locate().resolve(strict=True)
23+
cmake_executable_path = resolved_script.parents[1]
24+
break
25+
CMAKE_DATA = str(cmake_executable_path) if cmake_executable_path else None
3526

3627
assert CMAKE_DATA is not None
3728
assert os.path.exists(CMAKE_DATA)
@@ -42,7 +33,7 @@ def __dir__():
4233

4334

4435
def _program(name, args):
45-
return subprocess.call([os.path.join(CMAKE_BIN_DIR, name)] + args, close_fds=False)
36+
return subprocess.call([os.path.join(CMAKE_BIN_DIR, name), *args], close_fds=False)
4637

4738

4839
def cmake():

tests/test_cmake.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
def _run(program, args):
2323
func = getattr(cmake, program)
24-
args = ["%s.py" % program] + args
24+
args = [f"{program}.py", *args]
2525
with push_argv(args), pytest.raises(SystemExit) as excinfo:
2626
func()
2727
assert excinfo.value.code == 0

0 commit comments

Comments
 (0)