Skip to content

Commit 2d3d7e9

Browse files
committed
fix(generate_klayout_tech): remove unused reference_dir / use_relative_paths
Per maliberty's review on #4234: rather than keep `reference_dir` and `use_relative_paths` around as ignored backward-compat parameters, drop them entirely and update flow/Makefile to stop passing `--reference-dir`. No remaining caller in the tree relies on either. Changes: * flow/util/generate_klayout_tech.py — `generate_klayout_tech()` signature is now (template_lyt, output_lyt, lef_files, map_files=None). CLI loses `--reference-dir` and `--use-relative-paths`. Stale comment / docstring lines about the dropped args go too. * flow/Makefile — `do-klayout` and `do-klayout_wrap` both stop passing `--reference-dir`. * flow/test/test_generate_klayout_tech.py — drops the now-invalid `reference_dir=` / `use_relative_paths=` kwargs from the three integration-style tests. Existing 13 tests still pass. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
1 parent c2c6abb commit 2d3d7e9

3 files changed

Lines changed: 3 additions & 44 deletions

File tree

flow/Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ do-klayout:
200200
--template $(KLAYOUT_TECH_FILE) \
201201
--output $(OBJECTS_DIR)/klayout.lyt \
202202
--lef-files $(OBJECTS_DIR)/klayout_tech.lef $(SC_LEF) $(ADDITIONAL_LEFS) \
203-
--reference-dir $(RESULTS_DIR) \
204203
--map-files $(wildcard $(FLOW_HOME)/platforms/$(PLATFORM)/*map)
205204

206205
$(OBJECTS_DIR)/klayout_wrap.lyt: $(KLAYOUT_TECH_FILE) $(OBJECTS_DIR)/klayout_tech.lef
@@ -212,8 +211,7 @@ do-klayout_wrap:
212211
$(PYTHON_EXE) $(UTILS_DIR)/generate_klayout_tech.py \
213212
--template $(KLAYOUT_TECH_FILE) \
214213
--output $(OBJECTS_DIR)/klayout_wrap.lyt \
215-
--lef-files $(OBJECTS_DIR)/klayout_tech.lef $(WRAP_LEFS) \
216-
--reference-dir $(OBJECTS_DIR)/def
214+
--lef-files $(OBJECTS_DIR)/klayout_tech.lef $(WRAP_LEFS)
217215

218216
$(WRAPPED_LEFS):
219217
mkdir -p $(OBJECTS_DIR)/lef $(OBJECTS_DIR)/def

flow/test/test_generate_klayout_tech.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,7 @@ def test_basic_generation(self):
120120
template_lyt=self.template,
121121
output_lyt=self.output,
122122
lef_files=[lef_path],
123-
reference_dir=self.results_dir,
124123
map_files=[],
125-
use_relative_paths=True,
126124
)
127125

128126
with open(self.output) as f:
@@ -152,9 +150,7 @@ def test_with_map_files(self):
152150
template_lyt=self.template,
153151
output_lyt=self.output,
154152
lef_files=[lef_path],
155-
reference_dir=self.results_dir,
156153
map_files=[map_path],
157-
use_relative_paths=False,
158154
)
159155

160156
with open(self.output) as f:
@@ -181,9 +177,7 @@ def test_multiple_lef_files(self):
181177
template_lyt=self.template,
182178
output_lyt=self.output,
183179
lef_files=lef_files,
184-
reference_dir=self.results_dir,
185180
map_files=[],
186-
use_relative_paths=True,
187181
)
188182

189183
with open(self.output) as f:

flow/util/generate_klayout_tech.py

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,14 @@ def replace_map_files(content, map_files):
3030
return content
3131

3232

33-
def generate_klayout_tech(
34-
template_lyt,
35-
output_lyt,
36-
lef_files,
37-
reference_dir=None,
38-
map_files=None,
39-
use_relative_paths=False,
40-
):
33+
def generate_klayout_tech(template_lyt, output_lyt, lef_files, map_files=None):
4134
"""Generate a klayout .lyt file from a platform template.
4235
4336
Args:
4437
template_lyt: Path to the platform .lyt template file.
4538
output_lyt: Path to write the generated .lyt file.
4639
lef_files: List of LEF file paths to include.
47-
reference_dir: Unused. Accepted for backward compatibility with
48-
callers (e.g. flow/Makefile) that still pass it from when
49-
paths were resolved relative to this directory.
5040
map_files: List of map file paths.
51-
use_relative_paths: Unused. Same backward-compat rationale as
52-
reference_dir -- paths are always written as plain abspath
53-
now, regardless of this flag.
5441
"""
5542
with open(template_lyt, "r") as f:
5643
content = f.read()
@@ -63,8 +50,7 @@ def generate_klayout_tech(
6350
# action execution -- they're only at the per-action sandbox -- so
6451
# resolution fails with errno=2. Plain abspath (NOT realpath, which
6552
# would chase Bazel input-file symlinks back out to the bare execroot)
66-
# keeps klayout pointed at the in-sandbox file. reference_dir and
67-
# use_relative_paths are both ignored.
53+
# keeps klayout pointed at the in-sandbox file.
6854
resolved_lefs = [os.path.abspath(f) for f in lef_files]
6955

7056
content = replace_lef_files(content, resolved_lefs)
@@ -87,35 +73,16 @@ def main():
8773
parser.add_argument(
8874
"--lef-files", nargs="*", default=[], help="LEF files to include"
8975
)
90-
parser.add_argument(
91-
"--reference-dir",
92-
required=False,
93-
default=None,
94-
help=(
95-
"Unused; accepted for backward compatibility. LEF / map paths "
96-
"are written as plain abspath regardless of this directory."
97-
),
98-
)
9976
parser.add_argument(
10077
"--map-files", nargs="*", default=[], help="Map files to include"
10178
)
102-
parser.add_argument(
103-
"--use-relative-paths",
104-
action="store_true",
105-
help=(
106-
"Unused; accepted for backward compatibility. LEF / map paths "
107-
"are written as plain abspath regardless of this flag."
108-
),
109-
)
11079
args = parser.parse_args()
11180

11281
generate_klayout_tech(
11382
template_lyt=args.template,
11483
output_lyt=args.output,
11584
lef_files=args.lef_files,
116-
reference_dir=args.reference_dir,
11785
map_files=args.map_files,
118-
use_relative_paths=args.use_relative_paths,
11986
)
12087

12188

0 commit comments

Comments
 (0)