From 2523f40b9203222ea639d8e7e9701cfda1ac7844 Mon Sep 17 00:00:00 2001
From: Johan Euphrosine <proppy@google.com>
Date: Thu, 20 Jul 2023 23:10:25 +0900
Subject: [PATCH] misc/open_pdks/sky130a: apply google/skywater-pdk#423

---
 misc/open_pdks/sky130a/423.patch | 22 ++++++++++++++++++++++
 misc/open_pdks/sky130a/meta.yaml |  2 ++
 2 files changed, 24 insertions(+)
 create mode 100644 misc/open_pdks/sky130a/423.patch

diff --git a/misc/open_pdks/sky130a/423.patch b/misc/open_pdks/sky130a/423.patch
new file mode 100644
index 00000000..976b3b75
--- /dev/null
+++ b/misc/open_pdks/sky130a/423.patch
@@ -0,0 +1,22 @@
+diff --git a/scripts/python-skywater-pdk/skywater_pdk/liberty.py b/scripts/python-skywater-pdk/skywater_pdk/liberty.py
+index 77f2bb58b..52da7d459 100755
+--- a/scripts/python-skywater-pdk/skywater_pdk/liberty.py
++++ b/scripts/python-skywater-pdk/skywater_pdk/liberty.py
+@@ -83,7 +83,7 @@ class TimingType(enum.IntFlag):
+ 
+     def names(self):
+         o = []
+-        for t in TimingType:
++        for _, t in TimingType.__members__.items():
+             if t in self:
+                 o.append(t.name)
+         return ", ".join(o)
+@@ -123,7 +123,7 @@ def singular(self):
+ 
+     @property
+     def types(self):
+-        tt = set(t for t in TimingType if t in self)
++        tt = set(t for _, t in TimingType.__members__.items() if t in self)
+         if TimingType.ccsnoise in tt:
+             tt.remove(TimingType.basic)
+         return list(tt)
diff --git a/misc/open_pdks/sky130a/meta.yaml b/misc/open_pdks/sky130a/meta.yaml
index ed798daf..271451b8 100644
--- a/misc/open_pdks/sky130a/meta.yaml
+++ b/misc/open_pdks/sky130a/meta.yaml
@@ -11,6 +11,8 @@ source:
   # use url below to prevent submodules
   - url: https://github.com/google/skywater-pdk/archive/49d3c73c2cd8ea42cdae5056440baef0f72e7e42.zip
     folder: skywater-pdk
+    patches:
+      - 423.patch # drop when google/skywater-pdk#423 is merged
   - url: https://github.com/google/skywater-pdk-libs-sky130_fd_sc_hd/archive/ac7fb61f06e6470b94e8afdf7c25268f62fbd7b1.zip
     folder: skywater-pdk/libraries/sky130_fd_sc_hd/latest
   - url: https://github.com/google/skywater-pdk-libs-sky130_fd_sc_hvl/archive/4fd4f858d16c558a6a488b200649e909bb4dd800.zip