Skip to content

Commit

Permalink
Fixed python sources to reflect use of klayout_pex and klayout_pex_pr…
Browse files Browse the repository at this point in the history
…otobuf packages
  • Loading branch information
martinjankoehler committed Dec 10, 2024
1 parent 50147d0 commit 82c6b48
Show file tree
Hide file tree
Showing 19 changed files with 87 additions and 28 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protobuf_generate(

#_____________________________________________________________________________________________

set(PROTOBUF_PYTHON_GENERATED "${CMAKE_CURRENT_LIST_DIR}/build/python_kpex_protobuf")
set(PROTOBUF_PYTHON_GENERATED "${CMAKE_CURRENT_LIST_DIR}/build/python/klayout_pex_protobuf")
file(MAKE_DIRECTORY "${PROTOBUF_PYTHON_GENERATED}")

protobuf_generate(
Expand Down
23 changes: 23 additions & 0 deletions klayout_pex/fastcap/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#
# --------------------------------------------------------------------------------
# SPDX-FileCopyrightText: 2024 Martin Jan Köhler and Harald Pretl
# Johannes Kepler University, Institute for Integrated Circuits.
#
# This file is part of KPEX
# (see https://github.com/martinjankoehler/klayout-pex).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# SPDX-License-Identifier: GPL-3.0-or-later
# --------------------------------------------------------------------------------
#
4 changes: 2 additions & 2 deletions klayout_pex/fastcap/fastcap_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
import os
import subprocess

from kpex.log import (
from ..log import (
debug,
info,
warning,
error,
rule,
subproc,
)
from kpex.common.capacitance_matrix import CapacitanceMatrix
from ..common.capacitance_matrix import CapacitanceMatrix


def run_fastcap(exe_path: str,
Expand Down
2 changes: 1 addition & 1 deletion klayout_pex/fastercap/fastercap_input_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
)
from ..tech_info import TechInfo

import process_stack_pb2
import klayout_pex_protobuf.process_stack_pb2


class FasterCapInputBuilder:
Expand Down
2 changes: 1 addition & 1 deletion klayout_pex/fastercap/fastercap_model_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@

import klayout.db as kdb

from kpex.log import (
from ..log import (
debug,
info,
warning,
Expand Down
4 changes: 2 additions & 2 deletions klayout_pex/fastercap/fastercap_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
import time
from typing import *

from kpex.log import (
from ..log import (
info,
# warning,
rule,
subproc,
)
from kpex.common.capacitance_matrix import CapacitanceMatrix
from ..common.capacitance_matrix import CapacitanceMatrix


def run_fastercap(exe_path: str,
Expand Down
2 changes: 1 addition & 1 deletion klayout_pex/klayout/lvs_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import subprocess
import time

from kpex.log import (
from ..log import (
debug,
info,
warning,
Expand Down
2 changes: 1 addition & 1 deletion klayout_pex/klayout/lvsdb_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

import klayout.db as kdb

import tech_pb2
import klayout_pex_protobuf.tech_pb2
from ..log import (
console,
debug,
Expand Down
2 changes: 1 addition & 1 deletion klayout_pex/klayout/netlist_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import klayout.db as kdb

from kpex.log import (
from klayout_pex.log import (
info,
)

Expand Down
4 changes: 2 additions & 2 deletions klayout_pex/klayout/netlist_expander.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@

import klayout.db as kdb

from kpex.log import (
from ..log import (
info,
warning,
)
from kpex.common.capacitance_matrix import CapacitanceMatrix
from ..common.capacitance_matrix import CapacitanceMatrix


class NetlistExpander:
Expand Down
2 changes: 1 addition & 1 deletion klayout_pex/klayout/repair_rdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import xml.etree.ElementTree as ET

import klayout.rdb as rdb
from kpex.log import (
from ..log import (
LogLevel,
set_log_level,
register_additional_handler,
Expand Down
4 changes: 2 additions & 2 deletions klayout_pex/magic/magic_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
import os
import subprocess

from kpex.log import (
from ..log import (
info,
# warning,
rule,
subproc,
)
from kpex.version import __version__
from ..version import __version__


class MagicPEXMode(StrEnum):
Expand Down
2 changes: 1 addition & 1 deletion klayout_pex/rcx25/extraction_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from dataclasses import dataclass, field
from typing import *

import process_parasitics_pb2
import klayout_pex_protobuf.process_parasitics_pb2


NetName = str
Expand Down
2 changes: 1 addition & 1 deletion klayout_pex/rcx25/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
)
from ..tech_info import TechInfo
from .extraction_results import *
import process_stack_pb2
import klayout_pex_protobuf.process_stack_pb2


EdgeInterval = Tuple[float, float]
Expand Down
6 changes: 3 additions & 3 deletions klayout_pex/tech_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
import google.protobuf.json_format

from .util.multiple_choice import MultipleChoicePattern
import tech_pb2
import process_stack_pb2
import process_parasitics_pb2
import klayout_pex_protobuf.tech_pb2
import klayout_pex_protobuf.process_stack_pb2
import klayout_pex_protobuf.process_parasitics_pb2

class TechInfo:
"""Helper class for Protocol Buffer tech_pb2.Technology"""
Expand Down
Empty file.
34 changes: 34 additions & 0 deletions klayout_pex_protobuf/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#
# --------------------------------------------------------------------------------
# SPDX-FileCopyrightText: 2024 Martin Jan Köhler and Harald Pretl
# Johannes Kepler University, Institute for Integrated Circuits.
#
# This file is part of KPEX
# (see https://github.com/martinjankoehler/klayout-pex).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# SPDX-License-Identifier: GPL-3.0-or-later
# --------------------------------------------------------------------------------
#

import os
import sys

# NOTE: generated protobuf files will import other protobuf python files as if they were on the top-level,
# while we want to have them in package klayout_kpex_protobuf
# FIXME: see also https://github.com/protocolbuffers/protobuf/issues/7061

_path = os.path.dirname(os.path.realpath(__file__))
if _path not in sys.path:
sys.path.append(_path)
1 change: 0 additions & 1 deletion kpex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,4 @@
DIR=$(dirname -- $(realpath ${BASH_SOURCE}))

export PYTHONPATH=$DIR/:$DIR/build/python:${PYTHONPATH}
# /usr/bin/env python3 $DIR/kpex/kpex_cli.py $*
/usr/bin/env python3 -m kpex $*
17 changes: 10 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,29 @@ classifiers = [
]

packages = [
{ include = "kpex", to = "klayout_pex" },
{ include = "klayout_pex" },
{ include = "pdk", to = "klayout_pex" },
{ include = "process_stack_pb2.py", from = "build/python_kpex_protobuf/", to = "klayout_pex" },
{ include = "process_parasitics_pb2.py", from = "build/python_kpex_protobuf/", to = "klayout_pex" },
{ include = "tech_pb2.py", from = "build/python_kpex_protobuf/", to = "klayout_pex" },
{ include = "process_stack_pb2.py", from = "build/python/klayout_pex_protobuf/", to = "klayout_pex_protobuf" },
{ include = "process_parasitics_pb2.py", from = "build/python/klayout_pex_protobuf/", to = "klayout_pex_protobuf" },
{ include = "tech_pb2.py", from = "build/python/klayout_pex_protobuf/", to = "klayout_pex_protobuf" },
{ include = "__init__.py", from = "klayout_pex_protobuf/", to = "klayout_pex_protobuf" },
{ include = "build/sky130A_tech.pb.json", to = "klayout_pex" },
{ include = "build/ihp_sg13g2_tech.pb.json", to = "klayout_pex" },
]
include = [
"kpex",
"klayout_pex_protobuf",
"pdk/**/*",
"build/python_kpex_protobuf/*",
"build/*.json"
"build/python/klayout_pex_protobuf/*",
"build/*.json",
"klayout_pex_protobuf/__init__.py"
]

[tool.poetry.urls]
"Bug Tracker" = "https://github.com/martinjankoehler/klayout-pex/issues"

[tool.poetry.scripts]
kpex = 'kpex.__main__:main'
kpex = 'klayout_pex.__main__:main'

[tool.poetry.dependencies]
python = "^3.12"
Expand Down

0 comments on commit 82c6b48

Please sign in to comment.