librelane 3.0.0.dev33__py3-none-any.whl → 3.0.0.dev35__py3-none-any.whl

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.

Potentially problematic release.


This version of librelane might be problematic. Click here for more details.

librelane/flows/cli.py CHANGED
@@ -1,3 +1,7 @@
1
+ # Copyright 2025 LibreLane Contributors
2
+ #
3
+ # Adapted from OpenLane 2
4
+ #
1
5
  # Copyright 2023 Efabless Corporation
2
6
  #
3
7
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,6 +16,7 @@
12
16
  # See the License for the specific language governing permissions and
13
17
  # limitations under the License.
14
18
  import os
19
+ import sys
15
20
  from functools import partial, wraps
16
21
  from concurrent.futures import ThreadPoolExecutor
17
22
  from typing import Optional, Union
@@ -21,12 +26,15 @@ from click import (
21
26
  Parameter,
22
27
  echo,
23
28
  )
29
+ from click.formatting import join_options
24
30
  from cloup import (
25
31
  option,
26
32
  argument,
27
33
  option_group,
28
34
  Choice,
29
- Path,
35
+ Argument,
36
+ Option as CloupOption,
37
+ Path as CloupPath,
30
38
  )
31
39
  from cloup.constraints import (
32
40
  mutually_exclusive,
@@ -39,6 +47,70 @@ from ..logging import set_log_level, verbose, err, options, LogLevels
39
47
  from ..state import State, InvalidState
40
48
 
41
49
 
50
+ class Option(CloupOption):
51
+ """
52
+ A slight modification of cloup.Option that consumes the environment
53
+ variable(s) in envvar upon use.
54
+ """
55
+
56
+ def resolve_envvar_value(self, ctx: Context) -> Optional[str]:
57
+ if self.envvar is None:
58
+ return None
59
+ evs = self.envvar
60
+ if isinstance(evs, str):
61
+ evs = [evs]
62
+ for envvar in self.envvar:
63
+ rv = os.environ.pop(envvar, None)
64
+ if rv:
65
+ return rv
66
+ return None
67
+
68
+
69
+ class Path(CloupPath):
70
+ """
71
+ A modification of cloup.Path that rejects paths starting with a tilde (~)
72
+ as too ambiguous. This is because of user confusion.
73
+ """
74
+
75
+ def convert(
76
+ self,
77
+ value: Union[str, os.PathLike],
78
+ param: Optional[Parameter],
79
+ ctx: Optional[Context],
80
+ ):
81
+ value = str(value)
82
+ assert param is not None
83
+ assert ctx is not None
84
+
85
+ is_cmd = False
86
+ if sys.platform == "win32":
87
+ import psutil
88
+
89
+ is_cmd = psutil.Process(os.getppid()).name().lower().endswith("cmd.exe")
90
+ if not is_cmd and value.startswith("~"):
91
+ usage, _ = join_options(param.opts)
92
+ if isinstance(param, Argument):
93
+ usage = ""
94
+ buffer = f"'{value}' starts with a tilde, which is ambiguous.\n"
95
+ buffer += " * If you meant your home directory, make sure your POSIX shell is able to expand the tilde:\n"
96
+ buffer += f" * GOOD: {ctx.command_path} {usage} {value} …\n"
97
+ if usage != "":
98
+ buffer += f" * BAD: {ctx.command_path} {usage}={value} …\n"
99
+ buffer += f' * BAD: {ctx.command_path} {usage} "{value}" …\n'
100
+ env_vars = []
101
+ if param.envvar is not None:
102
+ if isinstance(param.envvar, str):
103
+ env_vars = [param.envvar]
104
+ else:
105
+ env_vars = list(param.envvar)
106
+ for var in env_vars:
107
+ buffer += f" * GOOD: {var}={value} {ctx.command_path} …\n"
108
+ buffer += f' * BAD: {var}="{value}" {ctx.command_path} …\n'
109
+ buffer += ' * If you want a relative file or directory that starts with a literal "~", use an absolute path.\n'
110
+ self.fail(buffer, param, ctx)
111
+ return super().convert(value, param, ctx)
112
+
113
+
42
114
  def set_log_level_cb(
43
115
  ctx: Context,
44
116
  param: Parameter,
@@ -181,7 +253,7 @@ def cloup_flow_opts(
181
253
  Ciel is used by default for this CLI or not.
182
254
  :returns: The wrapper
183
255
  """
184
- o = partial(option, show_default=True)
256
+ o = partial(option, cls=CloupOption, show_default=True)
185
257
 
186
258
  def decorate(f):
187
259
  if config_options:
@@ -355,21 +427,23 @@ def cloup_flow_opts(
355
427
  dir_okay=True,
356
428
  ),
357
429
  is_eager=True,
358
- default=os.environ.pop("PDK_ROOT", None),
430
+ envvar=["PDK_ROOT"],
359
431
  help="Override Ciel PDK root folder. Required if Ciel is not installed, but a default value can also be set via the environment variable PDK_ROOT.",
360
432
  ),
361
433
  o(
362
434
  "-p",
363
435
  "--pdk",
364
436
  type=str,
365
- default=os.environ.pop("PDK", "sky130A"),
437
+ envvar=["PDK"],
438
+ default="sky130A",
366
439
  help="The process design kit to use.",
367
440
  ),
368
441
  o(
369
442
  "-s",
370
443
  "--scl",
371
444
  type=str,
372
- default=os.environ.pop("STD_CELL_LIBRARY", None),
445
+ envvar=["STD_CELL_LIBRARY"],
446
+ # no default, default is obtained dynamically from PDK
373
447
  help="The standard cell library to use. If None, the PDK's default standard cell library is used.",
374
448
  ),
375
449
  )(f)
@@ -79,9 +79,11 @@ extract no capacitance
79
79
  extract no coupling
80
80
  extract no resistance
81
81
  extract no adjust
82
- if { ! $::env(MAGIC_NO_EXT_UNIQUE) } {
83
- extract unique
82
+
83
+ if { $::env(MAGIC_EXT_UNIQUE) != "none" } {
84
+ extract unique $::env(MAGIC_EXT_UNIQUE)
84
85
  }
86
+
85
87
  # extract warn all
86
88
  extract
87
89
 
librelane/steps/magic.py CHANGED
@@ -458,15 +458,18 @@ class SpiceExtraction(MagicStep):
458
458
  Variable(
459
459
  "MAGIC_EXT_ABSTRACT_CELLS",
460
460
  Optional[List[str]],
461
- "A list of regular experssions which are matched against the cells of a "
461
+ "A list of regular expressions which are matched against the cells of a "
462
462
  + "the design. Matches are abstracted (black-boxed) during SPICE extraction.",
463
463
  ),
464
464
  Variable(
465
- "MAGIC_NO_EXT_UNIQUE",
466
- bool,
467
- "Enables connections by label in LVS by skipping `extract unique` in Magic extractions.",
468
- default=False,
469
- deprecated_names=["LVS_CONNECT_BY_LABEL"],
465
+ "MAGIC_EXT_UNIQUE",
466
+ Literal["all", "notopports", "noports", "none"],
467
+ 'Runs `extract unique` with the specified option. The default is "all", and "none" disables `extract unique`, allowing connections between separate nets by label in LVS.',
468
+ default="all",
469
+ deprecated_names=[
470
+ ("MAGIC_NO_EXT_UNIQUE", lambda o: "none" if o else "all"),
471
+ ("LVS_CONNECT_BY_LABEL", lambda o: "none" if o else "all"),
472
+ ],
470
473
  ),
471
474
  Variable(
472
475
  "MAGIC_EXT_SHORT_RESISTOR",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: librelane
3
- Version: 3.0.0.dev33
3
+ Version: 3.0.0.dev35
4
4
  Summary: An infrastructure for implementing chip design flows
5
5
  Home-page: https://github.com/librelane/librelane
6
6
  License: Apache-2.0
@@ -42,7 +42,7 @@ librelane/examples/spm-user_project_wrapper/user_project_wrapper.v,sha256=zc6GC5
42
42
  librelane/flows/__init__.py,sha256=ghtmUG-taVpHJ3CKJRYZGn3dU0r93araT1EIGlBEsxg,896
43
43
  librelane/flows/builtins.py,sha256=tR14Qc1ZUey2w-Ar4DWOvxuP7LGPtMecCJq8WgcYJpk,773
44
44
  librelane/flows/classic.py,sha256=JB9gVgP2hHPhMuCJg7hvoj2BvJcvRec7suEXPgHmz14,10971
45
- librelane/flows/cli.py,sha256=_aJjlalCsmUeLiqy1D8VFmBJ0dLelx24erqaK2q-AOs,16706
45
+ librelane/flows/cli.py,sha256=cW_S12VZqNVaWNcMlAKOVfbCALgl1AG_8rqvTcsvBDY,19324
46
46
  librelane/flows/flow.py,sha256=1zRhYQvnRte-VNcsVmAkikD_kZJVbgsqgLR-8CGYaLI,37034
47
47
  librelane/flows/misc.py,sha256=32Om3isexesfKKiJZCajNmINc-xdv7eVx_tgoh9SR6U,2015
48
48
  librelane/flows/optimizing.py,sha256=OwZz6WGmXpliwO8vtmhjKHD-kzDyNv-zoCECZIigXsI,6076
@@ -67,7 +67,7 @@ librelane/scripts/magic/def/antenna_check.tcl,sha256=T_r1CWgySFVlLMcoTrNXQ_aMRs_
67
67
  librelane/scripts/magic/def/mag.tcl,sha256=PuL3MH6pmZP5Qh2cJ0GygWNzaYjdCSCoAbOli-JB4fs,707
68
68
  librelane/scripts/magic/def/mag_gds.tcl,sha256=fwtQR9zPZpWqVmmLb-1hzY4WMCr4gbA3S0pTZsS9sss,2144
69
69
  librelane/scripts/magic/drc.tcl,sha256=gPGyI96lR10dJXcJACajzHaHiT6ayAYPJqrmmuQkABc,2395
70
- librelane/scripts/magic/extract_spice.tcl,sha256=-jDxVEGddch1YZLZXW1vFXhdLkeTjxk0d8eU1tBMBWc,2788
70
+ librelane/scripts/magic/extract_spice.tcl,sha256=2NjDFbqRfTsWhD1s-NGcDr8e4o3Ejg-4vCEoLt22RCc,2820
71
71
  librelane/scripts/magic/gds/drc_batch.tcl,sha256=O76rwxSrQgoCuoxk36tRBZkQaeMfJknlHrQA3mtU2JU,2198
72
72
  librelane/scripts/magic/gds/erase_box.tcl,sha256=wsVSwMlkZFJa_MEGNsdXLnXFvjZlrl_lzIWkJjcDBgg,929
73
73
  librelane/scripts/magic/gds/extras_mag.tcl,sha256=1raG0URUezUDEKkdDeJqdlS0Y5gb4IzQFnjFysHHlmU,1304
@@ -156,7 +156,7 @@ librelane/steps/checker.py,sha256=HD5YFPAbHQKsFmBDrIAbo_0clZcCszNhIXb4lHaNIeQ,21
156
156
  librelane/steps/common_variables.py,sha256=eih2eA1m0FpL8ydF5WWattwh_SxtzI55eb8gggJtBuY,12494
157
157
  librelane/steps/cvc_rv.py,sha256=qeroQPjidSAMYSp3nJNiQBYt8V73kkz3JK97uioo7J8,5294
158
158
  librelane/steps/klayout.py,sha256=18B7trKjyD8HnGUVwrjQV8XRzGu298CuosM1WOzg9oM,23255
159
- librelane/steps/magic.py,sha256=m4cZH2VomJs0RudtV8avSaZVqRj1NP7Pm2P6qo2z2X0,20919
159
+ librelane/steps/magic.py,sha256=Cc_qApOgeltIn7lKA7dBQ4Ud9EQtbMatsuGPEvqvpcQ,21183
160
160
  librelane/steps/misc.py,sha256=8ubCvFeFEspXrgnzNWINY5-TXTyalNtlvcX8TSw0qdg,5685
161
161
  librelane/steps/netgen.py,sha256=R9sDWv-9wKMdi2rkuLQdOc4uLlbYhXcKKd6WsZsnLt0,8953
162
162
  librelane/steps/odb.py,sha256=-zsXi0jVdtfBfAJI0OC4x1jI_B2OX5YVn4uAn6NyFdk,38424
@@ -167,7 +167,7 @@ librelane/steps/step.py,sha256=THIxZkhtkNYt1iRgMduD0ywrOTCaV7cCfUB2EqXN6-k,55751
167
167
  librelane/steps/tclstep.py,sha256=68AjCmbLhBscbzQDxRcPQVU-6UvZQNOalO7qNwUXCa4,10138
168
168
  librelane/steps/verilator.py,sha256=MWx2TpLqYyea9_jSeLG9c2S5ujvYERQZRFNaMhfHxZE,7916
169
169
  librelane/steps/yosys.py,sha256=lYdZPFvjcmdu_NE6rtB94_dysIK2qwGdGb480W6pg2w,12711
170
- librelane-3.0.0.dev33.dist-info/METADATA,sha256=u7-qZzdB2GVYUEeR1RAAyHvIC8GU4Y3cprFnjR_uJyU,6561
171
- librelane-3.0.0.dev33.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
172
- librelane-3.0.0.dev33.dist-info/entry_points.txt,sha256=0eZs2NOH-w-W_GVRCs-ualst26XplkPpJkOnGWMaFw0,306
173
- librelane-3.0.0.dev33.dist-info/RECORD,,
170
+ librelane-3.0.0.dev35.dist-info/METADATA,sha256=wYieL_eP8SWZNsfU8ZCsm2QXkAS8sUFXmkCyIyRhwuo,6561
171
+ librelane-3.0.0.dev35.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
172
+ librelane-3.0.0.dev35.dist-info/entry_points.txt,sha256=0eZs2NOH-w-W_GVRCs-ualst26XplkPpJkOnGWMaFw0,306
173
+ librelane-3.0.0.dev35.dist-info/RECORD,,