Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #108 from per1234/support-external-python-deps
Restore support for external Python package platform dependencies
- Loading branch information
Showing
11 changed files
with
205 additions
and
6 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
8 changes: 8 additions & 0 deletions
8
.github/workflows/testdata/platforms/PyserialDependent/boards.txt
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
pyserial_dependent.name=pyserial Dependent Board | ||
pyserial_dependent.upload.maximum_size=32256 | ||
pyserial_dependent.upload.maximum_data_size=2048 | ||
pyserial_dependent.build.mcu=atmega328p | ||
pyserial_dependent.build.f_cpu=16000000L | ||
pyserial_dependent.build.board=FOO | ||
pyserial_dependent.build.core=arduino:arduino | ||
pyserial_dependent.build.variant=arduino:standard |
5 changes: 5 additions & 0 deletions
5
.github/workflows/testdata/platforms/PyserialDependent/platform.txt
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
name=pyserial Dependent Platform | ||
version=0.0.0 | ||
# python3 is used to parallel ESP32 platform configuration: | ||
# https://github.com/espressif/arduino-esp32/blob/2.0.7/platform.txt#L220 | ||
recipe.hooks.prebuild.1.pattern=python3 -c 'import serial' |
8 changes: 8 additions & 0 deletions
8
.github/workflows/testdata/platforms/PythonPackageDependent/boards.txt
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package_dependent.name=External Python Package Dependent Board | ||
package_dependent.upload.maximum_size=32256 | ||
package_dependent.upload.maximum_data_size=2048 | ||
package_dependent.build.mcu=atmega328p | ||
package_dependent.build.f_cpu=16000000L | ||
package_dependent.build.board=FOO | ||
package_dependent.build.core=arduino:arduino | ||
package_dependent.build.variant=arduino:standard |
2 changes: 2 additions & 0 deletions
2
.github/workflows/testdata/platforms/PythonPackageDependent/dependent.py
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Import external package to verify Python package dependencies can be installed by user into runner environment. | ||
import cowsay # noqa: F401 |
3 changes: 3 additions & 0 deletions
3
.github/workflows/testdata/platforms/PythonPackageDependent/platform.txt
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
name=External Python Package Dependent Platform | ||
version=0.0.0 | ||
recipe.hooks.prebuild.1.pattern=python "{runtime.platform.path}/dependent.py" |
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
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
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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Frequently Asked Questions | ||
|
||
## How can I install dependencies of a boards platform? | ||
|
||
### Managed Dependencies | ||
|
||
The Arduino **Boards Manager** system installs tool dependencies along with a platform. When you specify a [**Boards Manager**-sourced platform dependency](../README.md#boards-manager) via the action's [`platforms` input](../README.md#platforms) the managed platform dependencies are installed automatically. | ||
|
||
If an alternative [platform dependency source](../README.md#supported-platform-sources) is used this automatic tool dependency installation does not occur. The convenient way to install the tool dependencies in this case is to install a **Boards Manager**-sourced platform that has a dependency on the required tools in addition to the target platform from the alternative source. | ||
|
||
--- | ||
|
||
**Example:** | ||
|
||
```yaml | ||
- uses: arduino/compile-sketches@v1 | ||
with: | ||
platforms: | | ||
# Use Boards Manager to install the latest release of the platform to get the toolchain. | ||
- name: arduino:avr | ||
# Overwrite the Boards Manager installation with the development version of the platform. | ||
- source-url: https://github.com/arduino/ArduinoCore-avr.git | ||
name: arduino:avr | ||
``` | ||
|
||
--- | ||
|
||
### External Dependencies | ||
|
||
Arduino boards platforms typically bundle all dependencies. However, there are some platforms that require the user to manually install dependencies on their system in order to use the platform. | ||
|
||
The **arduino/compile-sketches** action runs in the same environment as the rest of the steps of the [workflow job](https://docs.github.com/actions/using-jobs/using-jobs-in-a-workflow), which means you can simply perform the dependency installation in a prior [step](https://docs.github.com/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idsteps) of the job. | ||
|
||
--- | ||
|
||
**Example:** | ||
|
||
```yaml | ||
- run: <some dependency installation command> | ||
- uses: arduino/compile-sketches@v1 | ||
``` | ||
|
||
--- | ||
|
||
#### Python Packages | ||
|
||
The **arduino/compile-sketches** action uses a Python [virtual environment](https://docs.python.org/glossary.html#term-virtual-environment). In order to enable user installation of Python [package](https://docs.python.org/glossary.html#term-package) dependencies of boards platforms, the packages installed in the "[user site-packages](https://peps.python.org/pep-0370/)" folder are included in this virtual environment. | ||
|
||
In order to be certain your installation of a package dependency will be available to the platform, add the [`--ignore-installed`](https://pip.pypa.io/en/stable/cli/pip_install/#cmdoption-ignore-installed) and [`--user`](https://pip.pypa.io/en/stable/cli/pip_install/#install-user) flags to the [**pip**](https://pip.pypa.io/) command used to install the package. | ||
|
||
--- | ||
|
||
**Example:** | ||
|
||
```yaml | ||
- run: pip install --ignore-installed --user pyserial | ||
- uses: arduino/compile-sketches@v1 | ||
``` | ||
|
||
--- |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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