Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ cd circuitpython-build-tools # this will be specific to your storage location
python3 -m venv .env
source .env/bin/activate
pip install -e . # '-e' is pip's "development" install feature
circuitpython-build-bundles --filename_prefix <output file prefix> --library_location <library location>
circuitpython-build-bundles --filename_prefix <output file prefix> --library_location <library location> --library_depth 2
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated this from the Adafruit_CircuitPython_Bundle README after some trial and error.

There is another problem I ran into when testing my changes. The circuitpython-build-bundles script assumes that it can find a README file in the current working directory, so one more instruction that could be added here is cd <Adafruit_CircuitPython_Bundle checkout dir>

```

## Contributing
Expand Down
19 changes: 10 additions & 9 deletions circuitpython_build_tools/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@
import platformdirs

@functools.cache
def _git_version():
version_str = subprocess.check_output(["git", "--version"], encoding="ascii", errors="replace")
def _git_version():
version_str = subprocess.check_output(["git", "--version"], encoding="ascii", errors="replace")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No substantive changes, my editor just clobbered all trailing whitespace

version_str = re.search("([0-9]\.*)*[0-9]", version_str).group(0)
return tuple(int(part) for part in version_str.split("."))

def git_filter_arg():
clone_supports_filter = (
clone_supports_filter = (
False if "NO_USE_CLONE_FILTER" in os.environ else _git_version() >= (2, 36, 0)
)
if clone_supports_filter:
)

if clone_supports_filter:
return ["--filter=blob:none"]
else:
else:
return []

# pyproject.toml `py_modules` values that are incorrect. These should all have PRs filed!
Expand Down Expand Up @@ -123,7 +123,7 @@ def mpy_cross(version, quiet=False):
name = version["name"]
ext = ".exe" * (os.name == "nt")
mpy_cross_filename = mpy_cross_path / f"mpy-cross-{name}{ext}"

if os.path.isfile(mpy_cross_filename):
return mpy_cross_filename

Expand Down Expand Up @@ -205,6 +205,7 @@ def get_package_info(library_path, package_folder_prefix):
pyproject_toml = load_pyproject_toml(lib_path)
py_modules = get_nested(pyproject_toml, "tool", "setuptools", "py-modules", default=[])
packages = get_nested(pyproject_toml, "tool", "setuptools", "packages", default=[])
package_info["description"] = get_nested(pyproject_toml, "project", "description", default="")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, ChatGPT review suggested that we fallback to tool.setuptools.description if this is not present. The only library I found with no description under project was Adafruit JSON Stream with the description explicitly set blank, and nothing under tool.setuptools.description


blocklisted = [name for name in py_modules if name in pyproject_py_modules_blocklist]

Expand Down
6 changes: 4 additions & 2 deletions circuitpython_build_tools/scripts/build_bundles.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ def get_bundle_requirements(directory, package_list):
Remove anything that shouldn't be a requirement like Adafruit_Blinka
Return the list
"""

pypi_reqs = set() # For multiple bundle dependency
dependencies = set() # For intra-bundle dependency

path = directory + "/requirements.txt"
if os.path.exists(path):
with open(path, "r") as file:
Expand Down Expand Up @@ -133,6 +133,7 @@ def build_bundle_json(libs, bundle_version, output_filename, package_folder_pref
package["version"] = package_info["version"]
package["path"] = "lib/" + package_info["module_name"]
package["library_path"] = library_path
package["pypi_description"] = package_info["description"]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I chose the name 'pypi_description' for this field to follow the precedent set by the 'pipy_name' field.

packages[module_name] = package

library_submodules = {}
Expand All @@ -144,6 +145,7 @@ def build_bundle_json(libs, bundle_version, output_filename, package_folder_pref
library["repo"] = package["repo"]
library["path"] = package["path"]
library["dependencies"], library["external_dependencies"] = get_bundle_requirements(package["library_path"], packages)
library["pypi_description"] = package["pypi_description"]
library_submodules[package["module_name"]] = library

out_file = open(output_filename, "w")
Expand Down
Loading