Skip to content

Commit 337353d

Browse files
committed
enforce bundle to adafruit & community. include which bundle in updates. remove unused pypi stats fetch.
1 parent 82cc5d3 commit 337353d

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

adabot/circuitpython_bundle.py

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,16 @@ def repo_remote_url(repo_path):
269269

270270
def update_bundle(bundle_path):
271271
"""Process all libraries in the bundle, and update their version if necessary."""
272+
273+
if (
274+
"Adafruit_CircuitPython_Bundle" not in bundle_path
275+
and "CircuitPython_Community_Bundle" not in bundle_path
276+
):
277+
raise ValueError(
278+
"bundle_path must be for "
279+
"Adafruit_CircuitPython_Bundle or CircuitPython_Community_Bundle"
280+
)
281+
272282
working_directory = os.path.abspath(os.getcwd())
273283
os.chdir(bundle_path)
274284
git.submodule("foreach", "git", "fetch")
@@ -312,12 +322,15 @@ def update_bundle(bundle_path):
312322
os.chdir(working_directory)
313323
lib_list_updates = check_lib_links_md(bundle_path)
314324
if lib_list_updates:
325+
if "Adafruit_CircuitPython_Bundle" in bundle_path:
326+
listfile_name = "circuitpython_library_list.md"
327+
bundle_url = "https://github.com/adafruit/Adafruit_CircuitPython_Bundle/"
328+
elif "CircuitPython_Community_Bundle" in bundle_path:
329+
listfile_name = "circuitpython_community_auto_library_list.md"
330+
bundle_url = "https://github.com/adafruit/CircuitPython_Community_Bundle/"
315331
updates.append(
316332
(
317-
(
318-
"https://github.com/adafruit/Adafruit_CircuitPython_Bundle/"
319-
"circuitpython_library_list.md"
320-
),
333+
f"{bundle_url}{listfile_name}", # pylint: disable=possibly-used-before-assignment
321334
"NA",
322335
"NA",
323336
" > Added the following libraries: {}".format(
@@ -326,18 +339,6 @@ def update_bundle(bundle_path):
326339
)
327340
)
328341
release_required = True
329-
if update_download_stats(bundle_path):
330-
updates.append(
331-
(
332-
(
333-
"https://github.com/adafruit/Adafruit_CircuitPython_Bundle/"
334-
"circuitpython_library_list.md"
335-
),
336-
"NA",
337-
"NA",
338-
" > Updated download stats for the libraries",
339-
)
340-
)
341342

342343
return updates, release_required
343344

0 commit comments

Comments
 (0)