Skip to content

Commit ddcf3f0

Browse files
authored
Merge pull request #166 from sommersoft/propagate_setup_disabled
Ignore Relevant Validators When 'setup.py.disabled' Exists
2 parents 4ea14fb + 4d9a68c commit ddcf3f0

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

adabot/lib/circuitpython_library_validators.py

+16-9
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ def __init__(self, validators, bundle_submodules, latest_pylint, **kw_args):
166166
self.latest_pylint = pkg_version_parse(latest_pylint)
167167
self.output_file_data = []
168168
self.validate_contents_quiet = kw_args.get("validate_contents_quiet", False)
169+
self.has_setup_py_disabled = set()
169170

170171
def run_repo_validation(self, repo):
171172
"""Run all the current validation functions on the provided repository and
@@ -537,8 +538,12 @@ def validate_contents(self, repo):
537538
if not self.validate_contents_quiet:
538539
return [ERROR_NEW_REPO_IN_WORK]
539540

541+
if "setup.py.disabled" in files:
542+
self.has_setup_py_disabled.add(repo["name"])
543+
540544
# if we're only running due to -v, ignore the rest. we only care about
541-
# adding in-work repos to the BUNDLE_IGNORE_LIST
545+
# adding in-work repos to the BUNDLE_IGNORE_LIST and if setup.py is
546+
# disabled
542547
if self.validate_contents_quiet:
543548
return []
544549

@@ -599,14 +604,15 @@ def validate_contents(self, repo):
599604
if "setup.py" in files:
600605
file_info = content_list[files.index("setup.py")]
601606
errors.extend(self._validate_setup_py(repo, file_info))
602-
else:
607+
elif "setup.py.disabled" not in files:
603608
errors.append(ERROR_MISSING_SETUP_PY)
604609

605-
if "requirements.txt" in files:
606-
file_info = content_list[files.index("requirements.txt")]
607-
errors.extend(self._validate_requirements_txt(repo, file_info))
608-
else:
609-
errors.append(ERROR_MISSING_REQUIREMENTS_TXT)
610+
if repo["name"] not in self.has_setup_py_disabled:
611+
if "requirements.txt" in files:
612+
file_info = content_list[files.index("requirements.txt")]
613+
errors.extend(self._validate_requirements_txt(repo, file_info))
614+
else:
615+
errors.append(ERROR_MISSING_REQUIREMENTS_TXT)
610616

611617

612618
#Check for an examples folder.
@@ -947,8 +953,9 @@ def gather_insights(self, repo, insights, since, show_closed_metric=False):
947953

948954
def validate_in_pypi(self, repo):
949955
"""prints a list of Adafruit_CircuitPython libraries that are in pypi"""
950-
if repo["name"] in BUNDLE_IGNORE_LIST:
951-
return []
956+
if (repo["name"] in BUNDLE_IGNORE_LIST or
957+
repo["name"] in self.has_setup_py_disabled):
958+
return []
952959
if not (repo["owner"]["login"] == "adafruit" and
953960
repo["name"].startswith("Adafruit_CircuitPython")):
954961
return []

0 commit comments

Comments
 (0)