-
Notifications
You must be signed in to change notification settings - Fork 18
Adds the description from pyproject.toml to bundle #131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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") | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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! | ||
|
|
@@ -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 | ||
|
|
||
|
|
@@ -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="") | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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] | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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: | ||
|
|
@@ -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"] | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 = {} | ||
|
|
@@ -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") | ||
|
|
||
There was a problem hiding this comment.
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>