|
20 | 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21 | 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22 | 22 | # THE SOFTWARE.
|
| 23 | + |
23 | 24 | import copy
|
24 | 25 | import datetime
|
25 | 26 | import re
|
|
36 | 37 | from adabot.lib import circuitpython_library_validators as cirpy_lib_vals
|
37 | 38 | from adabot.lib import common_funcs
|
38 | 39 | from adabot.lib import assign_hacktober_label as hacktober
|
| 40 | +from adabot.lib import blinka_funcs |
| 41 | +from adabot import circuitpython_library_download_stats as dl_stats |
39 | 42 |
|
40 | 43 | # Setup ArgumentParser
|
41 | 44 | cmd_line_parser = argparse.ArgumentParser(
|
@@ -109,38 +112,19 @@ def run_library_checks(validators, bundle_submodules, latest_pylint, kw_args):
|
109 | 112 | latest_pylint = pylint_info.json()["info"]["version"]
|
110 | 113 | output_handler("Latest pylint is: {}".format(latest_pylint))
|
111 | 114 |
|
112 |
| - repos = common_funcs.list_repos() |
| 115 | + repos = common_funcs.list_repos(include_repos=('Adafruit_Blinka',)) |
113 | 116 | output_handler("Found {} repos to check.".format(len(repos)))
|
114 | 117 | bundle_submodules = common_funcs.get_bundle_submodules()
|
115 | 118 | output_handler("Found {} submodules in the bundle.".format(len(bundle_submodules)))
|
116 | 119 | github_user = common_funcs.whois_github_user()
|
117 | 120 | output_handler("Running GitHub checks as " + github_user)
|
118 | 121 | need_work = 0
|
119 |
| - lib_insights = { |
120 |
| - "merged_prs": 0, |
121 |
| - "closed_prs": 0, |
122 |
| - "new_prs": 0, |
123 |
| - "active_prs": 0, |
124 |
| - "open_prs": [], |
125 |
| - "pr_authors": set(), |
126 |
| - "pr_merged_authors": set(), |
127 |
| - "pr_reviewers": set(), |
128 |
| - "closed_issues": 0, |
129 |
| - "new_issues": 0, |
130 |
| - "active_issues": 0, |
131 |
| - "open_issues": [], |
132 |
| - "issue_authors": set(), |
133 |
| - "issue_closers": set(), |
134 |
| - "hacktober_assigned": 0, |
135 |
| - "hacktober_removed": 0, |
136 |
| - } |
137 |
| - core_insights = copy.deepcopy(lib_insights) |
138 |
| - for k in core_insights: |
139 |
| - if isinstance(core_insights[k], set): |
140 |
| - core_insights[k] = set() |
141 |
| - if isinstance(core_insights[k], list): |
142 |
| - core_insights[k] = [] |
| 122 | + |
| 123 | + lib_insights = common_funcs.InsightData() |
| 124 | + blinka_insights = common_funcs.InsightData() |
| 125 | + core_insights = common_funcs.InsightData() |
143 | 126 | core_insights["milestones"] = dict()
|
| 127 | + |
144 | 128 | repo_needs_work = []
|
145 | 129 | since = datetime.datetime.now() - datetime.timedelta(days=7)
|
146 | 130 | repos_by_error = {}
|
@@ -176,8 +160,10 @@ def run_library_checks(validators, bundle_submodules, latest_pylint, kw_args):
|
176 | 160 | "{0} ({1} days)".format(repo["html_url"], error[1])
|
177 | 161 | )
|
178 | 162 | insights = lib_insights
|
179 |
| - if (repo["name"] == "circuitpython" and |
180 |
| - repo["owner"]["login"] == "adafruit"): |
| 163 | + if repo["owner"]["login"] == "adafruit": |
| 164 | + if repo["name"] == "Adafruit_Blinka": |
| 165 | + insights = blinka_insights |
| 166 | + elif repo["name"] == "circuitpython": |
181 | 167 | insights = core_insights
|
182 | 168 | errors = validator.gather_insights(repo, insights, since)
|
183 | 169 | if errors:
|
@@ -267,6 +253,24 @@ def run_library_checks(validators, bundle_submodules, latest_pylint, kw_args):
|
267 | 253 | if error_count <= error_depth or error in list_repos_for_errors:
|
268 | 254 | output_handler("\n".join([" * " + x for x in repos_by_error[error]]))
|
269 | 255 |
|
| 256 | + output_handler() |
| 257 | + output_handler("Blinka") |
| 258 | + print_pr_overview(blinka_insights) |
| 259 | + output_handler("* {} open pull requests".format(len(blinka_insights["open_prs"]))) |
| 260 | + sorted_prs = sorted(blinka_insights["open_prs"], |
| 261 | + key=lambda days: int(pr_sort_re.search(days).group(1)), |
| 262 | + reverse=True) |
| 263 | + for pr in sorted_prs: |
| 264 | + output_handler(" * {}".format(pr)) |
| 265 | + print_issue_overview(blinka_insights) |
| 266 | + output_handler("* {} open issues".format(len(blinka_insights["open_issues"]))) |
| 267 | + output_handler(" * https://github.com/adafruit/Adafruit_Blinka/issues") |
| 268 | + blinka_dl, _ = dl_stats.pypistats_get('adafruit-blinka') |
| 269 | + output_handler("* PyPI Downloads in the last week: {}".format(blinka_dl)) |
| 270 | + output_handler( |
| 271 | + "Number of supported boards: {}".format(blinka_funcs.board_count()) |
| 272 | + ) |
| 273 | + |
270 | 274 | def output_handler(message="", quiet=False):
|
271 | 275 | """Handles message output to prompt/file for print_*() functions."""
|
272 | 276 | if output_filename is not None:
|
@@ -339,6 +343,8 @@ def print_circuitpython_download_stats():
|
339 | 343 | total[release["tag_name"]] = 0
|
340 | 344 | total[release["tag_name"]] += count
|
341 | 345 |
|
| 346 | + output_handler("Number of supported boards: {}".format(len(by_board))) |
| 347 | + output_handler() |
342 | 348 | output_handler("Download stats by board:")
|
343 | 349 | output_handler()
|
344 | 350 | by_board_list = [["Board", "{}".format(stable_tag.strip(" ")), "{}".format(prerelease_tag.strip(" "))],]
|
|
0 commit comments