Skip to content

Commit

Permalink
feat: add support for ihp-sg13g2
Browse files Browse the repository at this point in the history
* Add support for new PDK family, ihp-sg13g2
* Migrate from setuptools to poetry
* Use nix-eda
  • Loading branch information
donn committed Jan 8, 2025
1 parent 7458169 commit 50c862e
Show file tree
Hide file tree
Showing 17 changed files with 1,180 additions and 143 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
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
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 50c862e

Please sign in to comment.