Skip to content

Commit

Permalink
Move to Antlr 4.9 in newer nix-eda
Browse files Browse the repository at this point in the history
  • Loading branch information
donn committed Nov 7, 2024
1 parent 570fd3e commit 2a44e8c
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 54 deletions.
31 changes: 8 additions & 23 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,46 +1,31 @@
{
antlr4_10,
black,
lib,
black,
nix-gitignore,
buildPythonPackage,
poetry-core,
setuptools,
pytest,
coverage,
antlr4_9,
antlr4_9-runtime,
}:

let
antlr4_10-python3-runtime = buildPythonPackage rec {
pname = "antlr4-python3-runtime";
inherit (antlr4_10.runtime.cpp) version src;

sourceRoot = "source/runtime/Python3";

doCheck = false;

meta = with lib; {
description = "Runtime for ANTLR";
homepage = "https://www.antlr.org/";
license = licenses.bsd3;
};
};
in buildPythonPackage {
buildPythonPackage {
name = "ioplace_parser";
version = (builtins.fromTOML (builtins.readFile ./pyproject.toml)).tool.poetry.version;
format = "pyproject";

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

nativeBuildInputs = [
poetry-core
antlr4_10
antlr4_9
];

propagatedBuildInputs = [
antlr4_10-python3-runtime
antlr4_9-runtime
];

nativeCheckInputs = [
pytest
black
Expand Down
20 changes: 19 additions & 1 deletion flake.lock

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

52 changes: 27 additions & 25 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,39 @@
# limitations under the License.
{
inputs = {
nixpkgs.url = github:nixos/nixpkgs/nixos-24.05;
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 = lib.composeManyExtensions [
(nix-eda.composePythonOverlay (pkgs': pkgs: pypkgs': pypkgs: let
callPythonPackage = lib.callPackageWith (pkgs' // pkgs'.python3.pkgs);
in {
ioplace-parser = callPythonPackage ./default.nix {};
}))
];
};

# 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 {
ioplace-parser = callPythonPackage ./default.nix {};
default = ioplace-parser;
}
legacyPackages = nix-eda.forAllSystems (
system:
import nixpkgs {
inherit system;
overlays = [nix-eda.overlays.default self.overlays.default];
}
);

# Outputs
packages = nix-eda.forAllSystems (system: {
inherit (self.legacyPackages.${system}.python3.pkgs) ioplace-parser;
default = self.packages.${system}.ioplace-parser;
});
};
}
8 changes: 3 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ioplace_parser"
version = "0.3.0"
version = "0.4.0"
description = "Antlr4-based parser for the OpenLane I/O Placement script"
readme = "Readme.md"
authors = ["Efabless Corporation <[email protected]>"]
Expand All @@ -11,15 +11,13 @@ classifiers = [
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS :: MacOS X",
]
include = [
"_ioplace_parser_antlr/**/*.py"
]
include = ["_ioplace_parser_antlr/**/*.py"]

[tool.poetry.build]

[tool.poetry.dependencies]
python = ">=3.8"
antlr4-python3-runtime = "~=4.10.0"
antlr4-python3-runtime = "~=4.9.0"

[tool.poetry.dev-dependencies]
wheel = "^0.38"
Expand Down

0 comments on commit 2a44e8c

Please sign in to comment.