devlab-fpga 0.1.1__tar.gz → 0.1.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: devlab-fpga
3
- Version: 0.1.1
3
+ Version: 0.1.2
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,23 @@ 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
- On Windows, OSS CAD Suite is distributed as an `.exe` installer. Run:
67
+ On Windows, OSS CAD Suite may be distributed as a 7-Zip self-extracting `.exe`
68
+ archive. `devlab install` extracts it automatically into `~/.devlab/toolchains`
69
+ without opening an installer:
68
70
 
69
71
  ```powershell
70
- devlab install --run-installer
72
+ devlab install
71
73
  ```
72
74
 
73
- The compatibility shortcut `devlab --run-installer` also runs the Windows
74
- installer.
75
+ The installed tree keeps the official OSS CAD Suite layout:
76
+
77
+ ```text
78
+ ~/.devlab/toolchains/oss-cad-suite-2026-07-06-windows-x64/
79
+ oss-cad-suite/
80
+ bin/
81
+ environment.bat
82
+ environment.ps1
83
+ ```
75
84
 
76
85
  ## OSS CAD Suite Source
77
86
 
@@ -40,14 +40,23 @@ 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
- On Windows, OSS CAD Suite is distributed as an `.exe` installer. Run:
43
+ On Windows, OSS CAD Suite may be distributed as a 7-Zip self-extracting `.exe`
44
+ archive. `devlab install` extracts it automatically into `~/.devlab/toolchains`
45
+ without opening an installer:
44
46
 
45
47
  ```powershell
46
- devlab install --run-installer
48
+ devlab install
47
49
  ```
48
50
 
49
- The compatibility shortcut `devlab --run-installer` also runs the Windows
50
- installer.
51
+ The installed tree keeps the official OSS CAD Suite layout:
52
+
53
+ ```text
54
+ ~/.devlab/toolchains/oss-cad-suite-2026-07-06-windows-x64/
55
+ oss-cad-suite/
56
+ bin/
57
+ environment.bat
58
+ environment.ps1
59
+ ```
51
60
 
52
61
  ## OSS CAD Suite Source
53
62
 
@@ -2,4 +2,4 @@
2
2
 
3
3
  __all__ = ["__version__"]
4
4
 
5
- __version__ = "0.1.1"
5
+ __version__ = "0.1.2"
@@ -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="Shortcut for `devlab install --run-installer` on Windows.",
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="On Windows, execute the downloaded OSS CAD Suite installer.",
48
+ help="Deprecated compatibility flag. Windows install is automatic.",
49
49
  )
50
50
  install_parser.set_defaults(func=_install)
51
51
 
@@ -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,12 +105,12 @@ 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 / "bin", path / "oss-cad-suite" / "bin"]
113
+ return [path / "oss-cad-suite" / "bin", path / "bin"]
113
114
 
114
115
 
115
116
  def env_with_toolchain(path: Path | None = None) -> dict[str, str]:
@@ -190,46 +191,69 @@ def install_oss_cad_suite(
190
191
  archive = download_asset(asset, archive_path(asset, home), force=force)
191
192
 
192
193
  if asset.name.endswith(".exe"):
193
- if not run_windows_installer:
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)])
194
+ _extract_windows_sfx(archive, destination, force=force)
200
195
  if not find_executable("yosys", destination):
201
196
  raise DevlabError(
202
- "The Windows installer finished, but yosys was not found in "
203
- f"{destination}\\bin or {destination}\\oss-cad-suite\\bin. "
204
- "Install or extract OSS CAD Suite into that toolchain directory, "
205
- "then run `devlab doctor`."
197
+ "The Windows OSS CAD Suite archive was extracted, "
198
+ "but yosys was not found in "
199
+ f"{destination}\\oss-cad-suite\\bin or {destination}\\bin. "
200
+ "Check the extracted files, then run `devlab doctor`."
206
201
  )
207
202
  return destination
208
203
 
204
+ if asset.name.endswith(".zip"):
205
+ _extract_zip(archive, destination, force=force)
206
+ return destination
207
+
209
208
  _extract_tarball(archive, destination, force=force)
210
- _mark_executables(bin_dir(destination))
209
+ for binary_dir in bin_dirs(destination):
210
+ _mark_executables(binary_dir)
211
211
  return destination
212
212
 
213
213
 
214
- def _extract_tarball(archive: Path, destination: Path, force: bool) -> None:
214
+ def _move_extracted_tree(source: Path, destination: Path, force: bool) -> None:
215
215
  destination.parent.mkdir(parents=True, exist_ok=True)
216
216
  if destination.exists():
217
- if not force:
217
+ if not force and find_executable("yosys", destination):
218
218
  raise DevlabError(f"Install destination already exists: {destination}")
219
219
  shutil.rmtree(destination)
220
220
 
221
+ destination.mkdir(parents=True)
222
+ for child in source.iterdir():
223
+ shutil.move(str(child), destination / child.name)
224
+
225
+
226
+ def _extract_windows_sfx(archive: Path, destination: Path, force: bool) -> None:
227
+ destination.parent.mkdir(parents=True, exist_ok=True)
228
+ with tempfile.TemporaryDirectory(
229
+ prefix="devlab-oss-cad-suite-", dir=destination.parent
230
+ ) as tmp:
231
+ tmp_path = Path(tmp)
232
+ try:
233
+ subprocess.check_call([str(archive), f"-o{tmp_path}", "-y"], cwd=tmp_path)
234
+ except subprocess.CalledProcessError as exc:
235
+ raise DevlabError(
236
+ f"Could not extract Windows OSS CAD Suite archive: {exc}"
237
+ ) from exc
238
+ _move_extracted_tree(tmp_path, destination, force=force)
239
+
240
+
241
+ def _extract_zip(archive: Path, destination: Path, force: bool) -> None:
242
+ with tempfile.TemporaryDirectory(prefix="devlab-oss-cad-suite-") as tmp:
243
+ tmp_path = Path(tmp)
244
+ with zipfile.ZipFile(archive) as zip_file:
245
+ _safe_extract_zip(zip_file, tmp_path)
246
+
247
+ _move_extracted_tree(tmp_path, destination, force=force)
248
+
249
+
250
+ def _extract_tarball(archive: Path, destination: Path, force: bool) -> None:
221
251
  with tempfile.TemporaryDirectory(prefix="devlab-oss-cad-suite-") as tmp:
222
252
  tmp_path = Path(tmp)
223
253
  with tarfile.open(archive, "r:gz") as tar:
224
254
  _safe_extract(tar, tmp_path)
225
255
 
226
- children = [child for child in tmp_path.iterdir()]
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)
256
+ _move_extracted_tree(tmp_path, destination, force=force)
233
257
 
234
258
 
235
259
  def _safe_extract(tar: tarfile.TarFile, destination: Path) -> None:
@@ -244,6 +268,15 @@ def _safe_extract(tar: tarfile.TarFile, destination: Path) -> None:
244
268
  tar.extractall(destination)
245
269
 
246
270
 
271
+ def _safe_extract_zip(zip_file: zipfile.ZipFile, destination: Path) -> None:
272
+ destination = destination.resolve()
273
+ for member in zip_file.infolist():
274
+ target = (destination / member.filename).resolve()
275
+ if destination != target and destination not in target.parents:
276
+ raise DevlabError(f"Unsafe path in archive: {member.filename}")
277
+ zip_file.extractall(destination)
278
+
279
+
247
280
  def _mark_executables(path: Path) -> None:
248
281
  if not path.exists():
249
282
  return
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: devlab-fpga
3
- Version: 0.1.1
3
+ Version: 0.1.2
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,23 @@ 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
- On Windows, OSS CAD Suite is distributed as an `.exe` installer. Run:
67
+ On Windows, OSS CAD Suite may be distributed as a 7-Zip self-extracting `.exe`
68
+ archive. `devlab install` extracts it automatically into `~/.devlab/toolchains`
69
+ without opening an installer:
68
70
 
69
71
  ```powershell
70
- devlab install --run-installer
72
+ devlab install
71
73
  ```
72
74
 
73
- The compatibility shortcut `devlab --run-installer` also runs the Windows
74
- installer.
75
+ The installed tree keeps the official OSS CAD Suite layout:
76
+
77
+ ```text
78
+ ~/.devlab/toolchains/oss-cad-suite-2026-07-06-windows-x64/
79
+ oss-cad-suite/
80
+ bin/
81
+ environment.bat
82
+ environment.ps1
83
+ ```
75
84
 
76
85
  ## OSS CAD Suite Source
77
86
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "devlab-fpga"
7
- version = "0.1.1"
7
+ version = "0.1.2"
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