ivaldi 0.1.7__tar.gz → 0.3.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.
- ivaldi-0.3.2/LICENSE +21 -0
- ivaldi-0.3.2/PKG-INFO +181 -0
- ivaldi-0.3.2/README.md +160 -0
- ivaldi-0.3.2/THIRD_PARTY_NOTICES.md +43 -0
- ivaldi-0.3.2/ivaldi/__init__.py +71 -0
- ivaldi-0.3.2/ivaldi/__main__.py +3 -0
- ivaldi-0.3.2/ivaldi/commands/build.py +19 -0
- ivaldi-0.3.2/ivaldi/commands/install.py +24 -0
- ivaldi-0.3.2/ivaldi/commands/run.py +35 -0
- ivaldi-0.3.2/ivaldi/shared/admin.py +21 -0
- ivaldi-0.3.2/ivaldi/shared/alias.py +90 -0
- ivaldi-0.3.2/ivaldi/shared/build.py +167 -0
- ivaldi-0.3.2/ivaldi/shared/collect.py +104 -0
- {ivaldi-0.1.7 → ivaldi-0.3.2}/ivaldi/shared/extract.py +1 -1
- ivaldi-0.3.2/ivaldi/shared/project.py +95 -0
- ivaldi-0.3.2/ivaldi/shared/python.py +96 -0
- ivaldi-0.3.2/ivaldi/shared/settings.py +232 -0
- ivaldi-0.3.2/ivaldi/shared/uv.py +71 -0
- {ivaldi-0.1.7/ivaldi → ivaldi-0.3.2/ivaldi/types}/enums.py +16 -0
- ivaldi-0.3.2/ivaldi/types/settings.py +161 -0
- ivaldi-0.3.2/pyproject.toml +41 -0
- ivaldi-0.1.7/PKG-INFO +0 -16
- ivaldi-0.1.7/README.md +0 -1
- ivaldi-0.1.7/ivaldi/__init__.py +0 -45
- ivaldi-0.1.7/ivaldi/mac/installer.py +0 -10
- ivaldi-0.1.7/ivaldi/settings.py +0 -92
- ivaldi-0.1.7/ivaldi/shared/collect.py +0 -56
- ivaldi-0.1.7/ivaldi/shared/load_settings.py +0 -60
- ivaldi-0.1.7/ivaldi/shared/python.py +0 -27
- ivaldi-0.1.7/ivaldi/shared/uv.py +0 -69
- ivaldi-0.1.7/ivaldi/win/installer.py +0 -0
- ivaldi-0.1.7/pyproject.toml +0 -64
- /ivaldi-0.1.7/ivaldi/linux/installer.py → /ivaldi-0.3.2/ivaldi/stage/.gitkeep +0 -0
ivaldi-0.3.2/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Fionn Tolster
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
ivaldi-0.3.2/PKG-INFO
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ivaldi
|
|
3
|
+
Version: 0.3.2
|
|
4
|
+
Summary: Create a portable version of your Python Project
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
License-File: THIRD_PARTY_NOTICES.md
|
|
8
|
+
Author: Fionn Tolster (@FionnT)
|
|
9
|
+
Requires-Python: >3.10
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
15
|
+
Requires-Dist: build (>=1.5.0,<2.0.0)
|
|
16
|
+
Requires-Dist: nuitka[all] (>=4.1.3,<5.0.0)
|
|
17
|
+
Requires-Dist: requests (>=2.34.2,<3.0.0)
|
|
18
|
+
Requires-Dist: zstandard (>=0.25.0,<0.26.0)
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
|
|
21
|
+
# Ivaldi
|
|
22
|
+
|
|
23
|
+
Ivaldi turns a Python project into a platform-specific, one-file launcher. The launcher embeds the project's wheel and configuration, installs a UV-managed Python environment on its first run, and forwards every later invocation to the installed application.
|
|
24
|
+
|
|
25
|
+
[](https://github.com/FionnT/ivaldi/issues) | [](https://github.com/FionnT/Ivaldi/actions/workflows/code_quality.yaml) [](https://github.com/FionnT/ivaldi/tree/python-coverage-comment-action-data)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## Configuration
|
|
29
|
+
|
|
30
|
+
Add `ivaldi.toml` to the project being wrapped:
|
|
31
|
+
|
|
32
|
+
```toml
|
|
33
|
+
[app]
|
|
34
|
+
entrypoint = "my_package.cli:main"
|
|
35
|
+
include = ["my_package/**/*", "README.md"]
|
|
36
|
+
|
|
37
|
+
[uv]
|
|
38
|
+
version = "0.12.3"
|
|
39
|
+
install_args = []
|
|
40
|
+
build_args = []
|
|
41
|
+
|
|
42
|
+
[uvx]
|
|
43
|
+
build_args = []
|
|
44
|
+
|
|
45
|
+
[python]
|
|
46
|
+
version = "3.14.5"
|
|
47
|
+
install_args = []
|
|
48
|
+
|
|
49
|
+
[nuitka]
|
|
50
|
+
build_args = []
|
|
51
|
+
company-name = "Example Company"
|
|
52
|
+
product-name = "My Application"
|
|
53
|
+
file-description = "My packaged Python application"
|
|
54
|
+
icon = "./docs/icon.png"
|
|
55
|
+
|
|
56
|
+
[darwin]
|
|
57
|
+
name = "My Application"
|
|
58
|
+
alias = "my-app"
|
|
59
|
+
location = "com.example.my-app"
|
|
60
|
+
add_to_path = true
|
|
61
|
+
admin = false
|
|
62
|
+
|
|
63
|
+
[linux]
|
|
64
|
+
name = "My Application"
|
|
65
|
+
alias = "my-app"
|
|
66
|
+
location = "my-app"
|
|
67
|
+
add_to_path = true
|
|
68
|
+
admin = false
|
|
69
|
+
|
|
70
|
+
[windows]
|
|
71
|
+
name = "My Application"
|
|
72
|
+
alias = "my-app"
|
|
73
|
+
location = "MyApplication"
|
|
74
|
+
add_to_path = true
|
|
75
|
+
admin = false
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
The configuration can instead live under `[tool.ivaldi]` in `pyproject.toml`. Prefix each normal section with `tool.ivaldi`, for example:
|
|
79
|
+
|
|
80
|
+
```toml
|
|
81
|
+
[tool.ivaldi.app]
|
|
82
|
+
entrypoint = "my_package.cli:main"
|
|
83
|
+
include = ["my_package/**/*"]
|
|
84
|
+
|
|
85
|
+
[tool.ivaldi.python]
|
|
86
|
+
version = "3.14.5"
|
|
87
|
+
|
|
88
|
+
...
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
When no standalone configuration exists, Ivaldi extracts only `[tool.ivaldi]` and writes it to a project-root `ivaldi.toml` before building. Generated files include a schema directive and are refreshed when `[tool.ivaldi]` changes; a hand-written standalone file remains authoritative. The formal configuration definition is available in [`ivaldi.schema.json`](ivaldi.schema.json), and the same schema describes the object nested under `[tool.ivaldi]`.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
## Configuration Flags
|
|
99
|
+
|
|
100
|
+
All default settings and flags are visible in [the ivaldi settings dataclass](/ivaldi/types/settings.py)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
```yaml
|
|
104
|
+
app.entrypoint:
|
|
105
|
+
description: The entrypoint for your application. Can be a module e.g. `mycli` or a specific command, e.g. `mycli:main`
|
|
106
|
+
type: str
|
|
107
|
+
example: mycli:main
|
|
108
|
+
app.include:
|
|
109
|
+
description: Controls which source files are copied to Ivaldi's clean wheel-build stage.
|
|
110
|
+
note: `pyproject.toml` is always included. Add any files referenced by the build configuration, such as a README or license.
|
|
111
|
+
type: list[glob]
|
|
112
|
+
example: ["*.py"]
|
|
113
|
+
app.exclude:
|
|
114
|
+
description: Specify files to exclude by a matching pattern.
|
|
115
|
+
note: If a file would be excluded, but a more specific include would include it, it is superseded by include
|
|
116
|
+
type: list[glob]
|
|
117
|
+
example: ["*.pyc"]
|
|
118
|
+
[uv,python].version:
|
|
119
|
+
description: Which Python or UVX version to use for your application.
|
|
120
|
+
No compatability checks are performed, and the wrapped executable does not compile with these versions.
|
|
121
|
+
`ivaldi build` will use local Python and UV, fetching only UV if required.
|
|
122
|
+
[uv,uvx,python].install_args:
|
|
123
|
+
description: Are passed through to the corresponding UV, UVX, Python, and Nuitka commands.
|
|
124
|
+
note: Overwrites defaults, does not merge them.
|
|
125
|
+
type: list[flag]
|
|
126
|
+
example: ["--compile",]
|
|
127
|
+
[uv,uvx,python].build_args:
|
|
128
|
+
description: Are passed through to the corresponding UV, UVX, Python, and Nuitka commands.
|
|
129
|
+
note: Overwrites defaults, does not merge them.
|
|
130
|
+
type: list[flag]
|
|
131
|
+
example: ["--compile",]
|
|
132
|
+
add_to_path:
|
|
133
|
+
description: When true, Ivaldi copies the launcher into the platform bin directory (e.g. `~/.local/bin`, `~/.bin`)
|
|
134
|
+
type: bool
|
|
135
|
+
alias:
|
|
136
|
+
description: In Unix-like systems, adds an idempotent managed alias pointing to that copy.
|
|
137
|
+
note: Attempts to locate the active shell's startup file (`.zshrc`, `.bash_profile`, `.bashrc`, Fish's `config.fish`, or `.profile` as applicable).
|
|
138
|
+
When false, no command alias is installed. Your command might still be accessible if `add_to_path` was `true`
|
|
139
|
+
type: string
|
|
140
|
+
admin:
|
|
141
|
+
description: Requires sudo/administrator privileges for installation or application runs.
|
|
142
|
+
note: Ivaldi does not elevate itself. It stops and asks to be rerun with sudo (or as Administrator on Windows).
|
|
143
|
+
values:
|
|
144
|
+
- `install` requires sudo only for first-run installation. exits after installation so the application can subsequently be run without elevation.
|
|
145
|
+
- `run` requires sudo only for running the installed application.
|
|
146
|
+
- `true` requires sudo for running and installation.
|
|
147
|
+
- `false` never requires them.
|
|
148
|
+
type: Literal[true, false, 'install', 'run']
|
|
149
|
+
nuitka:
|
|
150
|
+
description: Nuitka metadata is passed as `--company-name`, `--product-name`, and `--file-description`.
|
|
151
|
+
note: Relative icon paths are resolved from the wrapped project and translated to the platform-specific Nuitka icon option.
|
|
152
|
+
name:
|
|
153
|
+
description: The name to give your executable program
|
|
154
|
+
type: str
|
|
155
|
+
example: mycli
|
|
156
|
+
company:
|
|
157
|
+
description:
|
|
158
|
+
type: str
|
|
159
|
+
example: My Company
|
|
160
|
+
icon:
|
|
161
|
+
description: The icon for your program. Will only be visible on Windows, some Linux distro's, and if your application launches a GUI of some kind.
|
|
162
|
+
type: str(path)
|
|
163
|
+
example: ./static/mycli.png
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
## Build and run
|
|
169
|
+
|
|
170
|
+
From the wrapped project:
|
|
171
|
+
|
|
172
|
+
```console
|
|
173
|
+
ivaldi build
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
The command builds the project wheel in an isolated environment, places the wheel and `ivaldi.toml` in the embedded payload, optionally collects dependency wheels, and invokes Nuitka. The generated launcher is written to the project's `dist/` directory using the current platform's `alias`. Nuitka uses cached onefile extraction under a cache directory named by the platform's `location` value.
|
|
177
|
+
|
|
178
|
+
If dependency wheels are requested, Ivaldi uses `uv` from `PATH` when available. Otherwise it downloads the configured UV release into a versioned local tool cache and uses that copy.
|
|
179
|
+
|
|
180
|
+
On the launcher's first run, Ivaldi downloads UV and the configured Python, creates a dedicated virtual environment in the platform data directory, installs the embedded wheel, and runs the configured entrypoint. Subsequent runs skip installation and forward their arguments through UV to that managed Python environment.
|
|
181
|
+
|
ivaldi-0.3.2/README.md
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# Ivaldi
|
|
2
|
+
|
|
3
|
+
Ivaldi turns a Python project into a platform-specific, one-file launcher. The launcher embeds the project's wheel and configuration, installs a UV-managed Python environment on its first run, and forwards every later invocation to the installed application.
|
|
4
|
+
|
|
5
|
+
[](https://github.com/FionnT/ivaldi/issues) | [](https://github.com/FionnT/Ivaldi/actions/workflows/code_quality.yaml) [](https://github.com/FionnT/ivaldi/tree/python-coverage-comment-action-data)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## Configuration
|
|
9
|
+
|
|
10
|
+
Add `ivaldi.toml` to the project being wrapped:
|
|
11
|
+
|
|
12
|
+
```toml
|
|
13
|
+
[app]
|
|
14
|
+
entrypoint = "my_package.cli:main"
|
|
15
|
+
include = ["my_package/**/*", "README.md"]
|
|
16
|
+
|
|
17
|
+
[uv]
|
|
18
|
+
version = "0.12.3"
|
|
19
|
+
install_args = []
|
|
20
|
+
build_args = []
|
|
21
|
+
|
|
22
|
+
[uvx]
|
|
23
|
+
build_args = []
|
|
24
|
+
|
|
25
|
+
[python]
|
|
26
|
+
version = "3.14.5"
|
|
27
|
+
install_args = []
|
|
28
|
+
|
|
29
|
+
[nuitka]
|
|
30
|
+
build_args = []
|
|
31
|
+
company-name = "Example Company"
|
|
32
|
+
product-name = "My Application"
|
|
33
|
+
file-description = "My packaged Python application"
|
|
34
|
+
icon = "./docs/icon.png"
|
|
35
|
+
|
|
36
|
+
[darwin]
|
|
37
|
+
name = "My Application"
|
|
38
|
+
alias = "my-app"
|
|
39
|
+
location = "com.example.my-app"
|
|
40
|
+
add_to_path = true
|
|
41
|
+
admin = false
|
|
42
|
+
|
|
43
|
+
[linux]
|
|
44
|
+
name = "My Application"
|
|
45
|
+
alias = "my-app"
|
|
46
|
+
location = "my-app"
|
|
47
|
+
add_to_path = true
|
|
48
|
+
admin = false
|
|
49
|
+
|
|
50
|
+
[windows]
|
|
51
|
+
name = "My Application"
|
|
52
|
+
alias = "my-app"
|
|
53
|
+
location = "MyApplication"
|
|
54
|
+
add_to_path = true
|
|
55
|
+
admin = false
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The configuration can instead live under `[tool.ivaldi]` in `pyproject.toml`. Prefix each normal section with `tool.ivaldi`, for example:
|
|
59
|
+
|
|
60
|
+
```toml
|
|
61
|
+
[tool.ivaldi.app]
|
|
62
|
+
entrypoint = "my_package.cli:main"
|
|
63
|
+
include = ["my_package/**/*"]
|
|
64
|
+
|
|
65
|
+
[tool.ivaldi.python]
|
|
66
|
+
version = "3.14.5"
|
|
67
|
+
|
|
68
|
+
...
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
When no standalone configuration exists, Ivaldi extracts only `[tool.ivaldi]` and writes it to a project-root `ivaldi.toml` before building. Generated files include a schema directive and are refreshed when `[tool.ivaldi]` changes; a hand-written standalone file remains authoritative. The formal configuration definition is available in [`ivaldi.schema.json`](ivaldi.schema.json), and the same schema describes the object nested under `[tool.ivaldi]`.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
## Configuration Flags
|
|
79
|
+
|
|
80
|
+
All default settings and flags are visible in [the ivaldi settings dataclass](/ivaldi/types/settings.py)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
```yaml
|
|
84
|
+
app.entrypoint:
|
|
85
|
+
description: The entrypoint for your application. Can be a module e.g. `mycli` or a specific command, e.g. `mycli:main`
|
|
86
|
+
type: str
|
|
87
|
+
example: mycli:main
|
|
88
|
+
app.include:
|
|
89
|
+
description: Controls which source files are copied to Ivaldi's clean wheel-build stage.
|
|
90
|
+
note: `pyproject.toml` is always included. Add any files referenced by the build configuration, such as a README or license.
|
|
91
|
+
type: list[glob]
|
|
92
|
+
example: ["*.py"]
|
|
93
|
+
app.exclude:
|
|
94
|
+
description: Specify files to exclude by a matching pattern.
|
|
95
|
+
note: If a file would be excluded, but a more specific include would include it, it is superseded by include
|
|
96
|
+
type: list[glob]
|
|
97
|
+
example: ["*.pyc"]
|
|
98
|
+
[uv,python].version:
|
|
99
|
+
description: Which Python or UVX version to use for your application.
|
|
100
|
+
No compatability checks are performed, and the wrapped executable does not compile with these versions.
|
|
101
|
+
`ivaldi build` will use local Python and UV, fetching only UV if required.
|
|
102
|
+
[uv,uvx,python].install_args:
|
|
103
|
+
description: Are passed through to the corresponding UV, UVX, Python, and Nuitka commands.
|
|
104
|
+
note: Overwrites defaults, does not merge them.
|
|
105
|
+
type: list[flag]
|
|
106
|
+
example: ["--compile",]
|
|
107
|
+
[uv,uvx,python].build_args:
|
|
108
|
+
description: Are passed through to the corresponding UV, UVX, Python, and Nuitka commands.
|
|
109
|
+
note: Overwrites defaults, does not merge them.
|
|
110
|
+
type: list[flag]
|
|
111
|
+
example: ["--compile",]
|
|
112
|
+
add_to_path:
|
|
113
|
+
description: When true, Ivaldi copies the launcher into the platform bin directory (e.g. `~/.local/bin`, `~/.bin`)
|
|
114
|
+
type: bool
|
|
115
|
+
alias:
|
|
116
|
+
description: In Unix-like systems, adds an idempotent managed alias pointing to that copy.
|
|
117
|
+
note: Attempts to locate the active shell's startup file (`.zshrc`, `.bash_profile`, `.bashrc`, Fish's `config.fish`, or `.profile` as applicable).
|
|
118
|
+
When false, no command alias is installed. Your command might still be accessible if `add_to_path` was `true`
|
|
119
|
+
type: string
|
|
120
|
+
admin:
|
|
121
|
+
description: Requires sudo/administrator privileges for installation or application runs.
|
|
122
|
+
note: Ivaldi does not elevate itself. It stops and asks to be rerun with sudo (or as Administrator on Windows).
|
|
123
|
+
values:
|
|
124
|
+
- `install` requires sudo only for first-run installation. exits after installation so the application can subsequently be run without elevation.
|
|
125
|
+
- `run` requires sudo only for running the installed application.
|
|
126
|
+
- `true` requires sudo for running and installation.
|
|
127
|
+
- `false` never requires them.
|
|
128
|
+
type: Literal[true, false, 'install', 'run']
|
|
129
|
+
nuitka:
|
|
130
|
+
description: Nuitka metadata is passed as `--company-name`, `--product-name`, and `--file-description`.
|
|
131
|
+
note: Relative icon paths are resolved from the wrapped project and translated to the platform-specific Nuitka icon option.
|
|
132
|
+
name:
|
|
133
|
+
description: The name to give your executable program
|
|
134
|
+
type: str
|
|
135
|
+
example: mycli
|
|
136
|
+
company:
|
|
137
|
+
description:
|
|
138
|
+
type: str
|
|
139
|
+
example: My Company
|
|
140
|
+
icon:
|
|
141
|
+
description: The icon for your program. Will only be visible on Windows, some Linux distro's, and if your application launches a GUI of some kind.
|
|
142
|
+
type: str(path)
|
|
143
|
+
example: ./static/mycli.png
|
|
144
|
+
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
## Build and run
|
|
149
|
+
|
|
150
|
+
From the wrapped project:
|
|
151
|
+
|
|
152
|
+
```console
|
|
153
|
+
ivaldi build
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
The command builds the project wheel in an isolated environment, places the wheel and `ivaldi.toml` in the embedded payload, optionally collects dependency wheels, and invokes Nuitka. The generated launcher is written to the project's `dist/` directory using the current platform's `alias`. Nuitka uses cached onefile extraction under a cache directory named by the platform's `location` value.
|
|
157
|
+
|
|
158
|
+
If dependency wheels are requested, Ivaldi uses `uv` from `PATH` when available. Otherwise it downloads the configured UV release into a versioned local tool cache and uses that copy.
|
|
159
|
+
|
|
160
|
+
On the launcher's first run, Ivaldi downloads UV and the configured Python, creates a dedicated virtual environment in the platform data directory, installs the embedded wheel, and runs the configured entrypoint. Subsequent runs skip installation and forward their arguments through UV to that managed Python environment.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
Ivaldi uses third-party software when building and running its launchers. This
|
|
4
|
+
file records the principal licensing considerations. It does not replace the
|
|
5
|
+
licence notices for dependencies contained in an application packaged by an
|
|
6
|
+
Ivaldi user.
|
|
7
|
+
|
|
8
|
+
## Nuitka
|
|
9
|
+
|
|
10
|
+
Ivaldi invokes Nuitka as a build tool to compile the Ivaldi launcher.
|
|
11
|
+
|
|
12
|
+
- Project: [Nuitka](https://github.com/Nuitka/Nuitka)
|
|
13
|
+
- Copyright: Copyright (c) 2008-2026 Kay Hayen and contributors
|
|
14
|
+
- Compiler licence: [GNU Affero General Public License, version 3](https://github.com/Nuitka/Nuitka/blob/4.1.3/LICENSE.txt)
|
|
15
|
+
- Runtime terms: [Nuitka Runtime Library Exception, version 1.0](https://github.com/Nuitka/Nuitka/blob/4.1.3/LICENSE-RUNTIME.txt)
|
|
16
|
+
|
|
17
|
+
The Runtime Library Exception permits executables and libraries produced by
|
|
18
|
+
Nuitka's compilation process to be conveyed under terms of the distributor's
|
|
19
|
+
choice when the exception's conditions are met. It does not change the AGPLv3
|
|
20
|
+
terms that apply to the Nuitka compiler itself.
|
|
21
|
+
|
|
22
|
+
Ivaldi does not incorporate or redistribute the Nuitka compiler as part of a
|
|
23
|
+
generated launcher. Anyone who separately redistributes or modifies Nuitka is
|
|
24
|
+
responsible for complying with the compiler's AGPLv3 terms.
|
|
25
|
+
|
|
26
|
+
## CPython
|
|
27
|
+
|
|
28
|
+
Nuitka-generated standalone and one-file launchers may include or link against
|
|
29
|
+
components of CPython.
|
|
30
|
+
|
|
31
|
+
- Project: [Python](https://www.python.org/)
|
|
32
|
+
- Licence: [Python Software Foundation License Version 2 and component notices](https://docs.python.org/3/license.html)
|
|
33
|
+
|
|
34
|
+
The applicable CPython licence and bundled component notices remain in effect
|
|
35
|
+
for those components.
|
|
36
|
+
|
|
37
|
+
## Packaged applications and dependencies
|
|
38
|
+
|
|
39
|
+
An Ivaldi launcher embeds the packaged application's wheel and may also embed
|
|
40
|
+
its dependency wheels. Those projects retain their own copyright and licence
|
|
41
|
+
terms. The person distributing a generated launcher is responsible for
|
|
42
|
+
including any notices, source offers, or other materials required by those
|
|
43
|
+
licences.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import sys
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
from ivaldi.commands.build import build as _build
|
|
6
|
+
from ivaldi.commands.install import install as _install
|
|
7
|
+
from ivaldi.commands.run import run as _run
|
|
8
|
+
from ivaldi.shared.admin import is_admin, needs_admin, run_elevated
|
|
9
|
+
from ivaldi.shared.settings import is_installed, load_settings
|
|
10
|
+
|
|
11
|
+
logging.basicConfig(
|
|
12
|
+
force=True,
|
|
13
|
+
level=logging.INFO,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
location = Path(__file__).parent
|
|
17
|
+
usage = "Usage: ivaldi {build,install,run} [args ...]"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def main(args=None):
|
|
21
|
+
arguments = sys.argv[1:] if args is None else args
|
|
22
|
+
if not arguments or arguments[0] in {"-h", "--help"}:
|
|
23
|
+
print(usage)
|
|
24
|
+
return 0
|
|
25
|
+
|
|
26
|
+
command, *command_args = arguments
|
|
27
|
+
if command == "run":
|
|
28
|
+
return _run(location, command_args)
|
|
29
|
+
if command_args:
|
|
30
|
+
raise SystemExit(f"{command} does not accept arguments\n{usage}")
|
|
31
|
+
if command == "build":
|
|
32
|
+
_build(location)
|
|
33
|
+
return 0
|
|
34
|
+
if command == "install":
|
|
35
|
+
_install(location)
|
|
36
|
+
return 0
|
|
37
|
+
raise SystemExit(f"Unknown command: {command}\n{usage}")
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def build():
|
|
41
|
+
_build(location)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def install():
|
|
45
|
+
_install(location)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def run():
|
|
49
|
+
return _run(location)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def application(args=None, executable=None):
|
|
53
|
+
"""Install the bundled application once, then run it with the given arguments."""
|
|
54
|
+
arguments = sys.argv[1:] if args is None else args
|
|
55
|
+
launcher = Path(sys.argv[0] if executable is None else executable).resolve()
|
|
56
|
+
settings = load_settings(location=location, build=False)
|
|
57
|
+
installed = is_installed(settings)
|
|
58
|
+
administrator = is_admin()
|
|
59
|
+
|
|
60
|
+
if not installed and needs_admin(settings.platform.admin, "install"):
|
|
61
|
+
if not administrator:
|
|
62
|
+
return run_elevated(launcher, arguments)
|
|
63
|
+
_install(location, executable=launcher)
|
|
64
|
+
if settings.platform.admin == "install":
|
|
65
|
+
return 0
|
|
66
|
+
elif not installed:
|
|
67
|
+
_install(location, executable=launcher)
|
|
68
|
+
|
|
69
|
+
if needs_admin(settings.platform.admin, "run") and not administrator:
|
|
70
|
+
return run_elevated(launcher, arguments)
|
|
71
|
+
return _run(location, arguments)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
from ivaldi.shared.build import build_all_wheels, build_executable, build_project_wheel, prepare_build
|
|
5
|
+
from ivaldi.shared.collect import collect
|
|
6
|
+
from ivaldi.shared.settings import load_install_directories, load_settings
|
|
7
|
+
|
|
8
|
+
logger = logging.getLogger(__name__)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def build(location: Path):
|
|
12
|
+
settings = load_settings(location, build=True)
|
|
13
|
+
settings = load_install_directories(settings)
|
|
14
|
+
prepare_build(settings)
|
|
15
|
+
collect(settings)
|
|
16
|
+
wheel = build_project_wheel(settings)
|
|
17
|
+
if settings.app.build.include_wheels:
|
|
18
|
+
build_all_wheels(settings, wheel)
|
|
19
|
+
return build_executable(location, settings)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import platform
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
from ivaldi.shared.alias import install_alias
|
|
5
|
+
from ivaldi.shared.project import install_project, mark_installed
|
|
6
|
+
from ivaldi.shared.python import install_python
|
|
7
|
+
from ivaldi.shared.settings import load_install_directories, load_settings
|
|
8
|
+
from ivaldi.shared.uv import install_uv
|
|
9
|
+
|
|
10
|
+
system = platform.system()
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def install(location, executable: Path | None = None):
|
|
14
|
+
settings = load_settings(location=location, build=False)
|
|
15
|
+
settings = load_install_directories(settings)
|
|
16
|
+
|
|
17
|
+
install_uv(settings)
|
|
18
|
+
install_python(settings)
|
|
19
|
+
install_project(settings)
|
|
20
|
+
|
|
21
|
+
alias = install_alias(settings, executable)
|
|
22
|
+
if not settings.platform.add_to_path or alias is not None:
|
|
23
|
+
mark_installed(settings)
|
|
24
|
+
return settings
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import subprocess
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
from ivaldi.shared.settings import load_runtime_directories, load_settings
|
|
5
|
+
from ivaldi.types.enums import IVALDI
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def entrypoint_command(entrypoint, python, args):
|
|
9
|
+
if ":" not in entrypoint:
|
|
10
|
+
return [entrypoint, *args]
|
|
11
|
+
|
|
12
|
+
module_name, callable_name = entrypoint.split(":", 1)
|
|
13
|
+
return [str(python.absolute()), "-c", IVALDI.ENTRYPOINT_RUNNER, module_name, callable_name, *args]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def run(location, args=None):
|
|
17
|
+
settings = load_settings(location=location, build=False)
|
|
18
|
+
settings = load_runtime_directories(settings)
|
|
19
|
+
forwarded_args = sys.argv[1:] if args is None else args
|
|
20
|
+
|
|
21
|
+
command = [
|
|
22
|
+
str(settings.bin.uv.resolve()),
|
|
23
|
+
"run",
|
|
24
|
+
"--no-project",
|
|
25
|
+
"--python",
|
|
26
|
+
str(settings.bin.python.absolute()),
|
|
27
|
+
"--no-python-downloads",
|
|
28
|
+
"--no-config",
|
|
29
|
+
"--cache-dir",
|
|
30
|
+
str(settings.dirs.uv.resolve()),
|
|
31
|
+
"--",
|
|
32
|
+
*entrypoint_command(settings.app.entrypoint, settings.bin.python, forwarded_args),
|
|
33
|
+
]
|
|
34
|
+
result = subprocess.run(command, shell=False, check=False, cwd=settings.dirs.app)
|
|
35
|
+
return result.returncode
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def needs_admin(admin: bool | str, phase: str) -> bool:
|
|
5
|
+
"""Return whether a configured phase requires administrator privileges."""
|
|
6
|
+
return admin is True or admin == phase
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def is_admin() -> bool:
|
|
10
|
+
if os.name == "nt":
|
|
11
|
+
import ctypes
|
|
12
|
+
|
|
13
|
+
return bool(ctypes.windll.shell32.IsUserAnAdmin())
|
|
14
|
+
return os.geteuid() == 0
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def run_elevated(*_args, **_kwargs):
|
|
18
|
+
"""Stop and ask the user to restart the launcher with elevated privileges."""
|
|
19
|
+
if os.name == "nt":
|
|
20
|
+
raise SystemExit("Administrator privileges are required; rerun this command as Administrator")
|
|
21
|
+
raise SystemExit("Administrator privileges are required; rerun this command with sudo")
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import platform
|
|
3
|
+
import shlex
|
|
4
|
+
import shutil
|
|
5
|
+
import stat
|
|
6
|
+
import tempfile
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def get_shell_config() -> tuple[Path, str]:
|
|
11
|
+
"""Return the active shell's startup file and alias syntax."""
|
|
12
|
+
home = Path.home()
|
|
13
|
+
shell = Path(os.environ.get("SHELL", "")).name
|
|
14
|
+
if shell == "zsh":
|
|
15
|
+
return home / ".zshrc", "posix"
|
|
16
|
+
if shell == "bash":
|
|
17
|
+
filename = ".bash_profile" if platform.system() == "Darwin" else ".bashrc"
|
|
18
|
+
return home / filename, "posix"
|
|
19
|
+
if shell == "fish":
|
|
20
|
+
return home / ".config/fish/config.fish", "fish"
|
|
21
|
+
return home / ".profile", "posix"
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def write_shell_alias(alias: str, source: Path) -> Path:
|
|
25
|
+
"""Create or replace an Ivaldi-managed alias in the shell startup file."""
|
|
26
|
+
config, syntax = get_shell_config()
|
|
27
|
+
quoted_source = shlex.quote(str(source))
|
|
28
|
+
command = f"alias {alias} {quoted_source}" if syntax == "fish" else f"alias {alias}={quoted_source}"
|
|
29
|
+
start_marker = f"# >>> ivaldi alias: {alias} >>>"
|
|
30
|
+
end_marker = f"# <<< ivaldi alias: {alias} <<<"
|
|
31
|
+
block = f"{start_marker}\n{command}\n{end_marker}\n"
|
|
32
|
+
|
|
33
|
+
content = config.read_text(encoding="utf-8") if config.is_file() else ""
|
|
34
|
+
start = content.find(start_marker)
|
|
35
|
+
end = content.find(end_marker, start + len(start_marker)) if start >= 0 else -1
|
|
36
|
+
if start >= 0 and end >= 0:
|
|
37
|
+
end += len(end_marker)
|
|
38
|
+
if end < len(content) and content[end] == "\n":
|
|
39
|
+
end += 1
|
|
40
|
+
content = f"{content[:start]}{block}{content[end:]}"
|
|
41
|
+
else:
|
|
42
|
+
separator = "" if not content or content.endswith("\n") else "\n"
|
|
43
|
+
content = f"{content}{separator}{block}"
|
|
44
|
+
|
|
45
|
+
config.parent.mkdir(exist_ok=True, parents=True)
|
|
46
|
+
config.write_text(content, encoding="utf-8")
|
|
47
|
+
return config
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def install_command(settings, source: Path, alias: str) -> Path:
|
|
51
|
+
"""Copy a launcher into the configured command directory."""
|
|
52
|
+
if platform.system() == "Windows" and not alias.lower().endswith(".exe"):
|
|
53
|
+
alias += ".exe"
|
|
54
|
+
destination = settings.dirs.exec / alias
|
|
55
|
+
if source == destination.resolve():
|
|
56
|
+
return destination
|
|
57
|
+
|
|
58
|
+
destination.parent.mkdir(exist_ok=True, parents=True)
|
|
59
|
+
temporary = None
|
|
60
|
+
try:
|
|
61
|
+
with tempfile.NamedTemporaryFile(delete=False, dir=destination.parent, prefix=f".{alias}.") as file:
|
|
62
|
+
temporary = Path(file.name)
|
|
63
|
+
shutil.copy2(source, temporary)
|
|
64
|
+
if os.name != "nt":
|
|
65
|
+
temporary.chmod(temporary.stat().st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
|
|
66
|
+
temporary.replace(destination)
|
|
67
|
+
temporary = None
|
|
68
|
+
finally:
|
|
69
|
+
if temporary is not None:
|
|
70
|
+
temporary.unlink(missing_ok=True)
|
|
71
|
+
return destination
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def install_alias(settings, executable: Path | None) -> Path | None:
|
|
75
|
+
"""Persist the configured launcher alias for the current platform."""
|
|
76
|
+
if not settings.platform.add_to_path or executable is None:
|
|
77
|
+
return None
|
|
78
|
+
|
|
79
|
+
alias = settings.platform.alias
|
|
80
|
+
if not alias or Path(alias).name != alias:
|
|
81
|
+
raise ValueError("platform.alias must be a command name without path components")
|
|
82
|
+
|
|
83
|
+
source = executable.resolve()
|
|
84
|
+
if not source.is_file():
|
|
85
|
+
raise FileNotFoundError(f"Could not find the launcher executable: {source}")
|
|
86
|
+
destination = install_command(settings, source, alias)
|
|
87
|
+
if platform.system() == "Windows":
|
|
88
|
+
return destination
|
|
89
|
+
write_shell_alias(alias, destination)
|
|
90
|
+
return destination
|