blob: 9b7b85d67707a21052fa234c1a425da0f9ce051c [file] [log] [blame]
#!/usr/bin/env python3
# Copyright 2020 The Skywater PDK Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import json
import argparse
from pathlib import Path
import common
common_prefix="skywater-pdk/libraries"
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
"output",
help="The path to the output directory",
type=Path)
args = parser.parse_args()
cell_names = {
"probec_s8p": "probec_sky130",
"probe_s8p": "probe_sky130",
"pargate_s8d": "pargate_sky130",
}
libraries = args.output / common_prefix
for cell, new_name in cell_names.items():
dirs = libraries.rglob('*' + cell)
for dir in dirs:
fixed_dir = Path(str(dir).replace(cell, new_name))
dir.replace(fixed_dir)
files = fixed_dir.rglob('*' + cell + '*')
for file in files:
fixed_file = Path(str(file).replace(cell, new_name))
file.replace(fixed_file)
for file in fixed_dir.rglob("*"):
os.system(f"sed -i 's/{cell}/{new_name}/g' {file}")