Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a68f21f

Browse files
authored
Merge pull request #23387 from oscargus/removesetuptoolsscmgitarchive
Remove setuptools_scm_git_archive dependency and add sdist test
2 parents 6383e43 + ad74ba4 commit a68f21f

File tree

4 files changed

+92
-3
lines changed

4 files changed

+92
-3
lines changed

.git_archival.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1+
node: $Format:%H$
2+
node-date: $Format:%cI$
3+
describe-name: $Format:%(describe:tags=true)$
14
ref-names: $Format:%D$

.github/workflows/cibuildsdist.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Build CI sdist and wheel
2+
3+
on:
4+
# Save CI by only running this on release branches or tags.
5+
push:
6+
branches:
7+
- main
8+
- v[0-9]+.[0-9]+.x
9+
tags:
10+
- v*
11+
# Also allow running this action on PRs if requested by applying the
12+
# "Run cibuildwheel" label.
13+
pull_request:
14+
types:
15+
- opened
16+
- synchronize
17+
- reopened
18+
- labeled
19+
20+
jobs:
21+
build_sdist:
22+
if: |
23+
github.event_name == 'push' ||
24+
github.event_name == 'pull_request' && (
25+
(
26+
github.event.action == 'labeled' &&
27+
github.event.label.name == 'Run cibuildwheel'
28+
) ||
29+
contains(github.event.pull_request.labels.*.name, 'Run cibuildwheel')
30+
)
31+
name: Build sdist and wheel on ${{ matrix.os }}
32+
runs-on: ${{ matrix.os }}
33+
strategy:
34+
matrix:
35+
os: [ubuntu-20.04]
36+
python-version: ['3.8', '3.9', '3.10', '3.11.0-alpha - 3.11']
37+
38+
steps:
39+
- uses: actions/checkout@v3
40+
with:
41+
fetch-depth: 0
42+
43+
- uses: actions/setup-python@v4
44+
name: Install Python
45+
with:
46+
python-version: ${{ matrix.python-version }}
47+
48+
- name: Install build
49+
run: pip install build
50+
51+
- name: Build sdist and wheel
52+
run: python -m build .
53+
54+
- name: Install built matplotlib sdist
55+
run: pip install dist/matplotlib*.tar.gz
56+
57+
- name: Check version number is not 0
58+
run: python ./ci/check_version_number.py
59+
60+
- name: Install built matplotlib wheel
61+
run: pip install dist/matplotlib*.whl --force-reinstall
62+
63+
- name: Check version number is not 0
64+
run: python ./ci/check_version_number.py

ci/check_version_number.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env python3
2+
3+
"""
4+
Check that the version number of the install Matplotlib does not start with 0
5+
6+
To run:
7+
$ python3 -m build .
8+
$ pip install dist/matplotlib*.tar.gz for sdist
9+
$ pip install dist/matplotlib*.whl for wheel
10+
$ ./ci/check_version_number.py
11+
"""
12+
import matplotlib
13+
14+
import sys
15+
16+
EXIT_SUCCESS = 0
17+
EXIT_FAILURE = 1
18+
19+
20+
print(f"Version {matplotlib.__version__} installed")
21+
if matplotlib.__version__[0] == "0":
22+
sys.exit(EXIT_FAILURE)
23+
sys.exit(EXIT_SUCCESS)

setup.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,7 @@ def make_release_tree(self, base_dir, files):
302302
setup_requires=[
303303
"certifi>=2020.06.20",
304304
"numpy>=1.19",
305-
"setuptools_scm>=4",
306-
"setuptools_scm_git_archive",
305+
"setuptools_scm>=7",
307306
],
308307
install_requires=[
309308
"contourpy>=1.0.1",
@@ -317,7 +316,7 @@ def make_release_tree(self, base_dir, files):
317316
"python-dateutil>=2.7",
318317
] + (
319318
# Installing from a git checkout that is not producing a wheel.
320-
["setuptools_scm>=4"] if (
319+
["setuptools_scm>=7"] if (
321320
Path(__file__).with_name(".git").exists() and
322321
os.environ.get("CIBUILDWHEEL", "0") != "1"
323322
) else []

0 commit comments

Comments
 (0)