This PR adds the ability for mip to load files from relative source paths given in the urls section of package.json files.
Previously, the only accepted forms for source paths were http://, https://, or github:.
These changes allow a source path to be given without one of these prefixes, in which case the URL of the parent of the package.json is prepended.
So instead of someone forking a repository and having to change source lines that start with
github:upstream_repository/filename
into
github:my_repository/filename
they can now just say
filename
which will survive forking or cloning without change.
This also allows doing mip.install() from a file:// location. This makes it easy to do a git clone of a repository and test installation of a package from the local filesystem, especially using the unix port.
To install this package from my fork for testing, (I think you can) use commands such as:
$ mpremote connect /dev/ttyUSB0 mip install --index https://ned-pcs.github.io/micropython-lib/mip/feature/mip-allow-relative-sources mip
Or from a networked device:
import mip
mip.install(mip, index="https://ned-pcs.github.io/micropython-lib/mip/feature/mip-allow-relative-sources")
And then restart your device, as you have now added a new version of mip. To test this, you will need to make sure that your lib directory comes before .frozen in your sys.path before importing mip.
Take a look at my work in #676