Skip to content

Commit

Permalink
cp_lib_validators.py: ignore relevant validators when 'setup.py.disab…
Browse files Browse the repository at this point in the history
…led' exists
  • Loading branch information
sommersoft committed Apr 17, 2020
1 parent 4ea14fb commit 4d9a68c
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions adabot/lib/circuitpython_library_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ def __init__(self, validators, bundle_submodules, latest_pylint, **kw_args):
self.latest_pylint = pkg_version_parse(latest_pylint)
self.output_file_data = []
self.validate_contents_quiet = kw_args.get("validate_contents_quiet", False)
self.has_setup_py_disabled = set()

def run_repo_validation(self, repo):
"""Run all the current validation functions on the provided repository and
Expand Down Expand Up @@ -537,8 +538,12 @@ 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 we're only running due to -v, ignore the rest. we only care about
# adding in-work repos to the BUNDLE_IGNORE_LIST
# adding in-work repos to the BUNDLE_IGNORE_LIST and if setup.py is
# disabled
if self.validate_contents_quiet:
return []

Expand Down Expand Up @@ -599,14 +604,15 @@ def validate_contents(self, repo):
if "setup.py" in files:
file_info = content_list[files.index("setup.py")]
errors.extend(self._validate_setup_py(repo, file_info))
else:
elif "setup.py.disabled" not in files:
errors.append(ERROR_MISSING_SETUP_PY)

if "requirements.txt" in files:
file_info = content_list[files.index("requirements.txt")]
errors.extend(self._validate_requirements_txt(repo, file_info))
else:
errors.append(ERROR_MISSING_REQUIREMENTS_TXT)
if repo["name"] not in self.has_setup_py_disabled:
if "requirements.txt" in files:
file_info = content_list[files.index("requirements.txt")]
errors.extend(self._validate_requirements_txt(repo, file_info))
else:
errors.append(ERROR_MISSING_REQUIREMENTS_TXT)


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

def validate_in_pypi(self, repo):
"""prints a list of Adafruit_CircuitPython libraries that are in pypi"""
if repo["name"] in BUNDLE_IGNORE_LIST:
return []
if (repo["name"] in BUNDLE_IGNORE_LIST or
repo["name"] in self.has_setup_py_disabled):
return []
if not (repo["owner"]["login"] == "adafruit" and
repo["name"].startswith("Adafruit_CircuitPython")):
return []
Expand Down

0 comments on commit 4d9a68c

Please sign in to comment.