Skip to content
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

micropython/mip: Allow relative URLs in package.json files. #975

Merged
merged 1 commit into from
Feb 24, 2025

Conversation

glenn20
Copy link
Contributor

@glenn20 glenn20 commented Feb 18, 2025

This PR allows URLs in package.json files to be specified relative to the directory containing the package.json file. This mirrors the functionality added to mpremote in micropython:#12477.

This simplifies use of mip packages from forked or copied repos.

Example package.json:

{
    "urls": [
        ["ota/rollback.py", "rollback.py"],
        ["ota/status.py", "status.py"],
        ["ota/update.py", "update.py"],
        ["ota/blockdev_writer.py", "blockdev_writer.py"]
    ],
    "deps": [
    ],
    "version": "0.2"
}

@glenn20 glenn20 changed the title mip: Allow relative URLs in package.json. micropython/mip: Allow relative URLs in package.json files. Feb 18, 2025
@glenn20
Copy link
Contributor Author

glenn20 commented Feb 18, 2025

Basic functionality can be tested with:

mip.install("github:glenn20/micropython-esp32-ota/mip/ota/package-relative-url.json")

Copy link
Member

@dpgeorge dpgeorge left a comment

Choose a reason for hiding this comment

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

Thank you!

I tested it with a test package hosted at https://dpgeorge.net/resources/mip_test and it works well.

This allows to specify relative URLs in package.json, which are resolved
relative to the package.json URL. This mirrors the functionality added to
mpremote in micropython/micropython#12477.

Signed-off-by: Glenn Moloney <[email protected]>
@dpgeorge dpgeorge force-pushed the feature-mip-relative-url branch from 35aa54e to b379e4f Compare February 24, 2025 03:23
@dpgeorge dpgeorge merged commit b379e4f into micropython:master Feb 24, 2025
3 of 4 checks passed
@dpgeorge
Copy link
Member

Side note: I think we should add support in MicroPython core to pass a tuple of strings to str.startswith/str.endswith.

@glenn20 glenn20 deleted the feature-mip-relative-url branch February 24, 2025 04:23
@glenn20
Copy link
Contributor Author

glenn20 commented Feb 25, 2025

Side note: I think we should add support in MicroPython core to pass a tuple of strings to str.startswith/str.endswith.

@dpgeorge I've just pushed #16812 to provide that (and also support for start and end args).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants