Skip to content

Commit 598bde7

Browse files
Refactor precheck command to use pip installation and improve argument handling
- Replaced direct command-line arguments with a precheck_args list for better readability and maintainability. - Updated Docker command to execute the precheck using a pip-installed script, enhancing flexibility. - Retained existing functionality for magic DRC and skip checks options while streamlining the command structure.
1 parent 8a76eed commit 598bde7

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

chipfoundry_cli/main.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3251,29 +3251,31 @@ def precheck(project_root, skip_checks, magic_drc, checks, dry_run):
32513251
return
32523252

32533253
pdk_path = pdk_root / pdk
3254-
user_id = os.getuid()
3255-
group_id = os.getgid()
32563254

3257-
docker_cmd = [
3258-
'docker', 'run', '--rm',
3259-
'-v', f'{project_root_path}:{project_root_path}',
3260-
'-v', f'{pdk_root}:{pdk_root}',
3261-
'-u', f'{user_id}:{group_id}',
3262-
'chipfoundry/mpw_precheck:latest',
3263-
'cf-precheck',
3255+
precheck_args = [
32643256
'-i', str(project_root_path),
32653257
'-p', str(pdk_path),
32663258
'-c', '/opt/caravel',
32673259
]
32683260

32693261
if magic_drc:
3270-
docker_cmd.append('--magic-drc')
3262+
precheck_args.append('--magic-drc')
32713263

32723264
if skip_checks:
3273-
docker_cmd.extend(['--skip-checks'] + list(skip_checks))
3265+
precheck_args.extend(['--skip-checks'] + list(skip_checks))
32743266

32753267
if checks:
3276-
docker_cmd.extend(list(checks))
3268+
precheck_args.extend(list(checks))
3269+
3270+
precheck_cmd = 'pip3 install -q cf-precheck && cf-precheck ' + ' '.join(precheck_args)
3271+
3272+
docker_cmd = [
3273+
'docker', 'run', '--rm',
3274+
'-v', f'{project_root_path}:{project_root_path}',
3275+
'-v', f'{pdk_root}:{pdk_root}',
3276+
'chipfoundry/mpw_precheck:latest',
3277+
'bash', '-c', precheck_cmd,
3278+
]
32773279

32783280
checks_display = ', '.join(checks) if checks else 'All checks'
32793281
console.print("\n" + "="*60)

0 commit comments

Comments
 (0)