devlab-fpga 0.1.1__tar.gz → 0.1.3__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.
- {devlab_fpga-0.1.1/devlab_fpga.egg-info → devlab_fpga-0.1.3}/PKG-INFO +20 -5
- {devlab_fpga-0.1.1 → devlab_fpga-0.1.3}/README.md +19 -4
- {devlab_fpga-0.1.1 → devlab_fpga-0.1.3}/devlab/__init__.py +1 -1
- {devlab_fpga-0.1.1 → devlab_fpga-0.1.3}/devlab/cli.py +2 -2
- {devlab_fpga-0.1.1 → devlab_fpga-0.1.3}/devlab/project.py +2 -2
- {devlab_fpga-0.1.1 → devlab_fpga-0.1.3}/devlab/toolchain.py +73 -24
- {devlab_fpga-0.1.1 → devlab_fpga-0.1.3/devlab_fpga.egg-info}/PKG-INFO +20 -5
- {devlab_fpga-0.1.1 → devlab_fpga-0.1.3}/pyproject.toml +1 -1
- {devlab_fpga-0.1.1 → devlab_fpga-0.1.3}/LICENSE +0 -0
- {devlab_fpga-0.1.1 → devlab_fpga-0.1.3}/MANIFEST.in +0 -0
- {devlab_fpga-0.1.1 → devlab_fpga-0.1.3}/devlab/__main__.py +0 -0
- {devlab_fpga-0.1.1 → devlab_fpga-0.1.3}/devlab/errors.py +0 -0
- {devlab_fpga-0.1.1 → devlab_fpga-0.1.3}/devlab/platforms.py +0 -0
- {devlab_fpga-0.1.1 → devlab_fpga-0.1.3}/devlab_fpga.egg-info/SOURCES.txt +0 -0
- {devlab_fpga-0.1.1 → devlab_fpga-0.1.3}/devlab_fpga.egg-info/dependency_links.txt +0 -0
- {devlab_fpga-0.1.1 → devlab_fpga-0.1.3}/devlab_fpga.egg-info/entry_points.txt +0 -0
- {devlab_fpga-0.1.1 → devlab_fpga-0.1.3}/devlab_fpga.egg-info/requires.txt +0 -0
- {devlab_fpga-0.1.1 → devlab_fpga-0.1.3}/devlab_fpga.egg-info/top_level.txt +0 -0
- {devlab_fpga-0.1.1 → devlab_fpga-0.1.3}/setup.cfg +0 -0
- {devlab_fpga-0.1.1 → devlab_fpga-0.1.3}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: devlab-fpga
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: FPGA development helper for installing OSS CAD Suite and running build/flash flows.
|
|
5
5
|
Author-email: Mrju10 <name@email.com>
|
|
6
6
|
License: MIT
|
|
@@ -64,14 +64,28 @@ YosysHQ. The installer selects the correct asset for:
|
|
|
64
64
|
The default install location is `~/.devlab`. Set `DEVLAB_HOME` to use a
|
|
65
65
|
different directory.
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
`devlab build`, `devlab flash`, and `devlab flash --detect` automatically run
|
|
68
|
+
OSS CAD Suite tools with the installed suite environment, including the
|
|
69
|
+
official `bin`, `py3bin`, `VIRTUAL_ENV`, `VERILATOR_ROOT`, and `GHDL_PREFIX`
|
|
70
|
+
settings. You do not need to manually source `environment` for those commands.
|
|
71
|
+
|
|
72
|
+
On Windows, OSS CAD Suite may be distributed as a 7-Zip self-extracting `.exe`
|
|
73
|
+
archive. `devlab install` extracts it automatically into `~/.devlab/toolchains`
|
|
74
|
+
without opening an installer:
|
|
68
75
|
|
|
69
76
|
```powershell
|
|
70
|
-
devlab install
|
|
77
|
+
devlab install
|
|
71
78
|
```
|
|
72
79
|
|
|
73
|
-
The
|
|
74
|
-
|
|
80
|
+
The installed tree keeps the official OSS CAD Suite layout:
|
|
81
|
+
|
|
82
|
+
```text
|
|
83
|
+
~/.devlab/toolchains/oss-cad-suite-2026-07-06-windows-x64/
|
|
84
|
+
oss-cad-suite/
|
|
85
|
+
bin/
|
|
86
|
+
environment.bat
|
|
87
|
+
environment.ps1
|
|
88
|
+
```
|
|
75
89
|
|
|
76
90
|
## OSS CAD Suite Source
|
|
77
91
|
|
|
@@ -167,6 +181,7 @@ run detection:
|
|
|
167
181
|
|
|
168
182
|
```bash
|
|
169
183
|
devlab flash --detect
|
|
184
|
+
devlab flash --detect --board tangnano9k
|
|
170
185
|
```
|
|
171
186
|
|
|
172
187
|
Persistent flash can also be configured in `devlab.toml`:
|
|
@@ -40,14 +40,28 @@ YosysHQ. The installer selects the correct asset for:
|
|
|
40
40
|
The default install location is `~/.devlab`. Set `DEVLAB_HOME` to use a
|
|
41
41
|
different directory.
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
`devlab build`, `devlab flash`, and `devlab flash --detect` automatically run
|
|
44
|
+
OSS CAD Suite tools with the installed suite environment, including the
|
|
45
|
+
official `bin`, `py3bin`, `VIRTUAL_ENV`, `VERILATOR_ROOT`, and `GHDL_PREFIX`
|
|
46
|
+
settings. You do not need to manually source `environment` for those commands.
|
|
47
|
+
|
|
48
|
+
On Windows, OSS CAD Suite may be distributed as a 7-Zip self-extracting `.exe`
|
|
49
|
+
archive. `devlab install` extracts it automatically into `~/.devlab/toolchains`
|
|
50
|
+
without opening an installer:
|
|
44
51
|
|
|
45
52
|
```powershell
|
|
46
|
-
devlab install
|
|
53
|
+
devlab install
|
|
47
54
|
```
|
|
48
55
|
|
|
49
|
-
The
|
|
50
|
-
|
|
56
|
+
The installed tree keeps the official OSS CAD Suite layout:
|
|
57
|
+
|
|
58
|
+
```text
|
|
59
|
+
~/.devlab/toolchains/oss-cad-suite-2026-07-06-windows-x64/
|
|
60
|
+
oss-cad-suite/
|
|
61
|
+
bin/
|
|
62
|
+
environment.bat
|
|
63
|
+
environment.ps1
|
|
64
|
+
```
|
|
51
65
|
|
|
52
66
|
## OSS CAD Suite Source
|
|
53
67
|
|
|
@@ -143,6 +157,7 @@ run detection:
|
|
|
143
157
|
|
|
144
158
|
```bash
|
|
145
159
|
devlab flash --detect
|
|
160
|
+
devlab flash --detect --board tangnano9k
|
|
146
161
|
```
|
|
147
162
|
|
|
148
163
|
Persistent flash can also be configured in `devlab.toml`:
|
|
@@ -27,7 +27,7 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
27
27
|
parser.add_argument(
|
|
28
28
|
"--run-installer",
|
|
29
29
|
action="store_true",
|
|
30
|
-
help="
|
|
30
|
+
help="Deprecated compatibility flag. Windows install is automatic.",
|
|
31
31
|
)
|
|
32
32
|
|
|
33
33
|
commands = parser.add_subparsers(dest="command")
|
|
@@ -45,7 +45,7 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
45
45
|
install_parser.add_argument(
|
|
46
46
|
"--run-installer",
|
|
47
47
|
action="store_true",
|
|
48
|
-
help="
|
|
48
|
+
help="Deprecated compatibility flag. Windows install is automatic.",
|
|
49
49
|
)
|
|
50
50
|
install_parser.set_defaults(func=_install)
|
|
51
51
|
|
|
@@ -166,8 +166,8 @@ def detect_flash(
|
|
|
166
166
|
board: str | None = None,
|
|
167
167
|
dry_run: bool = False,
|
|
168
168
|
) -> None:
|
|
169
|
-
config = load_config(config_path)
|
|
170
|
-
selected_board = board or config.board
|
|
169
|
+
config = load_config(config_path) if config_path or not board else None
|
|
170
|
+
selected_board = board or (config.board if config else None)
|
|
171
171
|
if not selected_board:
|
|
172
172
|
raise DevlabError(
|
|
173
173
|
"No flash board configured. Add [flash] board = \"...\" "
|
|
@@ -9,6 +9,7 @@ import sys
|
|
|
9
9
|
import tarfile
|
|
10
10
|
import tempfile
|
|
11
11
|
import urllib.request
|
|
12
|
+
import zipfile
|
|
12
13
|
from dataclasses import dataclass
|
|
13
14
|
from pathlib import Path
|
|
14
15
|
|
|
@@ -104,18 +105,34 @@ def archive_path(asset: ToolchainAsset | None = None, home: Path | None = None)
|
|
|
104
105
|
|
|
105
106
|
def bin_dir(path: Path | None = None) -> Path:
|
|
106
107
|
path = path or install_path()
|
|
107
|
-
return path / "bin"
|
|
108
|
+
return path / "oss-cad-suite" / "bin"
|
|
108
109
|
|
|
109
110
|
|
|
110
111
|
def bin_dirs(path: Path | None = None) -> list[Path]:
|
|
111
112
|
path = path or install_path()
|
|
112
|
-
return [path / "
|
|
113
|
+
return [path / "oss-cad-suite" / "bin", path / "bin"]
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def _toolchain_root(path: Path) -> Path:
|
|
117
|
+
nested_root = path / "oss-cad-suite"
|
|
118
|
+
if nested_root.exists():
|
|
119
|
+
return nested_root
|
|
120
|
+
return path
|
|
113
121
|
|
|
114
122
|
|
|
115
123
|
def env_with_toolchain(path: Path | None = None) -> dict[str, str]:
|
|
124
|
+
path = path or install_path()
|
|
125
|
+
root = _toolchain_root(path)
|
|
116
126
|
env = os.environ.copy()
|
|
117
|
-
|
|
127
|
+
tool_dirs = [*bin_dirs(path), root / "py3bin"]
|
|
128
|
+
binary_dirs = os.pathsep.join(str(candidate) for candidate in tool_dirs)
|
|
118
129
|
env["PATH"] = binary_dirs + os.pathsep + env.get("PATH", "")
|
|
130
|
+
env["VIRTUAL_ENV"] = str(root)
|
|
131
|
+
env["VIRTUAL_ENV_PROMPT"] = "OSS CAD Suite"
|
|
132
|
+
env["VERILATOR_ROOT"] = str(root / "share" / "verilator")
|
|
133
|
+
env["GHDL_PREFIX"] = str(root / "lib" / "ghdl")
|
|
134
|
+
env["OPENFPGALOADER_SOJ_DIR"] = str(root / "share" / "openFPGALoader")
|
|
135
|
+
env.pop("PYTHONHOME", None)
|
|
119
136
|
return env
|
|
120
137
|
|
|
121
138
|
|
|
@@ -190,46 +207,69 @@ def install_oss_cad_suite(
|
|
|
190
207
|
archive = download_asset(asset, archive_path(asset, home), force=force)
|
|
191
208
|
|
|
192
209
|
if asset.name.endswith(".exe"):
|
|
193
|
-
|
|
194
|
-
raise DevlabError(
|
|
195
|
-
"Windows uses the OSS CAD Suite .exe installer. "
|
|
196
|
-
f"The file was downloaded to {archive}. Re-run with "
|
|
197
|
-
"`devlab install --run-installer` to execute it."
|
|
198
|
-
)
|
|
199
|
-
subprocess.check_call([str(archive)])
|
|
210
|
+
_extract_windows_sfx(archive, destination, force=force)
|
|
200
211
|
if not find_executable("yosys", destination):
|
|
201
212
|
raise DevlabError(
|
|
202
|
-
"The Windows
|
|
203
|
-
|
|
204
|
-
"
|
|
205
|
-
"then run `devlab doctor`."
|
|
213
|
+
"The Windows OSS CAD Suite archive was extracted, "
|
|
214
|
+
"but yosys was not found in "
|
|
215
|
+
f"{destination}\\oss-cad-suite\\bin or {destination}\\bin. "
|
|
216
|
+
"Check the extracted files, then run `devlab doctor`."
|
|
206
217
|
)
|
|
207
218
|
return destination
|
|
208
219
|
|
|
220
|
+
if asset.name.endswith(".zip"):
|
|
221
|
+
_extract_zip(archive, destination, force=force)
|
|
222
|
+
return destination
|
|
223
|
+
|
|
209
224
|
_extract_tarball(archive, destination, force=force)
|
|
210
|
-
|
|
225
|
+
for binary_dir in bin_dirs(destination):
|
|
226
|
+
_mark_executables(binary_dir)
|
|
211
227
|
return destination
|
|
212
228
|
|
|
213
229
|
|
|
214
|
-
def
|
|
230
|
+
def _move_extracted_tree(source: Path, destination: Path, force: bool) -> None:
|
|
215
231
|
destination.parent.mkdir(parents=True, exist_ok=True)
|
|
216
232
|
if destination.exists():
|
|
217
|
-
if not force:
|
|
233
|
+
if not force and find_executable("yosys", destination):
|
|
218
234
|
raise DevlabError(f"Install destination already exists: {destination}")
|
|
219
235
|
shutil.rmtree(destination)
|
|
220
236
|
|
|
237
|
+
destination.mkdir(parents=True)
|
|
238
|
+
for child in source.iterdir():
|
|
239
|
+
shutil.move(str(child), destination / child.name)
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
def _extract_windows_sfx(archive: Path, destination: Path, force: bool) -> None:
|
|
243
|
+
destination.parent.mkdir(parents=True, exist_ok=True)
|
|
244
|
+
with tempfile.TemporaryDirectory(
|
|
245
|
+
prefix="devlab-oss-cad-suite-", dir=destination.parent
|
|
246
|
+
) as tmp:
|
|
247
|
+
tmp_path = Path(tmp)
|
|
248
|
+
try:
|
|
249
|
+
subprocess.check_call([str(archive), f"-o{tmp_path}", "-y"], cwd=tmp_path)
|
|
250
|
+
except subprocess.CalledProcessError as exc:
|
|
251
|
+
raise DevlabError(
|
|
252
|
+
f"Could not extract Windows OSS CAD Suite archive: {exc}"
|
|
253
|
+
) from exc
|
|
254
|
+
_move_extracted_tree(tmp_path, destination, force=force)
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
def _extract_zip(archive: Path, destination: Path, force: bool) -> None:
|
|
258
|
+
with tempfile.TemporaryDirectory(prefix="devlab-oss-cad-suite-") as tmp:
|
|
259
|
+
tmp_path = Path(tmp)
|
|
260
|
+
with zipfile.ZipFile(archive) as zip_file:
|
|
261
|
+
_safe_extract_zip(zip_file, tmp_path)
|
|
262
|
+
|
|
263
|
+
_move_extracted_tree(tmp_path, destination, force=force)
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
def _extract_tarball(archive: Path, destination: Path, force: bool) -> None:
|
|
221
267
|
with tempfile.TemporaryDirectory(prefix="devlab-oss-cad-suite-") as tmp:
|
|
222
268
|
tmp_path = Path(tmp)
|
|
223
269
|
with tarfile.open(archive, "r:gz") as tar:
|
|
224
270
|
_safe_extract(tar, tmp_path)
|
|
225
271
|
|
|
226
|
-
|
|
227
|
-
if len(children) == 1 and children[0].is_dir():
|
|
228
|
-
shutil.move(str(children[0]), destination)
|
|
229
|
-
else:
|
|
230
|
-
destination.mkdir(parents=True)
|
|
231
|
-
for child in children:
|
|
232
|
-
shutil.move(str(child), destination / child.name)
|
|
272
|
+
_move_extracted_tree(tmp_path, destination, force=force)
|
|
233
273
|
|
|
234
274
|
|
|
235
275
|
def _safe_extract(tar: tarfile.TarFile, destination: Path) -> None:
|
|
@@ -244,6 +284,15 @@ def _safe_extract(tar: tarfile.TarFile, destination: Path) -> None:
|
|
|
244
284
|
tar.extractall(destination)
|
|
245
285
|
|
|
246
286
|
|
|
287
|
+
def _safe_extract_zip(zip_file: zipfile.ZipFile, destination: Path) -> None:
|
|
288
|
+
destination = destination.resolve()
|
|
289
|
+
for member in zip_file.infolist():
|
|
290
|
+
target = (destination / member.filename).resolve()
|
|
291
|
+
if destination != target and destination not in target.parents:
|
|
292
|
+
raise DevlabError(f"Unsafe path in archive: {member.filename}")
|
|
293
|
+
zip_file.extractall(destination)
|
|
294
|
+
|
|
295
|
+
|
|
247
296
|
def _mark_executables(path: Path) -> None:
|
|
248
297
|
if not path.exists():
|
|
249
298
|
return
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: devlab-fpga
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: FPGA development helper for installing OSS CAD Suite and running build/flash flows.
|
|
5
5
|
Author-email: Mrju10 <name@email.com>
|
|
6
6
|
License: MIT
|
|
@@ -64,14 +64,28 @@ YosysHQ. The installer selects the correct asset for:
|
|
|
64
64
|
The default install location is `~/.devlab`. Set `DEVLAB_HOME` to use a
|
|
65
65
|
different directory.
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
`devlab build`, `devlab flash`, and `devlab flash --detect` automatically run
|
|
68
|
+
OSS CAD Suite tools with the installed suite environment, including the
|
|
69
|
+
official `bin`, `py3bin`, `VIRTUAL_ENV`, `VERILATOR_ROOT`, and `GHDL_PREFIX`
|
|
70
|
+
settings. You do not need to manually source `environment` for those commands.
|
|
71
|
+
|
|
72
|
+
On Windows, OSS CAD Suite may be distributed as a 7-Zip self-extracting `.exe`
|
|
73
|
+
archive. `devlab install` extracts it automatically into `~/.devlab/toolchains`
|
|
74
|
+
without opening an installer:
|
|
68
75
|
|
|
69
76
|
```powershell
|
|
70
|
-
devlab install
|
|
77
|
+
devlab install
|
|
71
78
|
```
|
|
72
79
|
|
|
73
|
-
The
|
|
74
|
-
|
|
80
|
+
The installed tree keeps the official OSS CAD Suite layout:
|
|
81
|
+
|
|
82
|
+
```text
|
|
83
|
+
~/.devlab/toolchains/oss-cad-suite-2026-07-06-windows-x64/
|
|
84
|
+
oss-cad-suite/
|
|
85
|
+
bin/
|
|
86
|
+
environment.bat
|
|
87
|
+
environment.ps1
|
|
88
|
+
```
|
|
75
89
|
|
|
76
90
|
## OSS CAD Suite Source
|
|
77
91
|
|
|
@@ -167,6 +181,7 @@ run detection:
|
|
|
167
181
|
|
|
168
182
|
```bash
|
|
169
183
|
devlab flash --detect
|
|
184
|
+
devlab flash --detect --board tangnano9k
|
|
170
185
|
```
|
|
171
186
|
|
|
172
187
|
Persistent flash can also be configured in `devlab.toml`:
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "devlab-fpga"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.3"
|
|
8
8
|
description = "FPGA development helper for installing OSS CAD Suite and running build/flash flows."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|