Skip to content

Commit d39edb4

Browse files
authored
Merge pull request #131 from ericzundel/ericzundel/add-pypi-description
Adds the description from pyproject.toml to bundle
2 parents 0a65978 + d924320 commit d39edb4

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ cd circuitpython-build-tools # this will be specific to your storage location
4545
python3 -m venv .env
4646
source .env/bin/activate
4747
pip install -e . # '-e' is pip's "development" install feature
48-
circuitpython-build-bundles --filename_prefix <output file prefix> --library_location <library location>
48+
circuitpython-build-bundles --filename_prefix <output file prefix> --library_location <library location> --library_depth 2
4949
```
5050

5151
## Contributing

circuitpython_build_tools/build.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,19 @@
4141
import platformdirs
4242

4343
@functools.cache
44-
def _git_version():
45-
version_str = subprocess.check_output(["git", "--version"], encoding="ascii", errors="replace")
44+
def _git_version():
45+
version_str = subprocess.check_output(["git", "--version"], encoding="ascii", errors="replace")
4646
version_str = re.search("([0-9]\.*)*[0-9]", version_str).group(0)
4747
return tuple(int(part) for part in version_str.split("."))
48-
48+
4949
def git_filter_arg():
50-
clone_supports_filter = (
50+
clone_supports_filter = (
5151
False if "NO_USE_CLONE_FILTER" in os.environ else _git_version() >= (2, 36, 0)
52-
)
53-
54-
if clone_supports_filter:
52+
)
53+
54+
if clone_supports_filter:
5555
return ["--filter=blob:none"]
56-
else:
56+
else:
5757
return []
5858

5959
# pyproject.toml `py_modules` values that are incorrect. These should all have PRs filed!
@@ -123,7 +123,7 @@ def mpy_cross(version, quiet=False):
123123
name = version["name"]
124124
ext = ".exe" * (os.name == "nt")
125125
mpy_cross_filename = mpy_cross_path / f"mpy-cross-{name}{ext}"
126-
126+
127127
if os.path.isfile(mpy_cross_filename):
128128
return mpy_cross_filename
129129

@@ -205,6 +205,7 @@ def get_package_info(library_path, package_folder_prefix):
205205
pyproject_toml = load_pyproject_toml(lib_path)
206206
py_modules = get_nested(pyproject_toml, "tool", "setuptools", "py-modules", default=[])
207207
packages = get_nested(pyproject_toml, "tool", "setuptools", "packages", default=[])
208+
package_info["description"] = get_nested(pyproject_toml, "project", "description", default="")
208209

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

circuitpython_build_tools/scripts/build_bundles.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ def get_bundle_requirements(directory, package_list):
8686
Remove anything that shouldn't be a requirement like Adafruit_Blinka
8787
Return the list
8888
"""
89-
89+
9090
pypi_reqs = set() # For multiple bundle dependency
9191
dependencies = set() # For intra-bundle dependency
92-
92+
9393
path = directory + "/requirements.txt"
9494
if os.path.exists(path):
9595
with open(path, "r") as file:
@@ -133,6 +133,7 @@ def build_bundle_json(libs, bundle_version, output_filename, package_folder_pref
133133
package["version"] = package_info["version"]
134134
package["path"] = "lib/" + package_info["module_name"]
135135
package["library_path"] = library_path
136+
package["pypi_description"] = package_info["description"]
136137
packages[module_name] = package
137138

138139
library_submodules = {}
@@ -144,6 +145,7 @@ def build_bundle_json(libs, bundle_version, output_filename, package_folder_pref
144145
library["repo"] = package["repo"]
145146
library["path"] = package["path"]
146147
library["dependencies"], library["external_dependencies"] = get_bundle_requirements(package["library_path"], packages)
148+
library["pypi_description"] = package["pypi_description"]
147149
library_submodules[package["module_name"]] = library
148150

149151
out_file = open(output_filename, "w")

0 commit comments

Comments
 (0)