Skip to content

Commit

Permalink
feat: add support for ihp-sg13g2 (#94)
Browse files Browse the repository at this point in the history
* Add support for new PDK family, ihp-sg13g2
* Fix various open_pdks-only asusmptions
* Migrate from setuptools to poetry
* Use nix-eda
  • Loading branch information
donn authored Jan 8, 2025
1 parent 50b53e4 commit 448f87f
Show file tree
Hide file tree
Showing 22 changed files with 1,204 additions and 173 deletions.
4 changes: 2 additions & 2 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[flake8]
ignore = E203,E266,E302,E501,W503
ignore = E203,E231,E266,E302,E501,W503
exclude =
.git,
__pycache__,
Expand All @@ -8,4 +8,4 @@ exclude =
venv/,
!volare/build
per-file-ignores =
*/__init__.py:F401
*/__init__.py:F401
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Set Up Python
uses: actions/setup-python@v4
with:
python-version: "3.6"
python-version: "3.8"
- name: Build Distribution
run: |
make dist
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ dist/
logs/
pdks/
/result
requirements_tmp.txt
15 changes: 8 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
PYTHON3 ?= python3
REQ_FILES = ./requirements_dev.txt ./requirements.txt
REQ_FILES_PFX = $(addprefix -r ,$(REQ_FILES))

all: dist

all: dist
.PHONY: dist
dist: venv/manifest.txt
./venv/bin/python3 setup.py sdist bdist_wheel
./venv/bin/poetry build

.PHONY: lint
lint: venv/manifest.txt
Expand All @@ -15,13 +14,15 @@ lint: venv/manifest.txt
./venv/bin/mypy --check-untyped-defs .

venv: venv/manifest.txt
venv/manifest.txt: $(REQ_FILES)
venv/manifest.txt: ./pyproject.toml
rm -rf venv
$(PYTHON3) -m venv ./venv
python3 -m venv ./venv
PYTHONPATH= ./venv/bin/python3 -m pip install --upgrade pip
PYTHONPATH= ./venv/bin/python3 -m pip install --upgrade wheel
PYTHONPATH= ./venv/bin/python3 -m pip install --upgrade $(REQ_FILES_PFX)
PYTHONPATH= ./venv/bin/python3 -m pip install --upgrade wheel poetry poetry-plugin-export
PYTHONPATH= ./venv/bin/poetry export --with dev --without-hashes --format=requirements.txt --output=requirements_tmp.txt
PYTHONPATH= ./venv/bin/python3 -m pip install --upgrade -r requirements_tmp.txt
PYTHONPATH= ./venv/bin/python3 -m pip freeze > $@
@echo ">> Venv prepared."

.PHONY: veryclean
veryclean: clean
Expand Down
24 changes: 4 additions & 20 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<p align="center">Volare is a version manager (and builder) for builds of <a href="https://github.com/google/open-source-pdks">Google open-source PDKs</a> using <a href="https://github.com/rtimothyedwards/open_pdks">open_pdks</a>.</p>

# Requirements
* Python 3.6+ with PIP
* Python 3.8+ with PIP
* macOS or GNU/Linux

## macOS
Expand All @@ -20,15 +20,15 @@ brew install python3
```

## Debian and Ubuntu
Debian 10+ or Ubuntu 18.04+ is required.
Debian 11+ or Ubuntu 20.04+ is required.

```sh
sudo apt-get update
sudo apt-get install python3 python3-pip xz-utils
```

## RHEL and Derivatives
RHEL 7+ or compatible operating system required.
RHEL 8+ or compatible operating system required.
```sh
sudo yum install -y python3 python3-pip
```
Expand All @@ -37,28 +37,12 @@ sudo yum install -y python3 python3-pip
# Installation and Upgrades
```sh
# To install (or upgrade)
python3 -m pip install --upgrade --no-cache-dir volare
python3 -m pip install --user --upgrade --no-cache-dir volare

# To verify it works
volare --version
```

## Troubleshooting
With a typical Python 3.6 or higher installation with PIP, installing `volare` is as simple as a `pip install`. Despite that, there are some peculiarities with PIP itself: For example, you may see a warning among these lines:

```sh
WARNING: The script volare is installed in '/home/test/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
```
The solution is as simple as adding something like this to your shell's profile:
```sh
export PATH="/home/test/.local/bin:$PATH"
```
Do note that the path (`/home/test/.local/bin` in this example) varies depending on your operating system and version of Python you install, and whether you use `sudo` (absolutely not recommended) or not, so ensure that you actually read the warning and add the correct path.
# About the builds
In its current inception, volare supports builds of **sky130** and **gf180mcu** PDKs using [Open_PDKs](https://github.com/efabless/open_pdks), including the following libraries:

Expand Down
45 changes: 24 additions & 21 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,35 +21,38 @@
pcpp,
zstandard,
truststore,
nix-gitignore,
poetry-core,
}:
buildPythonPackage {
pname = "volare";
version = (builtins.fromTOML (builtins.readFile ./pyproject.toml)).tool.poetry.version;
format = "pyproject";

buildPythonPackage rec {
name = "volare";
src = ./.;
doCheck = false;

version_file = builtins.readFile ./volare/__version__.py;
version_list = builtins.match ''.+''\n__version__ = "([^"]+)"''\n.+''$'' version_file;
version = builtins.head version_list;
nativeBuildInputs = [
poetry-core
];

src = nix-gitignore.gitignoreSourcePure ./.gitignore ./.;

doCheck = false;
dependencies =
[
click
pyyaml
rich
httpx
pcpp
zstandard
truststore
]
++ httpx.optional-dependencies.socks;

propagatedBuildInputs = [
click
pyyaml
rich
httpx
pcpp
zstandard
truststore
] ++ httpx.optional-dependencies.socks;

meta = with lib; {
meta = {
mainProgram = "volare";
description = "Version manager and builder for open-source PDKs";
homepage = "https://github.com/efabless/volare";
license = licenses.asl20;
platforms = platforms.darwin ++ platforms.linux;
license = lib.licenses.asl20;
platforms = lib.platforms.darwin ++ lib.platforms.linux;
};
}
27 changes: 23 additions & 4 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 30 additions & 23 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,43 @@
# limitations under the License.
{
inputs = {
nixpkgs.url = github:nixos/nixpkgs/nixos-23.11;
nix-eda.url = github:efabless/nix-eda;
};

outputs = {
self,
nixpkgs,
nix-eda,
...
}: {
# Helper functions
forAllSystems = function:
nixpkgs.lib.genAttrs [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
] (
system:
function (import nixpkgs {
inherit system;
})
);
}: let
nixpkgs = nix-eda.inputs.nixpkgs;
lib = nixpkgs.lib;
in {
overlays = {
default = nix-eda.composePythonOverlay (pkgs': pkgs: pypkgs': pypkgs: let
callPythonPackage = lib.callPackageWith (pkgs' // pkgs'.python3.pkgs);
in {
volare = callPythonPackage ./default.nix {};
});
};

legacyPackages = nix-eda.forAllSystems (
system:
import nixpkgs {
inherit system;
overlays = [
nix-eda.overlays.default
self.overlays.default
];
}
);

# Outputs
packages = self.forAllSystems (pkgs: let
callPackage = pkgs.lib.callPackageWith (pkgs // self.packages.${pkgs.system});
callPythonPackage = pkgs.lib.callPackageWith (pkgs // pkgs.python3.pkgs // self.packages.${pkgs.system});
in
rec {
volare = callPythonPackage ./default.nix {};
default = volare;
packages = nix-eda.forAllSystems (
system: let
pkgs = self.legacyPackages."${system}";
in {
inherit (pkgs.python3.pkgs) volare;
default = self.packages."${system}".volare;
}
);
};
Expand Down
8 changes: 0 additions & 8 deletions nix/gitignore.nix

This file was deleted.

Loading

0 comments on commit 448f87f

Please sign in to comment.