Skip to content

Commit d2dfe4e

Browse files
authored
fix: some Python lint issues (#200)
* fix: some Python lint issues * Drop Python end-of-life 3.7
1 parent 1e574ee commit d2dfe4e

File tree

5 files changed

+8
-12
lines changed

5 files changed

+8
-12
lines changed

.github/workflows/python_tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313
runs-on: ${{ matrix.os }}
1414
strategy:
1515
fail-fast: false
16-
max-parallel: 6
16+
max-parallel: 5
1717
matrix:
1818
os: [macos-latest, ubuntu-latest] # , windows-latest]
19-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12-dev"]
19+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12-dev"]
2020
steps:
2121
- uses: actions/checkout@v3
2222
- name: Set up Python ${{ matrix.python-version }}

pylib/gyp/easy_xml.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ def WriteXmlIfChanged(content, path, encoding="utf-8", pretty=False,
121121
if win32 and os.linesep != "\r\n":
122122
xml_string = xml_string.replace("\n", "\r\n")
123123

124-
if sys.version_info >= (3, 11):
125-
default_encoding = locale.getencoding()
126-
else:
124+
try: # getdefaultlocale() was removed in Python 3.11
127125
default_encoding = locale.getdefaultlocale()[1]
126+
except AttributeError:
127+
default_encoding = locale.getencoding()
128128

129129
if default_encoding and default_encoding.upper() != encoding.upper():
130130
xml_string = xml_string.encode(encoding)

pylib/gyp/generator/make.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1989,10 +1989,7 @@ def WriteTarget(
19891989
and self.toolset == "target"
19901990
):
19911991
# On mac, products are created in install_path immediately.
1992-
assert install_path == self.output, "{} != {}".format(
1993-
install_path,
1994-
self.output,
1995-
)
1992+
assert install_path == self.output, f"{install_path} != {self.output}"
19961993

19971994
# Point the target alias to the final binary output.
19981995
self.WriteMakeRule(

pylib/gyp/generator/msvs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ def _GenerateExternalRules(rules, output_dir, spec, sources, options, actions_to
684684
all_outputs.update(OrderedSet(outputs))
685685
# Only use one target from each rule as the dependency for
686686
# 'all' so we don't try to build each rule multiple times.
687-
first_outputs.append(list(outputs)[0])
687+
first_outputs.append(next(iter(outputs)))
688688
# Get the unique output directories for this rule.
689689
output_dirs = [os.path.split(i)[0] for i in outputs]
690690
for od in output_dirs:

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ authors = [
1111
description = "A fork of the GYP build system for use in the Node.js projects"
1212
readme = "README.md"
1313
license = { file="LICENSE" }
14-
requires-python = ">=3.7"
14+
requires-python = ">=3.8"
1515
classifiers = [
1616
"Development Status :: 3 - Alpha",
1717
"Environment :: Console",
@@ -20,7 +20,6 @@ classifiers = [
2020
"Natural Language :: English",
2121
"Programming Language :: Python",
2222
"Programming Language :: Python :: 3",
23-
"Programming Language :: Python :: 3.7",
2423
"Programming Language :: Python :: 3.8",
2524
"Programming Language :: Python :: 3.9",
2625
"Programming Language :: Python :: 3.10",

0 commit comments

Comments
 (0)