fontlab-python-instamix 1.0.0__tar.gz → 1.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fontlab_python_instamix-1.0.2/CHANGELOG.md +29 -0
- {fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/PKG-INFO +25 -23
- {fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/README.md +24 -22
- {fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/pyproject.toml +1 -1
- {fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/src/fontlab_instamix/__version__.py +2 -2
- fontlab_python_instamix-1.0.2/src/fontlab_instamix/bootstrap.py +421 -0
- {fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/src/fontlab_instamix/cli.py +12 -1
- {fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/src/fontlab_instamix/dest.py +5 -1
- fontlab_python_instamix-1.0.2/src/fontlab_instamix/distinfo.py +79 -0
- {fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/src/fontlab_instamix/extension.py +66 -2
- fontlab_python_instamix-1.0.2/src/fontlab_instamix/initscript.py +71 -0
- fontlab_python_instamix-1.0.2/src/fontlab_instamix/launch.py +29 -0
- fontlab_python_instamix-1.0.2/src/fontlab_instamix/launchers.py +63 -0
- fontlab_python_instamix-1.0.2/src/fontlab_instamix/legacy.py +228 -0
- fontlab_python_instamix-1.0.2/src/fontlab_instamix/markers.py +174 -0
- fontlab_python_instamix-1.0.2/src/fontlab_instamix/stub.py +26 -0
- fontlab_python_instamix-1.0.2/src/fontlab_instamix/stub_install.vfpy +39 -0
- fontlab_python_instamix-1.0.2/src/fontlab_instamix/vcs.py +80 -0
- fontlab_python_instamix-1.0.2/stub/install.vfpy +39 -0
- {fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/tests/test_bootstrap_cli.py +63 -2
- fontlab_python_instamix-1.0.2/tests/test_parity.py +691 -0
- fontlab_python_instamix-1.0.0/CHANGELOG.md +0 -14
- fontlab_python_instamix-1.0.0/src/fontlab_instamix/bootstrap.py +0 -187
- {fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/.gitignore +0 -0
- {fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/LICENSE +0 -0
- {fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/PLAN.md +0 -0
- {fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/build.sh +0 -0
- {fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/examples/com.example.hello.fontlabext/encoding/hello.enc +0 -0
- {fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/examples/com.example.hello.fontlabext/manifest.fontlabextj +0 -0
- {fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/examples/com.example.hello.fontlabext/scripts/Hello.py +0 -0
- {fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/install.vfpy +0 -0
- {fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/publish.sh +0 -0
- {fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/src/fontlab_instamix/__init__.py +0 -0
- {fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/src/fontlab_instamix/__main__.py +0 -0
- {fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/src/fontlab_instamix/env.py +0 -0
- {fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/src/fontlab_instamix/gui.py +0 -0
- {fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/src/fontlab_instamix/ledger.py +0 -0
- {fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/src/fontlab_instamix/manifest.py +0 -0
- {fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/src/fontlab_instamix/packages.py +0 -0
- {fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/src/fontlab_instamix/platformdirs.py +0 -0
- {fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/src/fontlab_instamix/uv.py +0 -0
- {fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/src/fontlab_instamix/venv.py +0 -0
- {fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/src/fontlab_instamix/wrap.py +0 -0
- {fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/test.sh +0 -0
- {fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/tests/conftest.py +0 -0
- {fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/tests/test_dest.py +0 -0
- {fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/tests/test_env.py +0 -0
- {fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/tests/test_extension.py +0 -0
- {fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/tests/test_manifest.py +0 -0
- {fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/tests/test_packages.py +0 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
this_file: CHANGELOG.md
|
|
3
|
+
---
|
|
4
|
+
# Changelog
|
|
5
|
+
|
|
6
|
+
## 1.0.2 (2026-11-16)
|
|
7
|
+
|
|
8
|
+
- Sibling detection now follows legacy `fontlab-fly`: a neighbouring folder counts only if it has `install.vfpy` and a pyproject with a `[tool.fontlab-install]` table and valid `id`, matched by normalised table or project name. Read-only checkouts such as TypeRig no longer break installs; their specs go to uv.
|
|
9
|
+
- Uninstall removes empty folders that instamix created under `Scripts/` (never `Scripts/` itself) and deletes `initScript.py` when only instamix's block was in it.
|
|
10
|
+
- 147 offline pytest tests; an offline run installed and uninstalled all 13 workspace packages in one data folder.
|
|
11
|
+
|
|
12
|
+
## 1.0.1 (2026-11-16)
|
|
13
|
+
|
|
14
|
+
- Legacy `install.vfpy` parity in `bootstrap.install_project`: environment markers (`markers.py`), hatch-vcs versions (`vcs.py`), dist-info (`distinfo.py`), the fontlabapp `initScript.py` block (`initscript.py`), `Scripts/Instamix` launchers (`launchers.py`, `launch.py`), plugin bundles under `Extensions/<kind>`, Scripts mapping and junk filter, hatch/project fallbacks for packages and dependencies, and migration of legacy installs (`legacy.py`).
|
|
15
|
+
- `fontlab-instamix stub DIR [--force]` writes the standard 40-line `install.vfpy` (`stub/install.vfpy`). It finds instamix installed, in a sibling checkout or as a sha256-checked PyPI wheel.
|
|
16
|
+
- Breaking: top-level `Scripts/` now installs into FontLab's `Scripts/` (not `Scripts/<id>/`), as the legacy installers did.
|
|
17
|
+
- Top-level README, LICENSE, CHANGELOG and `.md` files in `Scripts/` are not installed into FontLab's Scripts root.
|
|
18
|
+
- The stub uses an installed instamix only if it has `fontlab_instamix.legacy`; otherwise it falls back to a sibling checkout or PyPI.
|
|
19
|
+
- 140 offline pytest tests; not yet tested inside FontLab.
|
|
20
|
+
|
|
21
|
+
## 1.0.0 (2026-11-16)
|
|
22
|
+
|
|
23
|
+
- New package `fontlab-python-instamix` (import `fontlab_instamix`), stdlib only, Python 3.11+.
|
|
24
|
+
- Data folder resolution (`--data-dir`, `FONTLAB_DATA_DIR`, `flPreferences().dataPathDefault`, platform fallback) with a vendored platformdirs subset.
|
|
25
|
+
- Strict `manifest.fontlabextj` parser and destination rules (`.`, `{}`, `{var}`, case-insensitive targets, `..` refused).
|
|
26
|
+
- Extension install from `.fontlabext` folders and `.fontlabextz` zips: safe unzip, staged copy into `Extensions/Library`, per-file links into Scripts/Encoding/Codepage/Actions/Data/site-packages, JSON ledger and JSONL log, exact uninstall that keeps changed files, upgrade by reinstall.
|
|
27
|
+
- uv locate/download (checksum verified), `<data>/.venv`, package install/list/uninstall into FontLab's site-packages via `uv pip install --target`.
|
|
28
|
+
- `wrap` (script to extension/zip), `bootstrap.install_project` for `[tool.fontlab-install]` projects, PythonQt dialogs with console fallback, `fontlab-instamix` CLI, `install.vfpy` self-installer, example `com.example.hello` extension.
|
|
29
|
+
- 68 offline pytest tests; not yet tested inside FontLab.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: fontlab-python-instamix
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: Stdlib-only installer for FontLab 9 extensions, scripts and Python packages
|
|
5
5
|
Project-URL: Repository, https://github.com/fontlabcom/fontlab-python-instamix
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -91,25 +91,14 @@ Unknown manifest keys are errors, except `this_file`.
|
|
|
91
91
|
|
|
92
92
|
See `examples/com.example.hello.fontlabext`.
|
|
93
93
|
|
|
94
|
-
##
|
|
94
|
+
## Stub install.vfpy for other projects
|
|
95
95
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
If instamix is not installed yet, FontLab raises `ModuleNotFoundError:
|
|
103
|
-
fontlab_instamix`. Get it by opening `fontlab-python-instamix/install.vfpy` in
|
|
104
|
-
FontLab once. To also work from a sibling checkout, replace the first line with:
|
|
105
|
-
|
|
106
|
-
```python
|
|
107
|
-
try: import fontlab_instamix.bootstrap as b
|
|
108
|
-
except ImportError:
|
|
109
|
-
import sys, pathlib; sys.path.append(str(pathlib.Path(__file__).resolve().parents[1] / "fontlab-python-instamix" / "src"))
|
|
110
|
-
try: import fontlab_instamix.bootstrap as b
|
|
111
|
-
except ImportError: raise SystemExit("fontlab-instamix missing: open fontlab-python-instamix/install.vfpy in FontLab first")
|
|
112
|
-
```
|
|
96
|
+
`fontlab-instamix stub DIR` writes the standard 40-line `install.vfpy` into a
|
|
97
|
+
project folder (`--force` replaces an existing one; the template is
|
|
98
|
+
`stub/install.vfpy`). When opened in FontLab it gets instamix in this order:
|
|
99
|
+
an installed copy, a sibling `../fontlab-python-instamix` checkout copied into
|
|
100
|
+
site-packages, or the PyPI wheel (sha256 checked, only `fontlab_instamix/`
|
|
101
|
+
extracted). Then it calls `bootstrap.install_project(__file__)`.
|
|
113
102
|
|
|
114
103
|
`install_project` reads `[tool.fontlab-install]`:
|
|
115
104
|
|
|
@@ -117,12 +106,25 @@ except ImportError:
|
|
|
117
106
|
[tool.fontlab-install]
|
|
118
107
|
id = "com.example.tool" # required, reverse-DNS
|
|
119
108
|
name = "Tool"
|
|
120
|
-
packages = ["src/tool"] #
|
|
121
|
-
scripts = ["
|
|
122
|
-
extensions = "Extensions" # .fontlabext folders
|
|
123
|
-
dependencies = ["fontlab-fly>=1"] #
|
|
109
|
+
packages = ["src/tool"] # default: [tool.hatch.build.targets.wheel] packages
|
|
110
|
+
scripts = ["tools/Extra"] # top-level Scripts/ is always included
|
|
111
|
+
extensions = "Extensions" # .fontlabext folders and <kind>/<Name>.fontlab<Kind> bundles
|
|
112
|
+
dependencies = ["fontlab-fly>=1"] # default: [project] dependencies
|
|
113
|
+
init-script = false # default: true only for com.fontlab.fontlabapp
|
|
124
114
|
```
|
|
125
115
|
|
|
116
|
+
It matches the legacy `install.vfpy`:
|
|
117
|
+
|
|
118
|
+
- Top-level `Scripts/` maps onto FontLab's `Scripts/`; other listed folders map to `Scripts/<path>`. `__pycache__`, `*.pyc`, `*.vfpyc` and `.DS_Store` are skipped.
|
|
119
|
+
- Bundles go to `Extensions/<kind>/<Name>.fontlab<Kind>`.
|
|
120
|
+
- Dependency markers are evaluated for FontLab's Python 3.11 on the host OS. Specs that do not apply are skipped; `METADATA` keeps all of them.
|
|
121
|
+
- The version comes from the static `[project].version`, then the hatch-vcs version file, `PKG-INFO`, `git describe` and the fallback version.
|
|
122
|
+
- `<dist>-<version>.dist-info` (INSTALLER `fontlab-instamix`) is written so `importlib.metadata` finds the package. Uninstall removes it and never follows the editable package link.
|
|
123
|
+
- `Scripts/Instamix/` holds `List Extensions.py` and `Uninstall <id>.py`.
|
|
124
|
+
- For fontlabapp, the `fontlabapp.plugins` block is added to `initScript.py`, and removed again on uninstall; `initScript.py` is deleted if nothing else is in it. Empty folders under `Scripts/` that instamix created are pruned too (never `Scripts/` itself, never a folder that existed before install).
|
|
125
|
+
- Dependencies uv installed from PyPI (for example fonttools) stay after uninstall: other extensions may share them, and the legacy installer also kept them. Sibling checkouts are detected only if their pyproject has a `[tool.fontlab-install]` table with a valid `id`; anything else (such as TypeRig) goes to uv.
|
|
126
|
+
- A legacy `install.vfpy` install of the same id is migrated first. Files it logged are removed; changed files are kept. If a kept file would collide with the new install, the install stops before it changes anything. Shared legacy tools (`fontlab_install.py`, `Scripts/Extensions/`) are removed once no legacy install remains.
|
|
127
|
+
|
|
126
128
|
## Development
|
|
127
129
|
|
|
128
130
|
```sh
|
|
@@ -79,25 +79,14 @@ Unknown manifest keys are errors, except `this_file`.
|
|
|
79
79
|
|
|
80
80
|
See `examples/com.example.hello.fontlabext`.
|
|
81
81
|
|
|
82
|
-
##
|
|
82
|
+
## Stub install.vfpy for other projects
|
|
83
83
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
If instamix is not installed yet, FontLab raises `ModuleNotFoundError:
|
|
91
|
-
fontlab_instamix`. Get it by opening `fontlab-python-instamix/install.vfpy` in
|
|
92
|
-
FontLab once. To also work from a sibling checkout, replace the first line with:
|
|
93
|
-
|
|
94
|
-
```python
|
|
95
|
-
try: import fontlab_instamix.bootstrap as b
|
|
96
|
-
except ImportError:
|
|
97
|
-
import sys, pathlib; sys.path.append(str(pathlib.Path(__file__).resolve().parents[1] / "fontlab-python-instamix" / "src"))
|
|
98
|
-
try: import fontlab_instamix.bootstrap as b
|
|
99
|
-
except ImportError: raise SystemExit("fontlab-instamix missing: open fontlab-python-instamix/install.vfpy in FontLab first")
|
|
100
|
-
```
|
|
84
|
+
`fontlab-instamix stub DIR` writes the standard 40-line `install.vfpy` into a
|
|
85
|
+
project folder (`--force` replaces an existing one; the template is
|
|
86
|
+
`stub/install.vfpy`). When opened in FontLab it gets instamix in this order:
|
|
87
|
+
an installed copy, a sibling `../fontlab-python-instamix` checkout copied into
|
|
88
|
+
site-packages, or the PyPI wheel (sha256 checked, only `fontlab_instamix/`
|
|
89
|
+
extracted). Then it calls `bootstrap.install_project(__file__)`.
|
|
101
90
|
|
|
102
91
|
`install_project` reads `[tool.fontlab-install]`:
|
|
103
92
|
|
|
@@ -105,12 +94,25 @@ except ImportError:
|
|
|
105
94
|
[tool.fontlab-install]
|
|
106
95
|
id = "com.example.tool" # required, reverse-DNS
|
|
107
96
|
name = "Tool"
|
|
108
|
-
packages = ["src/tool"] #
|
|
109
|
-
scripts = ["
|
|
110
|
-
extensions = "Extensions" # .fontlabext folders
|
|
111
|
-
dependencies = ["fontlab-fly>=1"] #
|
|
97
|
+
packages = ["src/tool"] # default: [tool.hatch.build.targets.wheel] packages
|
|
98
|
+
scripts = ["tools/Extra"] # top-level Scripts/ is always included
|
|
99
|
+
extensions = "Extensions" # .fontlabext folders and <kind>/<Name>.fontlab<Kind> bundles
|
|
100
|
+
dependencies = ["fontlab-fly>=1"] # default: [project] dependencies
|
|
101
|
+
init-script = false # default: true only for com.fontlab.fontlabapp
|
|
112
102
|
```
|
|
113
103
|
|
|
104
|
+
It matches the legacy `install.vfpy`:
|
|
105
|
+
|
|
106
|
+
- Top-level `Scripts/` maps onto FontLab's `Scripts/`; other listed folders map to `Scripts/<path>`. `__pycache__`, `*.pyc`, `*.vfpyc` and `.DS_Store` are skipped.
|
|
107
|
+
- Bundles go to `Extensions/<kind>/<Name>.fontlab<Kind>`.
|
|
108
|
+
- Dependency markers are evaluated for FontLab's Python 3.11 on the host OS. Specs that do not apply are skipped; `METADATA` keeps all of them.
|
|
109
|
+
- The version comes from the static `[project].version`, then the hatch-vcs version file, `PKG-INFO`, `git describe` and the fallback version.
|
|
110
|
+
- `<dist>-<version>.dist-info` (INSTALLER `fontlab-instamix`) is written so `importlib.metadata` finds the package. Uninstall removes it and never follows the editable package link.
|
|
111
|
+
- `Scripts/Instamix/` holds `List Extensions.py` and `Uninstall <id>.py`.
|
|
112
|
+
- For fontlabapp, the `fontlabapp.plugins` block is added to `initScript.py`, and removed again on uninstall; `initScript.py` is deleted if nothing else is in it. Empty folders under `Scripts/` that instamix created are pruned too (never `Scripts/` itself, never a folder that existed before install).
|
|
113
|
+
- Dependencies uv installed from PyPI (for example fonttools) stay after uninstall: other extensions may share them, and the legacy installer also kept them. Sibling checkouts are detected only if their pyproject has a `[tool.fontlab-install]` table with a valid `id`; anything else (such as TypeRig) goes to uv.
|
|
114
|
+
- A legacy `install.vfpy` install of the same id is migrated first. Files it logged are removed; changed files are kept. If a kept file would collide with the new install, the install stops before it changes anything. Shared legacy tools (`fontlab_install.py`, `Scripts/Extensions/`) are removed once no legacy install remains.
|
|
115
|
+
|
|
114
116
|
## Development
|
|
115
117
|
|
|
116
118
|
```sh
|
|
@@ -26,7 +26,7 @@ version-file = "src/fontlab_instamix/__version__.py"
|
|
|
26
26
|
[tool.hatch.build.targets.wheel]
|
|
27
27
|
packages = ["src/fontlab_instamix"]
|
|
28
28
|
[tool.hatch.build.targets.sdist]
|
|
29
|
-
only-include = ["src", "tests", "examples", "install.vfpy", "pyproject.toml", "README.md", "PLAN.md", "LICENSE", "CHANGELOG.md", "test.sh", "build.sh", "publish.sh"]
|
|
29
|
+
only-include = ["src", "tests", "examples", "install.vfpy", "stub", "pyproject.toml", "README.md", "PLAN.md", "LICENSE", "CHANGELOG.md", "test.sh", "build.sh", "publish.sh"]
|
|
30
30
|
[tool.pytest.ini_options]
|
|
31
31
|
testpaths = ["tests"]
|
|
32
32
|
pythonpath = ["src"]
|
{fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/src/fontlab_instamix/__version__.py
RENAMED
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '1.0.
|
|
22
|
-
__version_tuple__ = version_tuple = (1, 0,
|
|
21
|
+
__version__ = version = '1.0.2'
|
|
22
|
+
__version_tuple__ = version_tuple = (1, 0, 2)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
# this_file: src/fontlab_instamix/bootstrap.py
|
|
2
|
+
"""Install a project checkout into FontLab from its ``install.vfpy``.
|
|
3
|
+
|
|
4
|
+
A project's ``install.vfpy`` needs two lines::
|
|
5
|
+
|
|
6
|
+
import fontlab_instamix.bootstrap as b
|
|
7
|
+
b.install_project(__file__)
|
|
8
|
+
|
|
9
|
+
It reads ``[tool.fontlab-install]`` from the project's ``pyproject.toml``
|
|
10
|
+
(keys: ``id``, ``name``, ``packages``, ``scripts``, ``extensions``,
|
|
11
|
+
``dependencies``, ``init-script``) and turns it into a ``.fontlabext``
|
|
12
|
+
installed by :mod:`fontlab_instamix.extension`, so the ledger and uninstall
|
|
13
|
+
are shared. Like the legacy ``install.vfpy`` it replaces, it removes an
|
|
14
|
+
earlier legacy install first, writes a ``.dist-info``, maps the top-level
|
|
15
|
+
``Scripts/`` onto FontLab's Scripts and ``Extensions/<kind>/`` bundles onto
|
|
16
|
+
FontLab's Extensions, and adds the FontApp startup block when asked.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
from __future__ import annotations
|
|
20
|
+
|
|
21
|
+
import json
|
|
22
|
+
import os
|
|
23
|
+
import re
|
|
24
|
+
import shutil
|
|
25
|
+
import tempfile
|
|
26
|
+
import tomllib
|
|
27
|
+
from dataclasses import dataclass, field
|
|
28
|
+
from pathlib import Path, PurePosixPath
|
|
29
|
+
|
|
30
|
+
from . import (
|
|
31
|
+
distinfo,
|
|
32
|
+
env,
|
|
33
|
+
extension,
|
|
34
|
+
initscript,
|
|
35
|
+
launchers,
|
|
36
|
+
ledger,
|
|
37
|
+
legacy,
|
|
38
|
+
manifest,
|
|
39
|
+
markers,
|
|
40
|
+
vcs,
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
DEFAULT_SCRIPTS = "Scripts"
|
|
44
|
+
DOCS_PREFIXES = (
|
|
45
|
+
"readme",
|
|
46
|
+
"license",
|
|
47
|
+
"licence",
|
|
48
|
+
"changelog",
|
|
49
|
+
) # top-level Scripts docs stay out
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class BootstrapError(RuntimeError):
|
|
53
|
+
"""The project has no usable ``[tool.fontlab-install]`` table."""
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
@dataclass(frozen=True)
|
|
57
|
+
class Project:
|
|
58
|
+
root: Path
|
|
59
|
+
id: str
|
|
60
|
+
name: str
|
|
61
|
+
version: str
|
|
62
|
+
packages: tuple[str, ...] = ()
|
|
63
|
+
scripts: tuple[str, ...] = ()
|
|
64
|
+
extensions: str = ""
|
|
65
|
+
dependencies: tuple[str, ...] = ()
|
|
66
|
+
extras: dict = field(default_factory=dict)
|
|
67
|
+
init_script: bool = False
|
|
68
|
+
extra: dict = field(default_factory=dict)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def _list(value, key: str) -> tuple[str, ...]:
|
|
72
|
+
if value is None:
|
|
73
|
+
return ()
|
|
74
|
+
if isinstance(value, str):
|
|
75
|
+
return (value,)
|
|
76
|
+
if isinstance(value, list) and all(isinstance(v, str) for v in value):
|
|
77
|
+
return tuple(value)
|
|
78
|
+
raise BootstrapError(
|
|
79
|
+
f"[tool.fontlab-install] {key} must be a string or list of strings"
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def find_root(start: Path) -> Path:
|
|
84
|
+
"""Folder holding ``pyproject.toml`` at or above ``start``."""
|
|
85
|
+
start = Path(start).resolve()
|
|
86
|
+
for folder in (start, *start.parents) if start.is_dir() else start.parents:
|
|
87
|
+
if (folder / "pyproject.toml").is_file():
|
|
88
|
+
return folder
|
|
89
|
+
raise BootstrapError(f"no pyproject.toml at or above {start}")
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def read_project(start: Path) -> Project:
|
|
93
|
+
"""Parse ``[tool.fontlab-install]`` from the nearest ``pyproject.toml``."""
|
|
94
|
+
root = find_root(start)
|
|
95
|
+
data = tomllib.loads((root / "pyproject.toml").read_text(encoding="utf-8"))
|
|
96
|
+
table = data.get("tool", {}).get("fontlab-install")
|
|
97
|
+
if not isinstance(table, dict):
|
|
98
|
+
raise BootstrapError(
|
|
99
|
+
f"{root / 'pyproject.toml'} has no [tool.fontlab-install] table"
|
|
100
|
+
)
|
|
101
|
+
ext_id = table.get("id")
|
|
102
|
+
if not isinstance(ext_id, str) or not manifest.ID_PATTERN.match(ext_id):
|
|
103
|
+
raise BootstrapError(
|
|
104
|
+
"[tool.fontlab-install] id must be a reverse-DNS id like com.example.tool"
|
|
105
|
+
)
|
|
106
|
+
project = data.get("project", {})
|
|
107
|
+
extensions = table.get("extensions", "")
|
|
108
|
+
if not isinstance(extensions, str):
|
|
109
|
+
raise BootstrapError("[tool.fontlab-install] extensions must be a folder name")
|
|
110
|
+
init = table.get("init-script", ext_id == initscript.APP_ID)
|
|
111
|
+
if not isinstance(init, bool):
|
|
112
|
+
raise BootstrapError("[tool.fontlab-install] init-script must be true or false")
|
|
113
|
+
known = {
|
|
114
|
+
"id",
|
|
115
|
+
"name",
|
|
116
|
+
"packages",
|
|
117
|
+
"scripts",
|
|
118
|
+
"extensions",
|
|
119
|
+
"dependencies",
|
|
120
|
+
"init-script",
|
|
121
|
+
}
|
|
122
|
+
return Project(
|
|
123
|
+
root=root,
|
|
124
|
+
id=ext_id,
|
|
125
|
+
name=str(table.get("name") or project.get("name") or ext_id),
|
|
126
|
+
version=vcs.project_version(root, data),
|
|
127
|
+
packages=_packages(table, data),
|
|
128
|
+
scripts=_scripts(root, table),
|
|
129
|
+
extensions=extensions,
|
|
130
|
+
dependencies=_list(
|
|
131
|
+
table.get("dependencies", project.get("dependencies")), "dependencies"
|
|
132
|
+
),
|
|
133
|
+
extras=_extras(project),
|
|
134
|
+
init_script=init,
|
|
135
|
+
extra={k: v for k, v in table.items() if k not in known},
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def _packages(table: dict, data: dict) -> tuple[str, ...]:
|
|
140
|
+
"""Listed packages, else the hatch wheel packages (as the legacy installer did)."""
|
|
141
|
+
if "packages" in table:
|
|
142
|
+
return _list(table["packages"], "packages")
|
|
143
|
+
wheel = (
|
|
144
|
+
data.get("tool", {})
|
|
145
|
+
.get("hatch", {})
|
|
146
|
+
.get("build", {})
|
|
147
|
+
.get("targets", {})
|
|
148
|
+
.get("wheel", {})
|
|
149
|
+
)
|
|
150
|
+
return _list(wheel.get("packages"), "packages")
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
def _scripts(root: Path, table: dict) -> tuple[str, ...]:
|
|
154
|
+
"""The top-level ``Scripts`` folder (exact case) plus the listed folders."""
|
|
155
|
+
listed = [
|
|
156
|
+
s.replace("\\", "/").strip("/") for s in _list(table.get("scripts"), "scripts")
|
|
157
|
+
]
|
|
158
|
+
top = (
|
|
159
|
+
[DEFAULT_SCRIPTS]
|
|
160
|
+
if DEFAULT_SCRIPTS in os.listdir(root) and (root / DEFAULT_SCRIPTS).is_dir()
|
|
161
|
+
else []
|
|
162
|
+
)
|
|
163
|
+
return tuple(dict.fromkeys(top + listed))
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def _extras(project: dict) -> dict[str, list[str]]:
|
|
167
|
+
extras = project.get("optional-dependencies", {})
|
|
168
|
+
if not isinstance(extras, dict):
|
|
169
|
+
raise BootstrapError("[project.optional-dependencies] must be a table")
|
|
170
|
+
return {
|
|
171
|
+
key: list(_list(value, f"optional-dependencies.{key}"))
|
|
172
|
+
for key, value in extras.items()
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def _script_rules(root: Path, folder: str) -> list[dict]:
|
|
177
|
+
"""Rules for one Scripts folder. The top-level ``Scripts`` maps child by
|
|
178
|
+
child, skipping README/LICENSE/Markdown docs that would collide in
|
|
179
|
+
FontLab's shared Scripts root; their subfolders still install whole."""
|
|
180
|
+
if folder != DEFAULT_SCRIPTS:
|
|
181
|
+
return [{"from": folder, "to": f"Scripts/{folder}"}]
|
|
182
|
+
rules = []
|
|
183
|
+
for child in sorted((root / folder).iterdir()):
|
|
184
|
+
lowered = child.name.lower()
|
|
185
|
+
if extension._junk(Path(child.name)) or (
|
|
186
|
+
child.is_file() and lowered.startswith(DOCS_PREFIXES)
|
|
187
|
+
):
|
|
188
|
+
continue
|
|
189
|
+
if child.is_file() and lowered.endswith(".md"):
|
|
190
|
+
continue
|
|
191
|
+
to = f"Scripts/{child.name}" if child.is_dir() else "Scripts"
|
|
192
|
+
rules.append({"from": f"{folder}/{child.name}", "to": to})
|
|
193
|
+
return rules
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
def manifest_data(project: Project) -> dict:
|
|
197
|
+
"""Manifest describing the project checkout as an extension.
|
|
198
|
+
|
|
199
|
+
The top-level ``Scripts`` folder maps onto FontLab's Scripts; any other
|
|
200
|
+
listed folder maps onto ``Scripts/<folder>``. Plugin bundles below
|
|
201
|
+
``<extensions>/<kind>/`` map onto FontLab's ``Extensions/<kind>/``.
|
|
202
|
+
"""
|
|
203
|
+
rules = [rule for f in project.scripts for rule in _script_rules(project.root, f)]
|
|
204
|
+
rules += [
|
|
205
|
+
{"from": rel, "to": "Extensions/" + "/".join(PurePosixPath(rel).parts[-2:])}
|
|
206
|
+
for rel in bundles(project)
|
|
207
|
+
]
|
|
208
|
+
for package in project.packages:
|
|
209
|
+
if not (project.root / package).is_dir():
|
|
210
|
+
raise BootstrapError(
|
|
211
|
+
f"package folder {package!r} not found in {project.root}"
|
|
212
|
+
)
|
|
213
|
+
data = {
|
|
214
|
+
"id": project.id,
|
|
215
|
+
"name": project.name,
|
|
216
|
+
"version": project.version,
|
|
217
|
+
"python": {"packages": list(project.packages), "requires": []},
|
|
218
|
+
"install": rules,
|
|
219
|
+
}
|
|
220
|
+
manifest.parse(data)
|
|
221
|
+
return data
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
def bundles(project: Project) -> list[str]:
|
|
225
|
+
"""``<extensions>/<kind>/<Name>.fontlab<Kind>`` folders that hold a ``plugin.json``."""
|
|
226
|
+
if not project.extensions or not (project.root / project.extensions).is_dir():
|
|
227
|
+
return []
|
|
228
|
+
found = []
|
|
229
|
+
for kind in sorted((project.root / project.extensions).iterdir()):
|
|
230
|
+
for bundle in sorted(kind.iterdir()) if kind.is_dir() else []:
|
|
231
|
+
if (
|
|
232
|
+
bundle.is_dir()
|
|
233
|
+
and ".fontlab" in bundle.suffix
|
|
234
|
+
and (bundle / "plugin.json").is_file()
|
|
235
|
+
):
|
|
236
|
+
found.append(bundle.relative_to(project.root).as_posix())
|
|
237
|
+
return found
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
def sibling_dependencies(project: Project) -> tuple[list[Path], list[str]]:
|
|
241
|
+
"""Split dependencies into sibling checkouts (with install.vfpy) and uv specs.
|
|
242
|
+
|
|
243
|
+
Dependencies whose environment marker does not apply to FontLab's
|
|
244
|
+
Python are skipped.
|
|
245
|
+
"""
|
|
246
|
+
siblings, specs = [], []
|
|
247
|
+
for spec in project.dependencies:
|
|
248
|
+
if not markers.applies(spec):
|
|
249
|
+
continue
|
|
250
|
+
name = markers.split(spec)[0]
|
|
251
|
+
for sep in "<>=!~[ (@":
|
|
252
|
+
name = name.split(sep)[0]
|
|
253
|
+
sibling = _sibling(project.root.parent, name.strip(), skip=project.root)
|
|
254
|
+
if sibling:
|
|
255
|
+
siblings.append(sibling)
|
|
256
|
+
else:
|
|
257
|
+
specs.append(spec)
|
|
258
|
+
return siblings, specs
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
def _norm(name: str) -> str:
|
|
262
|
+
"""PEP 503 name normalisation (``Foo_Bar.baz`` -> ``foo-bar-baz``)."""
|
|
263
|
+
return re.sub(r"[-_.]+", "-", name).lower()
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
def _sibling(parent: Path, name: str, skip: Path | None = None) -> Path | None:
|
|
267
|
+
"""Find the checkout beside *skip* that installs the dependency *name*.
|
|
268
|
+
|
|
269
|
+
Only folders with install.vfpy and a pyproject.toml holding a
|
|
270
|
+
``[tool.fontlab-install]`` table with a valid ``id`` count, matched by that
|
|
271
|
+
table's ``name`` or ``[project].name`` (never by folder name alone), so
|
|
272
|
+
unrelated checkouts such as TypeRig are left to uv. First sorted folder wins.
|
|
273
|
+
"""
|
|
274
|
+
wanted = _norm(name)
|
|
275
|
+
if not wanted or not parent.is_dir():
|
|
276
|
+
return None
|
|
277
|
+
for folder in sorted(parent.iterdir()):
|
|
278
|
+
if folder == skip or not (folder / "install.vfpy").is_file():
|
|
279
|
+
continue
|
|
280
|
+
try:
|
|
281
|
+
doc = tomllib.loads((folder / "pyproject.toml").read_text(encoding="utf-8"))
|
|
282
|
+
except (OSError, ValueError):
|
|
283
|
+
continue
|
|
284
|
+
tool, project = doc.get("tool"), doc.get("project")
|
|
285
|
+
table = tool.get("fontlab-install") if isinstance(tool, dict) else None
|
|
286
|
+
if not isinstance(table, dict) or not manifest.ID_PATTERN.match(str(table.get("id", ""))):
|
|
287
|
+
continue
|
|
288
|
+
names = {table.get("name"), project.get("name") if isinstance(project, dict) else None}
|
|
289
|
+
if wanted in {_norm(n) for n in names if isinstance(n, str)}:
|
|
290
|
+
return folder
|
|
291
|
+
return None
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
def install_project(
|
|
295
|
+
start,
|
|
296
|
+
data: Path | None = None,
|
|
297
|
+
*,
|
|
298
|
+
copy: bool | None = None,
|
|
299
|
+
requirements=None,
|
|
300
|
+
_seen: set | None = None,
|
|
301
|
+
) -> list[dict]:
|
|
302
|
+
"""Install the project around ``start`` (usually ``__file__``).
|
|
303
|
+
|
|
304
|
+
Packages are linked from the checkout (an editable install), scripts are
|
|
305
|
+
linked into FontLab's Scripts, sibling dependency checkouts are installed
|
|
306
|
+
first, other dependencies go through uv. A legacy ``install.vfpy``
|
|
307
|
+
install of the same id is removed first. Returns the ledger records.
|
|
308
|
+
"""
|
|
309
|
+
data = env.data_dir(data)
|
|
310
|
+
project = read_project(Path(start))
|
|
311
|
+
seen = _seen if _seen is not None else set()
|
|
312
|
+
if project.root in seen:
|
|
313
|
+
return []
|
|
314
|
+
seen.add(project.root)
|
|
315
|
+
records: list[dict] = []
|
|
316
|
+
siblings, specs = sibling_dependencies(project)
|
|
317
|
+
for sibling in siblings:
|
|
318
|
+
records += install_project(
|
|
319
|
+
sibling, data, copy=copy, requirements=requirements, _seen=seen
|
|
320
|
+
)
|
|
321
|
+
data_manifest = manifest_data(project)
|
|
322
|
+
data_manifest["python"]["requires"] = specs
|
|
323
|
+
records.append(_install_checkout(project, data_manifest, data, copy, requirements))
|
|
324
|
+
launchers.write_list(data)
|
|
325
|
+
if project.extensions and (project.root / project.extensions).is_dir():
|
|
326
|
+
for folder in sorted((project.root / project.extensions).rglob("*")):
|
|
327
|
+
nested = any(
|
|
328
|
+
extension.is_ext(part)
|
|
329
|
+
for part in folder.relative_to(project.root).parts[:-1]
|
|
330
|
+
)
|
|
331
|
+
if folder.is_dir() and extension.is_ext(folder.name) and not nested:
|
|
332
|
+
records += extension.install(
|
|
333
|
+
folder, data, copy=copy, requirements=requirements
|
|
334
|
+
)
|
|
335
|
+
return records
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
def _install_checkout(
|
|
339
|
+
project: Project, data_manifest: dict, data: Path, copy, requirements
|
|
340
|
+
) -> dict:
|
|
341
|
+
"""Install the checkout through a tiny generated ``.fontlabext`` of links."""
|
|
342
|
+
with tempfile.TemporaryDirectory(prefix="instamix-project-") as temp:
|
|
343
|
+
folder = Path(temp) / f"{project.id}.fontlabext"
|
|
344
|
+
folder.mkdir()
|
|
345
|
+
copied = False
|
|
346
|
+
for rel in [r["from"] for r in data_manifest["install"]] + data_manifest[
|
|
347
|
+
"python"
|
|
348
|
+
]["packages"]:
|
|
349
|
+
copied = _mirror(project.root / rel, folder / rel) or copied
|
|
350
|
+
(folder / manifest.MANIFEST).write_text(
|
|
351
|
+
json.dumps(data_manifest), encoding="utf-8"
|
|
352
|
+
)
|
|
353
|
+
migrated = migrate_legacy(project, folder, data)
|
|
354
|
+
# Files copied into the temp folder vanish afterwards, so never link to them.
|
|
355
|
+
copy = True if copied else copy
|
|
356
|
+
record = _install_after_migration(
|
|
357
|
+
migrated,
|
|
358
|
+
project.id,
|
|
359
|
+
lambda: extension.install_folder(
|
|
360
|
+
folder,
|
|
361
|
+
data,
|
|
362
|
+
copy=copy,
|
|
363
|
+
requirements=requirements,
|
|
364
|
+
editable=True,
|
|
365
|
+
finish=lambda target: _finish(project, data_manifest, target),
|
|
366
|
+
fields={"init_script": True} if project.init_script else None,
|
|
367
|
+
),
|
|
368
|
+
)
|
|
369
|
+
if project.init_script:
|
|
370
|
+
initscript.update(data)
|
|
371
|
+
return record
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
def _install_after_migration(migrated, ext_id: str, install):
|
|
375
|
+
"""Run *install*; after a legacy migration, say how to recover from a failure."""
|
|
376
|
+
try:
|
|
377
|
+
return install()
|
|
378
|
+
except Exception as exc:
|
|
379
|
+
if not migrated:
|
|
380
|
+
raise
|
|
381
|
+
raise BootstrapError(
|
|
382
|
+
f"The legacy install of {ext_id} was removed, but the new install failed: {exc}. Fix the cause and run install.vfpy again."
|
|
383
|
+
) from exc
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
def _mirror(source: Path, target: Path) -> bool:
|
|
387
|
+
"""Link *source* at *target*; copy when links fail. Return True if copied."""
|
|
388
|
+
target.parent.mkdir(parents=True, exist_ok=True)
|
|
389
|
+
try:
|
|
390
|
+
target.symlink_to(source, target_is_directory=source.is_dir())
|
|
391
|
+
return False
|
|
392
|
+
except OSError: # Windows without symlink rights: copy (not live)
|
|
393
|
+
if source.is_dir():
|
|
394
|
+
shutil.copytree(source, target)
|
|
395
|
+
else:
|
|
396
|
+
shutil.copy2(source, target)
|
|
397
|
+
return True
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
def migrate_legacy(project: Project, folder: Path, data: Path) -> dict | None:
|
|
401
|
+
"""Remove a legacy ``install.vfpy`` install of this project, if one is active."""
|
|
402
|
+
info = manifest.load(folder)
|
|
403
|
+
pairs = extension.plan(folder, info, extension.basename(folder), data)
|
|
404
|
+
files = [source for source, _ in pairs if source.is_file()]
|
|
405
|
+
known = {ledger.sha256(source.resolve()) for source in files}
|
|
406
|
+
targets = {target.relative_to(data).as_posix() for _, target in pairs}
|
|
407
|
+
site = env.site_packages(data).relative_to(data).as_posix()
|
|
408
|
+
targets |= {f"{site}/{distinfo.folder_name(project.name, project.version)}"}
|
|
409
|
+
return legacy.migrate(data, project.id, known, targets)
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
def _finish(project: Project, data_manifest: dict, data: Path) -> list[Path]:
|
|
413
|
+
"""Write the dist-info and the uninstall launcher; return them, folders first."""
|
|
414
|
+
for old in distinfo.stale(data, project.name):
|
|
415
|
+
shutil.rmtree(old)
|
|
416
|
+
requires = list(project.dependencies)
|
|
417
|
+
packages = [Path(package).name for package in project.packages]
|
|
418
|
+
written = distinfo.write(
|
|
419
|
+
data, project.name, project.version, requires, project.extras, packages
|
|
420
|
+
)
|
|
421
|
+
return [written[0].parent, *written, *launchers.write_uninstaller(data, project.id)]
|
|
@@ -8,7 +8,7 @@ import json
|
|
|
8
8
|
import sys
|
|
9
9
|
from pathlib import Path
|
|
10
10
|
|
|
11
|
-
from . import __version__, bootstrap, env, extension, packages, uv, venv, wrap
|
|
11
|
+
from . import __version__, bootstrap, env, extension, packages, stub, uv, venv, wrap
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
def _data(args) -> Path:
|
|
@@ -93,6 +93,12 @@ def cmd_venv(args) -> int:
|
|
|
93
93
|
return 0
|
|
94
94
|
|
|
95
95
|
|
|
96
|
+
def cmd_stub(args) -> int:
|
|
97
|
+
for folder in args.folders:
|
|
98
|
+
print(f"wrote {stub.write(Path(folder), force=args.force)}")
|
|
99
|
+
return 0
|
|
100
|
+
|
|
101
|
+
|
|
96
102
|
def parser() -> argparse.ArgumentParser:
|
|
97
103
|
p = argparse.ArgumentParser(prog="fontlab-instamix", description="Install extensions and packages into FontLab 9.")
|
|
98
104
|
p.add_argument("--version", action="version", version=__version__)
|
|
@@ -145,6 +151,11 @@ def parser() -> argparse.ArgumentParser:
|
|
|
145
151
|
s.set_defaults(func=cmd_uv_fetch)
|
|
146
152
|
|
|
147
153
|
sub.add_parser("venv", help="create <data>/.venv for Python 3.11").set_defaults(func=cmd_venv)
|
|
154
|
+
|
|
155
|
+
s = sub.add_parser("stub", help="write the instamix install.vfpy stub into repo folders")
|
|
156
|
+
s.add_argument("folders", nargs="+")
|
|
157
|
+
s.add_argument("--force", action="store_true", help="replace an existing install.vfpy")
|
|
158
|
+
s.set_defaults(func=cmd_stub)
|
|
148
159
|
return p
|
|
149
160
|
|
|
150
161
|
|
{fontlab_python_instamix-1.0.0 → fontlab_python_instamix-1.0.2}/src/fontlab_instamix/dest.py
RENAMED
|
@@ -13,7 +13,8 @@ from __future__ import annotations
|
|
|
13
13
|
import re
|
|
14
14
|
from pathlib import PurePosixPath
|
|
15
15
|
|
|
16
|
-
TARGETS = ("Scripts", "Actions", "Codepage", "Data", "Encoding", "site-packages")
|
|
16
|
+
TARGETS = ("Scripts", "Actions", "Codepage", "Data", "Encoding", "Extensions", "site-packages")
|
|
17
|
+
RESERVED = {"extensions": {".instamix", "library"}} # instamix's own folders
|
|
17
18
|
SITE_PACKAGES = "python/3.11/site-packages"
|
|
18
19
|
_VAR = re.compile(r"\{([^{}]*)\}")
|
|
19
20
|
|
|
@@ -68,4 +69,7 @@ def resolve(rule: str, basename: str, variables: dict[str, str] | None = None) -
|
|
|
68
69
|
if any("\\" in p or ":" in p for p in parts): # Windows separators or drives
|
|
69
70
|
raise DestError(f"destination parts may not contain '\\' or ':': {expanded!r}")
|
|
70
71
|
root = target_root(target_name(parts[0]))
|
|
72
|
+
reserved = RESERVED.get(root.lower())
|
|
73
|
+
if reserved is not None and (len(parts) < 2 or parts[1].lower() in reserved):
|
|
74
|
+
raise DestError(f"{root} needs a subfolder other than {', '.join(sorted(reserved))}: {rule!r}")
|
|
71
75
|
return str(PurePosixPath(root, *parts[1:]))
|