diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 00000000..72219958 --- /dev/null +++ b/MANIFEST.in @@ -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 \ No newline at end of file diff --git a/compiler/__init__.py b/compiler/__init__.py new file mode 100644 index 00000000..fadee237 --- /dev/null +++ b/compiler/__init__.py @@ -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) \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..5aebe600 --- /dev/null +++ b/pyproject.toml @@ -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" \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..cb9729a2 --- /dev/null +++ b/setup.py @@ -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, +) \ No newline at end of file