Skip to content

Commit

Permalink
mpy_cross: Cache it in the user cache path
Browse files Browse the repository at this point in the history
.. rather than in a build_deps folder, polluting the repo where it's used

this also enables sharing the copy of mpy-cross across multiple repos.
  • Loading branch information
jepler committed Jun 15, 2024
1 parent 90a2341 commit c8a8513
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion circuitpython_build_tools/scripts/build_bundles.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import zipfile

import click
import platformdirs

from circuitpython_build_tools import build
from circuitpython_build_tools import target_versions
Expand All @@ -41,6 +42,7 @@
else:
import importlib.metadata as importlib_metadata

mpy_cross_path = platformdirs.user_cache_path("circuitpython-build-tools", ensure_exists=True)

BLINKA_LIBRARIES = [
"adafruit-blinka",
Expand Down Expand Up @@ -282,7 +284,7 @@ def build_bundles(filename_prefix, output_directory, library_location, library_d
if "mpy" not in ignore:
os.makedirs("build_deps", exist_ok=True)
for version in target_versions.VERSIONS:
mpy_cross = "build_deps/mpy-cross-" + version["name"] + (".exe" * (os.name == "nt"))
mpy_cross = mpy_cross_path / ("mpy-cross-" + version["name"] + (".exe" * (os.name == "nt")))
build.mpy_cross(mpy_cross, version["tag"])
zip_filename = os.path.join(output_directory,
filename_prefix + '-{TAG}-mpy-{VERSION}.zip'.format(
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ requests
semver
wheel
tomli; python_version < "3.11"
platformdirs
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
package_data={'circuitpython_build_tools': ['data/mpy-cross-*']},
zip_safe=False,
python_requires='>=3.10',
install_requires=['Click', 'requests', 'semver', 'tomli; python_version < "3.11"'],
install_requires=['Click', 'requests', 'semver', 'tomli; python_version < "3.11"', 'platformdirs'],
entry_points='''
[console_scripts]
circuitpython-build-bundles=circuitpython_build_tools.scripts.build_bundles:build_bundles
Expand Down

0 comments on commit c8a8513

Please sign in to comment.