8000 tools/mpremote: Package wheel with github actions. · micropython/micropython@f30c5a1 · GitHub
[go: up one dir, main page]

Skip to content

Commit f30c5a1

Browse files
committed
tools/mpremote: Package wheel with github actions.
1 parent f651f5b commit f30c5a1

File tree

5 files changed

+70
-1
lines changed

5 files changed

+70
-1
lines changed

.github/workflows/mpremote.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Package mpremote
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
with:
11+
# Version is determined from git,
12+
# should be deep enough to get to latest tag
13+
fetch-depth: '500'
14+
- run: |
15+
git fetch --prune --unshallow --tags
16+
- uses: actions/setup-python@v1
17+
- name: Install build tool
18+
run: pip install build
19+
- name: Build mpremote wheel
20+
run: cd tools/mpremote && pip wheel .
21+
- name: Archive mpremote wheel
22+
uses: actions/upload-artifact@v2
23+
with:
24+
name: mpremote
25+
path: |
26+
tools/mpremote/mpremote*.whl

tools/mpremote/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/mpremote/makemanifest.py
2+
/mpremote/pyboard.py
3+
/mpremote.egg-info
4+
/dist
5+
*.whl

tools/mpremote/build.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import shutil
2+
from pathlib import Path
3+
from setuptools.build_meta import (
4+
get_requires_for_build_wheel,
5+
get_requires_for_build_sdist,
6+
prepare_metadata_for_build_wheel,
7+
build_wheel as real_build_wheel,
8+
build_sdist as real_build_sdist,
9+
)
10+
11+
12+
PACKAGE = Path(__file__).parent / "mpremote"
13+
TOOLS_DIR = Path(__file__).parent / "../../tools"
14+
15+
16+
def copy_tools():
17+
if TOOLS_DIR.exists():
18+
for f in (
19+
TOOLS_DIR / "pyboard.py",
20+
TOOLS_DIR / "makemanifest.py",
21+
):
22+
print("copy {} -> {}".format(f, PACKAGE))
23+
shutil.copy(f, PACKAGE)
24+
25+
26+
def build_wheel(wheel_directory, config_settings=None, metadata_directory=None):
27+
copy_tools()
28+
return real_build_wheel(wheel_directory, config_settings, metadata_directory)
29+
30+
31+
def build_sdist(sdist_directory, config_settings=None):
32+
copy_tools()
33+
return real_build_sdist(sdist_directory, config_settings)

tools/mpremote/pyproject.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@ requires = [
33
"setuptools>=42",
44
"wheel",
55
"setuptools_scm>=6.2",
6+
"intreehooks",
67
]
7-
build-backend = "setuptools.build_meta"
8+
build-backend = "intreehooks:loader"
9+
10+
[tool.intreehooks]
11+
build-backend = "build"
812

913
[tool.setuptools_scm]
1014
root = "../.."

tools/mpremote/setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ packages = mpremote
1919
python_requires = >= 3.4
2020
install_requires =
2121
pyserial >= 3.3
22+
include_package_data = True
2223

2324
[options.entry_points]
2425
console_scripts =

0 commit comments

Comments
 (0)
0