-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
13 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,8 @@ | |
// "args": ["install", "github:arduino/arduino-modulino-mpy"] // Test github: URL | ||
// "args": ["install", "arduino-iot-cloud-py"] // Test regular library | ||
// "args": ["install", "micropython-my9221"] // Test library with custom package.json | ||
"args": ["install", "github:peterhinch/micropython_ir/ir_tx"] // Test library with subfolder | ||
// "args": ["install", "github:peterhinch/micropython_ir/ir_tx"] // Test library with subfolder | ||
"args": ["install", "github:arduino/[email protected]"] // Test library with version | ||
|
||
// "args": ["list", "micropython-rotary"] | ||
// "args": ["find", "cloud"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ upy-package [options] [command] | |
- `list`: Lists packages available from registries. | ||
- `info <package>`: Retrieves detailed information about a specific package. | ||
- `find <pattern>`: Searches for packages using the supplied pattern. | ||
- `install [options] <package-names...>`: Installs MicroPython packages onto a connected Arduino board. When installing multiple packages, they should be separated by a space. | ||
- `install [options] <package-names...>`: Installs MicroPython packages onto a connected Arduino board. When installing multiple packages, they should be separated by a space. It supports installing packages by name or URL. In the latter case you can specify the version using an @version suffix (e.g. github:arduino/[email protected]). | ||
- `--debug`: Enable debug output | ||
- `help [command]`: Displays help information for a specific command. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,10 +143,16 @@ export class PackageManager { | |
/** | ||
* Function to install a package from a URL | ||
* @param {string} packageURL The URL of the package to install. | ||
* Supported formats: 'github:owner/repo' or 'gitlab:owner/repo' | ||
* or https://github.com/owner/repo or https://gitlab.com/owner/repo. | ||
* It's also possible to indicate a specific package.json file or even single .py files. | ||
* Supports versioning with the by appending @version e.g. 'arduino/[email protected]'. | ||
* @param {SerialDevice} device The board to install the package on. | ||
*/ | ||
async installPackageFromURL(packageURL, device) { | ||
await this.installPackage({ "url" : packageURL }, device); | ||
const packageVersion = packageURL.split("@")[1]; | ||
const packageURLWithoutVersion = packageURL.split("@")[0]; | ||
await this.installPackage({ "url" : packageURLWithoutVersion, "version" : packageVersion }, device); | ||
} | ||
|
||
/** | ||
|
@@ -163,9 +169,10 @@ export class PackageManager { | |
// so they are installed by supplying the name as the URL | ||
const packageURL = aPackage.url ? aPackage.url : aPackage.name; | ||
const customPackageJson = aPackage.package_descriptor; | ||
const packageVersion = aPackage.version; | ||
|
||
const packager = new Packager(device.serialPort, this.compileFiles, this.overwriteExisting); | ||
await packager.packageAndInstall(packageURL, null, customPackageJson); | ||
await packager.packageAndInstall(packageURL, packageVersion, customPackageJson); | ||
console.debug(`✅ Package installed: ${packageURL}`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters