Skip to content

Commit c39ffe7

Browse files
authored
Merge pull request #281 from tekktrik/dev/check-for-toml
Swtich adabot over to working with pyproject.toml files
2 parents f0107b4 + 7e2ac71 commit c39ffe7

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

adabot/lib/circuitpython_library_validators.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def get_result(self):
9999
ERROR_MISSING_CODE_OF_CONDUCT = "Missing CODE_OF_CONDUCT.md"
100100
ERROR_MISSING_README_RST = "Missing README.rst"
101101
ERROR_MISSING_READTHEDOCS = "Missing readthedocs.yaml"
102-
ERROR_MISSING_SETUP_PY = "For pypi compatibility, missing setup.py"
102+
ERROR_MISSING_PYPROJECT_TOML = "For pypi compatibility, missing pyproject.toml"
103103
ERROR_MISSING_PRE_COMMIT_CONFIG = "Missing .pre-commit-config.yaml"
104104
ERROR_MISSING_REQUIREMENTS_TXT = "For pypi compatibility, missing requirements.txt"
105105
ERROR_MISSING_BLINKA = (
@@ -209,7 +209,7 @@ def __init__(
209209
self._rtd_yaml_base = None
210210
self.output_file_data = []
211211
self.validate_contents_quiet = kw_args.get("validate_contents_quiet", False)
212-
self.has_setup_py_disabled = set()
212+
self.has_pyproject_toml_disabled = set()
213213
self.keep_repos = keep_repos
214214
self.rtd_subprojects = None
215215
self.core_driver_page = None
@@ -344,7 +344,7 @@ def _filter_file_diffs(filenames):
344344
"LICENSE",
345345
"LICENSES/*",
346346
"*.license",
347-
"setup.py.disabled",
347+
"pyproject.toml.disabled",
348348
".github/workflows/build.yml",
349349
".github/workflows/release.yml",
350350
".pre-commit-config.yaml",
@@ -576,8 +576,8 @@ def _validate_pre_commit_config_yaml(self, file_info):
576576

577577
return errors
578578

579-
def _validate_setup_py(self, file_info):
580-
"""Check setup.py for pypi compatibility"""
579+
def _validate_pyproject_toml(self, file_info):
580+
"""Check prproject.toml for pypi compatibility"""
581581
download_url = file_info["download_url"]
582582
contents = requests.get(download_url, timeout=30)
583583
if not contents.ok:
@@ -646,11 +646,11 @@ def validate_contents(self, repo):
646646
if not self.validate_contents_quiet:
647647
return [ERROR_NEW_REPO_IN_WORK]
648648

649-
if "setup.py.disabled" in files:
650-
self.has_setup_py_disabled.add(repo["name"])
649+
if "pyproject.toml.disabled" in files:
650+
self.has_pyproject_toml_disabled.add(repo["name"])
651651

652652
# if we're only running due to -v, ignore the rest. we only care about
653-
# adding in-work repos to the BUNDLE_IGNORE_LIST and if setup.py is
653+
# adding in-work repos to the BUNDLE_IGNORE_LIST and if pyproject.toml is
654654
# disabled
655655
if self.validate_contents_quiet:
656656
return []
@@ -721,13 +721,13 @@ def validate_contents(self, repo):
721721
else:
722722
errors.append(ERROR_MISSING_PRE_COMMIT_CONFIG)
723723

724-
if "setup.py" in files:
725-
file_info = content_list[files.index("setup.py")]
726-
errors.extend(self._validate_setup_py(file_info))
727-
elif "setup.py.disabled" not in files:
728-
errors.append(ERROR_MISSING_SETUP_PY)
724+
if "pyproject.toml" in files:
725+
file_info = content_list[files.index("pyproject.toml")]
726+
errors.extend(self._validate_pyproject_toml(file_info))
727+
elif "pyproject.toml.disabled" not in files:
728+
errors.append(ERROR_MISSING_PYPROJECT_TOML)
729729

730-
if repo["name"] not in self.has_setup_py_disabled:
730+
if repo["name"] not in self.has_pyproject_toml_disabled:
731731
if "requirements.txt" in files:
732732
file_info = content_list[files.index("requirements.txt")]
733733
errors.extend(self._validate_requirements_txt(repo, file_info))
@@ -1113,7 +1113,7 @@ def validate_in_pypi(self, repo):
11131113
"""prints a list of Adafruit_CircuitPython libraries that are in pypi"""
11141114
if (
11151115
repo["name"] in BUNDLE_IGNORE_LIST
1116-
or repo["name"] in self.has_setup_py_disabled
1116+
or repo["name"] in self.has_pyproject_toml_disabled
11171117
):
11181118
return []
11191119
if not (
@@ -1166,7 +1166,7 @@ def validate_passes_linting(self, repo):
11661166
if not repo["name"].startswith("Adafruit_CircuitPython"):
11671167
return []
11681168

1169-
ignored_py_files = ["setup.py", "conf.py"]
1169+
ignored_py_files = ["conf.py"]
11701170

11711171
desination_type = TemporaryDirectory
11721172
if self.keep_repos:

0 commit comments

Comments
 (0)