-
Notifications
You must be signed in to change notification settings - Fork 100
/
install_tech.py
35 lines (27 loc) · 778 Bytes
/
install_tech.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""Symlink tech to klayout."""
import os
import pathlib
import sys
if sys.platform == "win32":
klayout_folder = "KLayout"
else:
klayout_folder = ".klayout"
cwd = pathlib.Path(__file__).resolve().parent
home = pathlib.Path.home()
src = cwd / "openfasoc" / "klayout" / "sky130"
dest_folder = home / klayout_folder / "tech"
dest_folder.mkdir(exist_ok=True, parents=True)
dest = dest_folder / "sky130"
def install_tech(src, dest):
"""Installs tech."""
if dest.exists():
print(f"tech already installed in {dest}")
return
try:
os.symlink(src, dest)
except Exception:
os.remove(dest)
os.symlink(src, dest)
print(f"layermap installed to {dest}")
if __name__ == "__main__":
install_tech(src=src, dest=dest)