-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmanifest-circuitpython.py
More file actions
53 lines (48 loc) · 2.1 KB
/
Copy pathmanifest-circuitpython.py
File metadata and controls
53 lines (48 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Frozen Python from cmods extension repos, plus the CircuitPython upstream
# freeze for the active port/board/variant.
#
# ``build_cp.sh`` sets ``FROZEN_MANIFEST_UPSTREAM`` to the freeze CircuitPython
# would use: a unix variant/port manifest, or a generated ``BUILD/manifest.py``
# when ``FROZEN_MPY_DIRS`` is nonempty. Upstream may be empty for boards with
# no generated freeze.
#
# Optional local overrides: ``manifest-user.py`` (gitignored). Use ``package()``
# to freeze a tree; paths are relative to the current (workspace) directory.
#
# Child ``*/manifest.py`` inclusion (no hard-coded repo names): include when the
# sibling has ``apply_cp_patches.sh``, or lacks ``micropython.mk`` (skips
# MicroPython-only trees that would double-freeze shared helpers).
import os
# CP_SKIP_USER_FREEZE=1 leaves the personal extras out, for flash-tight boards.
# pdwidgets and palettes now freeze from their own repos' manifest.py (below),
# so skip those two with CP_SKIP_EXT="pdwidgets palettes" instead -- rp2040 has
# 1020 KB for firmware and they do not fit alongside a full build, where they
# are better placed on the CIRCUITPY filesystem.
if not os.environ.get("CP_SKIP_USER_FREEZE"):
try:
include("manifest-user.py")
except OSError:
pass
# Honour the same CP_SKIP_EXT the build script uses: skipping an extension's
# patches while still freezing its Python is incoherent (e.g. freezing
# display_driver.py into a build that has no LVGL).
_skip = set((os.environ.get("CP_SKIP_EXT", "").replace(",", " ")).split())
for _name in sorted(os.listdir(".")):
if _name.startswith("."):
continue
if _name in _skip:
continue
_path = os.path.join(_name, "manifest.py")
if not os.path.isfile(_path):
continue
_has_mp = os.path.isfile(os.path.join(_name, "micropython.mk"))
_has_cp_patches = os.path.isfile(os.path.join(_name, "apply_cp_patches.sh"))
if not (_has_cp_patches or not _has_mp):
continue
try:
include(_path)
except Exception:
pass
_upstream = os.environ.get("FROZEN_MANIFEST_UPSTREAM", "").strip()
if _upstream:
include(_upstream)