Add setup files for package

This commit is contained in:
Eren Dogan 2022-10-25 12:22:18 -07:00
parent 9b6eb4a120
commit dc9d1e00d8
4 changed files with 102 additions and 0 deletions

12
MANIFEST.in Normal file
View File

@ -0,0 +1,12 @@
include requirements.txt
include docker/*
recursive-include compiler *
recursive-include technology *
exclude compiler/gen_stimulus.py
exclude compiler/model_data_util.py
exclude compiler/printGDS.py
exclude compiler/processGDS.py
exclude compiler/uniquifyGDS.py
exclude compiler/view_profile.py
exclude compiler/run_profile.sh
global-exclude *.pyc

22
compiler/__init__.py Normal file
View File

@ -0,0 +1,22 @@
# See LICENSE for licensing information.
#
# Copyright (c) 2016-2021 Regents of the University of California and The Board
# of Regents for the Oklahoma Agricultural and Mechanical College
# (acting for and on behalf of Oklahoma State University)
# All rights reserved.
#
import os
import sys
# Attempt to add the source code to the PYTHONPATH here before running globals.init_openram().
try:
OPENRAM_HOME = os.path.abspath(os.environ.get("OPENRAM_HOME"))
except:
import openram
OPENRAM_HOME = os.path.dirname(openram.__file__)
if not os.path.isdir(OPENRAM_HOME):
assert False
if OPENRAM_HOME not in sys.path:
sys.path.insert(0, OPENRAM_HOME)

15
pyproject.toml Normal file
View File

@ -0,0 +1,15 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
[project]
name = "openram"
version = "1.2.0"
description = "An open-source static random access memory (SRAM) compiler"
authors = [
{ name="Matthew Guthaus", email="mrg@ucsc.edu" },
]
keywords = [ "sram", "magic", "gds", "netgen", "ngspice", "netlist" ]
readme = "README.md"
license = { text = "BSD-3-Clause License" }
requires-python = ">=3.6"

53
setup.py Normal file
View File

@ -0,0 +1,53 @@
# See LICENSE for licensing information.
#
# Copyright (c) 2016-2021 Regents of the University of California and The Board
# of Regents for the Oklahoma Agricultural and Mechanical College
# (acting for and on behalf of Oklahoma State University)
# All rights reserved.
#
from setuptools import setup, find_namespace_packages
# Include these folder from the root of repo as submodules
include = ["docker", "technology"]
# Exclude files/folders with these words
exclude = ["docs", "images", "macros"]
# Find all modules inside the 'compiler' folder
dirs = []
for dir in find_namespace_packages():
if any(x in dir for x in exclude):
continue
dirs.append(dir)
# Replace 'compiler' with 'openram' for package names
packages = []
for dir in dirs:
packages += [dir.replace("compiler", "openram")]
# Make the included folders submodules of openram package
for i in range(len(packages)):
if any(x in packages[i] for x in include):
packages[i] = "openram." + packages[i]
# Fix directory paths
for i in range(len(dirs)):
dirs[i] = dirs[i].replace(".", "/")
# Zip package names and their paths
package_dir = {k: v for k, v in zip(packages, dirs)}
# Create a list of required packages
with open("requirements.txt") as f:
reqs = f.read().splitlines()
# Call the setup to create the package
setup(
packages=packages,
package_dir=package_dir,
include_package_data=True,
# install_requires=reqs,
)