Skip to content

Commit

Permalink
Merge pull request #349 from tekktrik/dev/fix-daily-release
Browse files Browse the repository at this point in the history
Dev/fix-daily-release
  • Loading branch information
tekktrik committed Jul 11, 2023
2 parents b417f43 + 97f29e6 commit 012b13e
Show file tree
Hide file tree
Showing 14 changed files with 494 additions and 614 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Expand Up @@ -5,20 +5,20 @@
exclude: patches
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.4.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/fsfe/reuse-tool
rev: v0.12.1
rev: v1.1.2
hooks:
- id: reuse
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/pycqa/pylint
rev: v2.9.3
rev: v2.17.4
hooks:
- id: pylint
name: pylint
Expand Down
747 changes: 478 additions & 269 deletions .pylintrc

Large diffs are not rendered by default.

324 changes: 0 additions & 324 deletions LICENSES/CC-BY-4.0.txt

This file was deleted.

12 changes: 7 additions & 5 deletions adabot/circuitpython_bundle.py
Expand Up @@ -113,7 +113,6 @@ def update_download_stats(bundle_path):
with open(
os.path.join(bundle_path, "circuitpython_library_pypi_stats.md"), "w"
) as md_file:

# Write headers
md_file.write("\n".join(lib_list_header))
md_file.write("\n")
Expand Down Expand Up @@ -285,6 +284,7 @@ def update_bundle(bundle_path):
status = StringIO()
git.status("--short", _out=status)
updates = []
release_required = False
status = status.getvalue().strip()
if status:
for status_line in status.split("\n"):
Expand All @@ -305,6 +305,7 @@ def update_bundle(bundle_path):
url = repo_remote_url(directory)
summary = "\n".join(diff_lines[1:-1])
updates.append((url[:-4], old_commit, new_commit, summary))
release_required = True
os.chdir(working_directory)
lib_list_updates = check_lib_links_md(bundle_path)
if lib_list_updates:
Expand All @@ -321,6 +322,7 @@ def update_bundle(bundle_path):
),
)
)
release_required = True
if update_download_stats(bundle_path):
updates.append(
(
Expand All @@ -334,7 +336,7 @@ def update_bundle(bundle_path):
)
)

return updates
return updates, release_required


def commit_updates(bundle_path, update_info):
Expand Down Expand Up @@ -546,9 +548,9 @@ def new_release(bundle, bundle_path):
bundle_dir = os.path.join(bundles_dir, cp_bundle)
try:
fetch_bundle(cp_bundle, bundle_dir)
updates_needed = update_bundle(bundle_dir)
if updates_needed:
commit_updates(bundle_dir, updates_needed)
updates, release_required = update_bundle(bundle_dir)
if release_required:
commit_updates(bundle_dir, updates)
push_updates(bundle_dir)
new_release(cp_bundle, bundle_dir)
except RuntimeError as e:
Expand Down
1 change: 1 addition & 0 deletions adabot/circuitpython_libraries.py
Expand Up @@ -93,6 +93,7 @@
"Adafruit_Python_Extended_Bus",
]


# pylint: disable=too-many-locals, too-many-branches, too-many-statements
def run_library_checks(validators, kw_args, error_depth):
"""runs the various library checking functions"""
Expand Down
3 changes: 1 addition & 2 deletions adabot/lib/circuitpython_library_validators.py
Expand Up @@ -198,6 +198,7 @@ def uses_token(func):
return func


# pylint: disable=too-many-instance-attributes
class LibraryValidator:
"""Class to hold instance variables needed to traverse the calling
code, and the validator functions.
Expand Down Expand Up @@ -367,7 +368,6 @@ def _filter_file_diffs(filenames):
".pre-commit-config.yaml",
".pylintrc",
".gitignore",
"CODE_OF_CONDUCT.md",
"README.rst",
"pyproject.toml",
}
Expand Down Expand Up @@ -414,7 +414,6 @@ def _filter_file_diffs(filenames):
compare_tags_json = compare_tags.json()
if "status" in compare_tags_json:
if compare_tags_json["status"] != "identical":

filtered_files = _filter_file_diffs(
[file["filename"] for file in compare_tags_json.get("files")]
)
Expand Down
1 change: 1 addition & 0 deletions tests/integration/test_circuitpython_libraries.py
Expand Up @@ -12,6 +12,7 @@

from adabot.lib import circuitpython_library_validators


# pylint: disable=unused-argument
def mock_list_repos(*args, **kwargs):
"""Function to monkeypatch `common_funcs.list_repos()` for a shorter set of repos."""
Expand Down
1 change: 1 addition & 0 deletions tests/integration/test_update_cp_org_libraries.py
Expand Up @@ -12,6 +12,7 @@
from adabot import github_requests
from adabot import update_cp_org_libraries


# pylint: disable=unused-argument
def mock_list_repos(*args, **kwargs):
"""Function to monkeypatch `common_funcs.list_repos()` for a shorter set of repos."""
Expand Down
1 change: 0 additions & 1 deletion tools/ci_status.py
Expand Up @@ -295,7 +295,6 @@ def save_build_statuses(


if __name__ == "__main__":

parser = argparse.ArgumentParser(
description="Check the CI status of the Bundle libraries"
)
Expand Down
1 change: 0 additions & 1 deletion tools/docs_status.py
Expand Up @@ -106,7 +106,6 @@ def check_docs_statuses(


if __name__ == "__main__":

parser = argparse.ArgumentParser(
description="Check the RTD docs build status of the Bundle libraries"
)
Expand Down
1 change: 0 additions & 1 deletion tools/file_compare.py
Expand Up @@ -83,7 +83,6 @@ def compare(git_file: str, token: Optional[str] = None) -> list:


if __name__ == "__main__":

parser = argparse.ArgumentParser(
description="Compare files across the adafruit CircuitPython repos",
)
Expand Down
2 changes: 0 additions & 2 deletions tools/git_functionality.py
Expand Up @@ -132,11 +132,9 @@ def sync_commit_push(
"""

def decorator_sync_commit_push(func):

functools.wraps(func)

def wrapper_sync_commit_push(lib_path: StrPath, *args, **kwargs) -> Any:

# Fetch and pull to repo
sync_and_checkout(lib_path, remote_name, branch_name)

Expand Down
4 changes: 0 additions & 4 deletions tools/iterate_libraries.py
Expand Up @@ -107,13 +107,11 @@ def iter_local_bundle_with_func(

# Loop through each bundle branch
for branch_name in _BUNDLE_BRANCHES:

libraries_glob_path = os.path.join(bundle_path, "libraries", branch_name, "*")
libraries_path_list = glob.glob(libraries_glob_path)

# Enter each library in the bundle
for library_path in libraries_path_list:

iterated.add(os.path.split(library_path)[1].lower())
func_results = perform_func(library_path, func_workflow)

Expand Down Expand Up @@ -164,13 +162,11 @@ def iter_remote_bundle_with_func(

# Loop through each bundle branch
for branch_name in _BUNDLE_BRANCHES:

branch_repos_path = "/".join(("libraries", branch_name))
branch_repos: list[ContentFile] = bundle_repo.get_contents(branch_repos_path)

# Enter each library in the bundle
for repo_file in branch_repos:

repo_name_result: parse.Result = parse.search(
"repos/adafruit/{repo_name:w}/", repo_file.git_url
)
Expand Down
2 changes: 1 addition & 1 deletion tools/library_functions.py
Expand Up @@ -24,6 +24,7 @@
StrPath: TypeAlias = Union[str, os.PathLike[str]]
"""Path or path-like strings"""


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

@functools.wraps(func)
def wrapper_use_lib_path(lib_path: StrPath, *args, **kwargs) -> Any:

# Get the current directory
current_path = os.getcwd()

Expand Down

0 comments on commit 012b13e

Please sign in to comment.