chipfoundry-cli 1.0.2__tar.gz → 1.0.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.
- {chipfoundry_cli-1.0.2 → chipfoundry_cli-1.0.3}/PKG-INFO +1 -1
- {chipfoundry_cli-1.0.2 → chipfoundry_cli-1.0.3}/chipfoundry_cli/main.py +15 -19
- {chipfoundry_cli-1.0.2 → chipfoundry_cli-1.0.3}/chipfoundry_cli/utils.py +28 -1
- {chipfoundry_cli-1.0.2 → chipfoundry_cli-1.0.3}/pyproject.toml +1 -1
- {chipfoundry_cli-1.0.2 → chipfoundry_cli-1.0.3}/LICENSE +0 -0
- {chipfoundry_cli-1.0.2 → chipfoundry_cli-1.0.3}/README.md +0 -0
- {chipfoundry_cli-1.0.2 → chipfoundry_cli-1.0.3}/chipfoundry_cli/__init__.py +0 -0
|
@@ -3,7 +3,7 @@ import getpass
|
|
|
3
3
|
from chipfoundry_cli.utils import (
|
|
4
4
|
collect_project_files, ensure_cf_directory, update_or_create_project_json,
|
|
5
5
|
sftp_connect, upload_with_progress, sftp_ensure_dirs,
|
|
6
|
-
get_config_path, load_user_config, save_user_config
|
|
6
|
+
get_config_path, load_user_config, save_user_config, GDS_TYPE_MAP
|
|
7
7
|
)
|
|
8
8
|
import os
|
|
9
9
|
from pathlib import Path
|
|
@@ -20,12 +20,6 @@ import sys
|
|
|
20
20
|
DEFAULT_SSH_KEY = os.path.expanduser('~/.ssh/chipfoundry-key')
|
|
21
21
|
DEFAULT_SFTP_HOST = 'sftp.chipfoundry.io'
|
|
22
22
|
|
|
23
|
-
GDS_TYPE_MAP = {
|
|
24
|
-
'user_project_wrapper.gds': 'digital',
|
|
25
|
-
'user_analog_project_wrapper.gds': 'analog',
|
|
26
|
-
'openframe_project_wrapper.gds': 'openframe',
|
|
27
|
-
}
|
|
28
|
-
|
|
29
23
|
console = Console()
|
|
30
24
|
|
|
31
25
|
def get_project_json_from_cwd():
|
|
@@ -186,12 +180,7 @@ def init(project_root):
|
|
|
186
180
|
# Auto-detect project type from GDS file name
|
|
187
181
|
gds_dir = Path(project_root) / 'gds'
|
|
188
182
|
gds_type = None
|
|
189
|
-
|
|
190
|
-
'user_project_wrapper.gds': 'digital',
|
|
191
|
-
'user_analog_project_wrapper.gds': 'analog',
|
|
192
|
-
'openframe_project_wrapper.gds': 'openframe',
|
|
193
|
-
}
|
|
194
|
-
for gds_name, gtype in gds_type_map.items():
|
|
183
|
+
for gds_name, gtype in GDS_TYPE_MAP.items():
|
|
195
184
|
if (gds_dir / gds_name).exists():
|
|
196
185
|
gds_type = gtype
|
|
197
186
|
break
|
|
@@ -291,10 +280,6 @@ def push(project_root, sftp_host, sftp_username, sftp_key, project_id, project_n
|
|
|
291
280
|
else:
|
|
292
281
|
detected_type = found_types[0]
|
|
293
282
|
|
|
294
|
-
# Use the detected GDS file for upload and hash
|
|
295
|
-
if gds_file_path:
|
|
296
|
-
collected['gds/user_project_wrapper.gds'] = gds_file_path
|
|
297
|
-
|
|
298
283
|
# Prepare CLI overrides for project.json
|
|
299
284
|
cli_overrides = {
|
|
300
285
|
"project_id": project_id,
|
|
@@ -303,9 +288,16 @@ def push(project_root, sftp_host, sftp_username, sftp_key, project_id, project_n
|
|
|
303
288
|
"sftp_username": sftp_username,
|
|
304
289
|
}
|
|
305
290
|
cf_dir = ensure_cf_directory(project_root)
|
|
291
|
+
|
|
292
|
+
# Find the GDS file path for hash calculation
|
|
293
|
+
gds_path = None
|
|
294
|
+
for gds_key, gds_path in collected.items():
|
|
295
|
+
if gds_key.startswith("gds/"):
|
|
296
|
+
break
|
|
297
|
+
|
|
306
298
|
project_json_path = update_or_create_project_json(
|
|
307
299
|
cf_dir=str(cf_dir),
|
|
308
|
-
gds_path=
|
|
300
|
+
gds_path=gds_path,
|
|
309
301
|
cli_overrides=cli_overrides,
|
|
310
302
|
existing_json_path=collected.get(".cf/project.json")
|
|
311
303
|
)
|
|
@@ -317,10 +309,14 @@ def push(project_root, sftp_host, sftp_username, sftp_key, project_id, project_n
|
|
|
317
309
|
sftp_base = f"incoming/projects/{final_project_name}"
|
|
318
310
|
upload_map = {
|
|
319
311
|
".cf/project.json": project_json_path,
|
|
320
|
-
"gds/user_project_wrapper.gds": collected["gds/user_project_wrapper.gds"],
|
|
321
312
|
"verilog/rtl/user_defines.v": collected["verilog/rtl/user_defines.v"],
|
|
322
313
|
}
|
|
323
314
|
|
|
315
|
+
# Add the appropriate GDS file based on what was collected
|
|
316
|
+
for gds_key, gds_path in collected.items():
|
|
317
|
+
if gds_key.startswith("gds/"):
|
|
318
|
+
upload_map[gds_key] = gds_path
|
|
319
|
+
|
|
324
320
|
if dry_run:
|
|
325
321
|
console.print("[bold]Files to upload:[/bold]")
|
|
326
322
|
for rel_path, local_path in upload_map.items():
|
|
@@ -10,10 +10,16 @@ import toml
|
|
|
10
10
|
|
|
11
11
|
REQUIRED_FILES = {
|
|
12
12
|
".cf/project.json": False, # Optional, may not exist
|
|
13
|
-
"gds/user_project_wrapper.gds": True,
|
|
14
13
|
"verilog/rtl/user_defines.v": True,
|
|
15
14
|
}
|
|
16
15
|
|
|
16
|
+
# GDS files for different project types
|
|
17
|
+
GDS_TYPE_MAP = {
|
|
18
|
+
'user_project_wrapper.gds': 'digital',
|
|
19
|
+
'user_analog_project_wrapper.gds': 'analog',
|
|
20
|
+
'openframe_project_wrapper.gds': 'openframe',
|
|
21
|
+
}
|
|
22
|
+
|
|
17
23
|
def collect_project_files(project_root: str) -> Dict[str, Optional[str]]:
|
|
18
24
|
"""
|
|
19
25
|
Collect required project files from the given project_root.
|
|
@@ -22,6 +28,8 @@ def collect_project_files(project_root: str) -> Dict[str, Optional[str]]:
|
|
|
22
28
|
"""
|
|
23
29
|
project_root = Path(project_root)
|
|
24
30
|
collected = {}
|
|
31
|
+
|
|
32
|
+
# Collect standard required files
|
|
25
33
|
for rel_path, required in REQUIRED_FILES.items():
|
|
26
34
|
abs_path = project_root / rel_path
|
|
27
35
|
if abs_path.exists():
|
|
@@ -30,6 +38,25 @@ def collect_project_files(project_root: str) -> Dict[str, Optional[str]]:
|
|
|
30
38
|
raise FileNotFoundError(f"Required file not found: {abs_path}")
|
|
31
39
|
else:
|
|
32
40
|
collected[rel_path] = None
|
|
41
|
+
|
|
42
|
+
# Collect GDS file based on what exists
|
|
43
|
+
gds_dir = project_root / 'gds'
|
|
44
|
+
if gds_dir.exists():
|
|
45
|
+
found_gds_files = []
|
|
46
|
+
for gds_name in GDS_TYPE_MAP.keys():
|
|
47
|
+
gds_path = gds_dir / gds_name
|
|
48
|
+
if gds_path.exists():
|
|
49
|
+
found_gds_files.append((gds_name, str(gds_path)))
|
|
50
|
+
|
|
51
|
+
if len(found_gds_files) == 0:
|
|
52
|
+
raise FileNotFoundError(f"No GDS file found in {gds_dir}. Expected one of: {list(GDS_TYPE_MAP.keys())}")
|
|
53
|
+
elif len(found_gds_files) > 1:
|
|
54
|
+
found_names = [name for name, _ in found_gds_files]
|
|
55
|
+
raise FileNotFoundError(f"Multiple GDS files found: {found_names}. Only one project type is allowed per project.")
|
|
56
|
+
else:
|
|
57
|
+
gds_name, gds_path = found_gds_files[0]
|
|
58
|
+
collected[f"gds/{gds_name}"] = gds_path
|
|
59
|
+
|
|
33
60
|
return collected
|
|
34
61
|
|
|
35
62
|
def ensure_cf_directory(target_dir: str):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|