Skip to content

Commit 012b13e

Browse files
authored
Merge pull request #349 from tekktrik/dev/fix-daily-release
Dev/fix-daily-release
2 parents b417f43 + 97f29e6 commit 012b13e

14 files changed

+494
-614
lines changed

.pre-commit-config.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@
55
exclude: patches
66
repos:
77
- repo: https://github.com/pre-commit/pre-commit-hooks
8-
rev: v4.0.1
8+
rev: v4.4.0
99
hooks:
1010
- id: end-of-file-fixer
1111
- id: trailing-whitespace
1212
- repo: https://github.com/fsfe/reuse-tool
13-
rev: v0.12.1
13+
rev: v1.1.2
1414
hooks:
1515
- id: reuse
1616
- repo: https://github.com/psf/black
17-
rev: 22.3.0
17+
rev: 23.3.0
1818
hooks:
1919
- id: black
2020
- repo: https://github.com/pycqa/pylint
21-
rev: v2.9.3
21+
rev: v2.17.4
2222
hooks:
2323
- id: pylint
2424
name: pylint

.pylintrc

+478-269
Large diffs are not rendered by default.

LICENSES/CC-BY-4.0.txt

-324
This file was deleted.

adabot/circuitpython_bundle.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ def update_download_stats(bundle_path):
113113
with open(
114114
os.path.join(bundle_path, "circuitpython_library_pypi_stats.md"), "w"
115115
) as md_file:
116-
117116
# Write headers
118117
md_file.write("\n".join(lib_list_header))
119118
md_file.write("\n")
@@ -285,6 +284,7 @@ def update_bundle(bundle_path):
285284
status = StringIO()
286285
git.status("--short", _out=status)
287286
updates = []
287+
release_required = False
288288
status = status.getvalue().strip()
289289
if status:
290290
for status_line in status.split("\n"):
@@ -305,6 +305,7 @@ def update_bundle(bundle_path):
305305
url = repo_remote_url(directory)
306306
summary = "\n".join(diff_lines[1:-1])
307307
updates.append((url[:-4], old_commit, new_commit, summary))
308+
release_required = True
308309
os.chdir(working_directory)
309310
lib_list_updates = check_lib_links_md(bundle_path)
310311
if lib_list_updates:
@@ -321,6 +322,7 @@ def update_bundle(bundle_path):
321322
),
322323
)
323324
)
325+
release_required = True
324326
if update_download_stats(bundle_path):
325327
updates.append(
326328
(
@@ -334,7 +336,7 @@ def update_bundle(bundle_path):
334336
)
335337
)
336338

337-
return updates
339+
return updates, release_required
338340

339341

340342
def commit_updates(bundle_path, update_info):
@@ -546,9 +548,9 @@ def new_release(bundle, bundle_path):
546548
bundle_dir = os.path.join(bundles_dir, cp_bundle)
547549
try:
548550
fetch_bundle(cp_bundle, bundle_dir)
549-
updates_needed = update_bundle(bundle_dir)
550-
if updates_needed:
551-
commit_updates(bundle_dir, updates_needed)
551+
updates, release_required = update_bundle(bundle_dir)
552+
if release_required:
553+
commit_updates(bundle_dir, updates)
552554
push_updates(bundle_dir)
553555
new_release(cp_bundle, bundle_dir)
554556
except RuntimeError as e:

adabot/circuitpython_libraries.py

+1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
"Adafruit_Python_Extended_Bus",
9494
]
9595

96+
9697
# pylint: disable=too-many-locals, too-many-branches, too-many-statements
9798
def run_library_checks(validators, kw_args, error_depth):
9899
"""runs the various library checking functions"""

adabot/lib/circuitpython_library_validators.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ def uses_token(func):
198198
return func
199199

200200

201+
# pylint: disable=too-many-instance-attributes
201202
class LibraryValidator:
202203
"""Class to hold instance variables needed to traverse the calling
203204
code, and the validator functions.
@@ -367,7 +368,6 @@ def _filter_file_diffs(filenames):
367368
".pre-commit-config.yaml",
368369
".pylintrc",
369370
".gitignore",
370-
"CODE_OF_CONDUCT.md",
371371
"README.rst",
372372
"pyproject.toml",
373373
}
@@ -414,7 +414,6 @@ def _filter_file_diffs(filenames):
414414
compare_tags_json = compare_tags.json()
415415
if "status" in compare_tags_json:
416416
if compare_tags_json["status"] != "identical":
417-
418417
filtered_files = _filter_file_diffs(
419418
[file["filename"] for file in compare_tags_json.get("files")]
420419
)

tests/integration/test_circuitpython_libraries.py

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
from adabot.lib import circuitpython_library_validators
1414

15+
1516
# pylint: disable=unused-argument
1617
def mock_list_repos(*args, **kwargs):
1718
"""Function to monkeypatch `common_funcs.list_repos()` for a shorter set of repos."""

tests/integration/test_update_cp_org_libraries.py

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from adabot import github_requests
1313
from adabot import update_cp_org_libraries
1414

15+
1516
# pylint: disable=unused-argument
1617
def mock_list_repos(*args, **kwargs):
1718
"""Function to monkeypatch `common_funcs.list_repos()` for a shorter set of repos."""

tools/ci_status.py

-1
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,6 @@ def save_build_statuses(
295295

296296

297297
if __name__ == "__main__":
298-
299298
parser = argparse.ArgumentParser(
300299
description="Check the CI status of the Bundle libraries"
301300
)

tools/docs_status.py

-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ def check_docs_statuses(
106106

107107

108108
if __name__ == "__main__":
109-
110109
parser = argparse.ArgumentParser(
111110
description="Check the RTD docs build status of the Bundle libraries"
112111
)

tools/file_compare.py

-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ def compare(git_file: str, token: Optional[str] = None) -> list:
8383

8484

8585
if __name__ == "__main__":
86-
8786
parser = argparse.ArgumentParser(
8887
description="Compare files across the adafruit CircuitPython repos",
8988
)

tools/git_functionality.py

-2
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,9 @@ def sync_commit_push(
132132
"""
133133

134134
def decorator_sync_commit_push(func):
135-
136135
functools.wraps(func)
137136

138137
def wrapper_sync_commit_push(lib_path: StrPath, *args, **kwargs) -> Any:
139-
140138
# Fetch and pull to repo
141139
sync_and_checkout(lib_path, remote_name, branch_name)
142140

tools/iterate_libraries.py

-4
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,11 @@ def iter_local_bundle_with_func(
107107

108108
# Loop through each bundle branch
109109
for branch_name in _BUNDLE_BRANCHES:
110-
111110
libraries_glob_path = os.path.join(bundle_path, "libraries", branch_name, "*")
112111
libraries_path_list = glob.glob(libraries_glob_path)
113112

114113
# Enter each library in the bundle
115114
for library_path in libraries_path_list:
116-
117115
iterated.add(os.path.split(library_path)[1].lower())
118116
func_results = perform_func(library_path, func_workflow)
119117

@@ -164,13 +162,11 @@ def iter_remote_bundle_with_func(
164162

165163
# Loop through each bundle branch
166164
for branch_name in _BUNDLE_BRANCHES:
167-
168165
branch_repos_path = "/".join(("libraries", branch_name))
169166
branch_repos: list[ContentFile] = bundle_repo.get_contents(branch_repos_path)
170167

171168
# Enter each library in the bundle
172169
for repo_file in branch_repos:
173-
174170
repo_name_result: parse.Result = parse.search(
175171
"repos/adafruit/{repo_name:w}/", repo_file.git_url
176172
)

tools/library_functions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
StrPath: TypeAlias = Union[str, os.PathLike[str]]
2525
"""Path or path-like strings"""
2626

27+
2728
# pylint: disable=too-few-public-methods
2829
class LocalLibFunc(Protocol):
2930
"""Typing protocol for methods (or callables) that take the following
@@ -65,7 +66,6 @@ def in_lib_path(func: LocalLibFunc) -> LocalLibFunc:
6566

6667
@functools.wraps(func)
6768
def wrapper_use_lib_path(lib_path: StrPath, *args, **kwargs) -> Any:
68-
6969
# Get the current directory
7070
current_path = os.getcwd()
7171

0 commit comments

Comments
 (0)