Skip to content

Commit 6d57e04

Browse files
authored
Merge branch 'main' into conda-lock-auto-update
2 parents 8be66e3 + ea02033 commit 6d57e04

File tree

4 files changed

+24
-56
lines changed

4 files changed

+24
-56
lines changed

.github/workflows/ci-wheels.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272

7373
- name: "Set MACOSX_DEPLOYMENT_TARGET"
7474
if: startsWith(matrix.os, 'macos')
75-
run: echo "MACOSX_DEPLOYMENT_TARGET=$([[ ${{ matrix.os }} == 'macos-latest' ]] && echo '14.0' || echo '13.0')" >> $GITHUB_ENV
75+
run: echo "MACOSX_DEPLOYMENT_TARGET=$([[ ${{ matrix.os }} == 'macos-latest' ]] && echo '15.0' || echo '13.0')" >> $GITHUB_ENV
7676

7777

7878
- name: "Conda install"

cf_units/tests/test_coding_standards.py

Lines changed: 17 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# This file is part of cf-units and is released under the BSD license.
44
# See LICENSE in the root of the repository for full licensing details.
55

6-
from datetime import datetime
76
from fnmatch import fnmatch
87
from pathlib import Path
98
import subprocess
@@ -29,55 +28,24 @@
2928

3029
@pytest.mark.skipif(not IS_GIT_REPO, reason="Not a git repository.")
3130
class TestLicenseHeaders:
32-
@staticmethod
33-
def whatchanged_parse(whatchanged_output):
34-
"""Returns a generator of tuples of data parsed from
35-
"git whatchanged --pretty='TIME:%at'". The tuples are of the form
36-
``(filename, last_commit_datetime)``
37-
38-
Sample input::
39-
40-
['TIME:1366884020', '',
41-
':000000 100644 0000000... 5862ced... A\tcf_units/cf_units.py']
42-
43-
"""
44-
dt = None
45-
for line in whatchanged_output:
46-
if not line.strip():
47-
continue
48-
elif line.startswith("TIME:"):
49-
dt = datetime.fromtimestamp(int(line[5:]))
50-
else:
51-
# Non blank, non date, line -> must be the lines
52-
# containing the file info.
53-
fname = " ".join(line.split("\t")[1:])
54-
yield fname, dt
55-
56-
@staticmethod
57-
def last_change_by_fname():
58-
"""Return a dictionary of all the files under git which maps to
59-
the datetime of their last modification in the git history.
60-
61-
.. note::
62-
63-
This function raises a ValueError if the repo root does
64-
not have a ".git" folder. If git is not installed on the system,
65-
or cannot be found by subprocess, an IOError may also be raised.
66-
67-
"""
68-
# Call "git whatchanged" to get the details of all the files and when
69-
# they were last changed.
31+
class NongitError(ValueError):
32+
pass
33+
34+
@classmethod
35+
def all_git_filepaths(cls):
36+
"""Return a list of all the files under git."""
7037
output = subprocess.check_output(
71-
["git", "whatchanged", "--pretty=TIME:%ct"], cwd=REPO_DIR
38+
["git", "ls-files"],
39+
cwd=REPO_DIR,
7240
)
73-
output = str(output.decode("ascii"))
74-
output = output.split("\n")
75-
res = {}
76-
for fname, dt in TestLicenseHeaders.whatchanged_parse(output):
77-
if fname not in res or dt > res[fname]:
78-
res[fname] = dt
7941

80-
return res
42+
# Result has one file-path per line.
43+
output_lines = output.decode("ascii").split("\n")
44+
# Strip off any leading+trailing whitespace.
45+
output_lines = [line.strip() for line in output_lines]
46+
# Ignore blank lines.
47+
output_lines = [line for line in output_lines if len(line) > 0]
48+
return output_lines
8149

8250
def test_license_headers(self):
8351
exclude_patterns = (
@@ -89,10 +57,10 @@ def test_license_headers(self):
8957
"cf_units/_udunits2_parser/_antlr4_runtime/*",
9058
)
9159

92-
last_change_by_fname = self.last_change_by_fname()
60+
file_paths = self.all_git_filepaths()
9361

9462
failed = False
95-
for fname in sorted(last_change_by_fname):
63+
for fname in sorted(file_paths):
9664
full_fname = REPO_DIR / fname
9765
if (
9866
full_fname.suffix == ".py"

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
build-backend = "setuptools.build_meta"
66
# Defined by PEP 518
77
requires = [
8-
"setuptools>=45",
9-
"setuptools_scm[toml]>=7.0",
8+
"setuptools>=77.0.3",
9+
"setuptools_scm[toml]>=8.0",
1010
"numpy",
1111
"Cython>=3.0",
1212
]
@@ -18,7 +18,6 @@ authors = [
1818
classifiers = [
1919
"Development Status :: 5 - Production/Stable",
2020
"Intended Audience :: Science/Research",
21-
"License :: OSI Approved :: BSD License",
2221
"Operating System :: OS Independent",
2322
"Programming Language :: Python",
2423
"Programming Language :: Python :: 3 :: Only",
@@ -55,7 +54,8 @@ keywords = [
5554
name = "cf-units"
5655
readme = "README.md"
5756
requires-python = ">=3.10"
58-
license.file = "LICENSE"
57+
license = "BSD-3-Clause"
58+
license-files = ["LICENSE"]
5959

6060
[project.optional-dependencies]
6161
all = ["cf-units[docs,test]"]

requirements/cf-units.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ channels:
55

66
dependencies:
77
# setup dependencies
8-
- setuptools >=45
9-
- setuptools_scm >=7.0
8+
- setuptools >=77.0.3
9+
- setuptools_scm >=8.0
1010
- cython >=3.0
1111
- numpy
1212

0 commit comments

Comments
 (0)