Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions adabot/lib/circuitpython_library_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def get_result(self):
ERROR_MISSING_CODE_OF_CONDUCT = "Missing CODE_OF_CONDUCT.md"
ERROR_MISSING_README_RST = "Missing README.rst"
ERROR_MISSING_READTHEDOCS = "Missing readthedocs.yaml"
ERROR_MISSING_SETUP_PY = "For pypi compatibility, missing setup.py"
ERROR_MISSING_PYPROJECT_TOML = "For pypi compatibility, missing pyproject.toml"
ERROR_MISSING_PRE_COMMIT_CONFIG = "Missing .pre-commit-config.yaml"
ERROR_MISSING_REQUIREMENTS_TXT = "For pypi compatibility, missing requirements.txt"
ERROR_MISSING_BLINKA = (
Expand Down Expand Up @@ -209,7 +209,7 @@ def __init__(
self._rtd_yaml_base = None
self.output_file_data = []
self.validate_contents_quiet = kw_args.get("validate_contents_quiet", False)
self.has_setup_py_disabled = set()
self.has_pyproject_toml_disabled = set()
self.keep_repos = keep_repos
self.rtd_subprojects = None
self.core_driver_page = None
Expand Down Expand Up @@ -344,7 +344,7 @@ def _filter_file_diffs(filenames):
"LICENSE",
"LICENSES/*",
"*.license",
"setup.py.disabled",
"pyproject.toml.disabled",
".github/workflows/build.yml",
".github/workflows/release.yml",
".pre-commit-config.yaml",
Expand Down Expand Up @@ -576,8 +576,8 @@ def _validate_pre_commit_config_yaml(self, file_info):

return errors

def _validate_setup_py(self, file_info):
"""Check setup.py for pypi compatibility"""
def _validate_pyproject_toml(self, file_info):
"""Check prproject.toml for pypi compatibility"""
download_url = file_info["download_url"]
contents = requests.get(download_url, timeout=30)
if not contents.ok:
Expand Down Expand Up @@ -646,11 +646,11 @@ def validate_contents(self, repo):
if not self.validate_contents_quiet:
return [ERROR_NEW_REPO_IN_WORK]

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

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

if "setup.py" in files:
file_info = content_list[files.index("setup.py")]
errors.extend(self._validate_setup_py(file_info))
elif "setup.py.disabled" not in files:
errors.append(ERROR_MISSING_SETUP_PY)
if "pyproject.toml" in files:
file_info = content_list[files.index("pyproject.toml")]
errors.extend(self._validate_pyproject_toml(file_info))
elif "pyproject.toml.disabled" not in files:
errors.append(ERROR_MISSING_PYPROJECT_TOML)

if repo["name"] not in self.has_setup_py_disabled:
if repo["name"] not in self.has_pyproject_toml_disabled:
if "requirements.txt" in files:
file_info = content_list[files.index("requirements.txt")]
errors.extend(self._validate_requirements_txt(repo, file_info))
Expand Down Expand Up @@ -1113,7 +1113,7 @@ def validate_in_pypi(self, repo):
"""prints a list of Adafruit_CircuitPython libraries that are in pypi"""
if (
repo["name"] in BUNDLE_IGNORE_LIST
or repo["name"] in self.has_setup_py_disabled
or repo["name"] in self.has_pyproject_toml_disabled
):
return []
if not (
Expand Down Expand Up @@ -1166,7 +1166,7 @@ def validate_passes_linting(self, repo):
if not repo["name"].startswith("Adafruit_CircuitPython"):
return []

ignored_py_files = ["setup.py", "conf.py"]
ignored_py_files = ["conf.py"]

desination_type = TemporaryDirectory
if self.keep_repos:
Expand Down