Skip to content

Commit

Permalink
Fix Python version requirement + move to Poetry
Browse files Browse the repository at this point in the history
  • Loading branch information
donn committed Jul 1, 2024
1 parent 4849956 commit e762ba4
Show file tree
Hide file tree
Showing 13 changed files with 432 additions and 105 deletions.
12 changes: 5 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
PYTHON3 ?= python3
ANTLR4 ?= antlr4
REQ_FILES = ./requirements_dev.txt ./requirements.txt
REQ_FILES_PFX = $(addprefix -r ,$(REQ_FILES))

all: dist

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

.PHONY: lint
lint: venv/manifest.txt
Expand All @@ -20,12 +18,12 @@ _ioplace_parser_antlr/ioParser.py: ioLexer.g io.g
$(ANTLR4) -Dlanguage=Python3 -o $(@D) $^

venv: venv/manifest.txt
venv/manifest.txt: $(REQ_FILES)
venv/manifest.txt: pyproject.toml
rm -rf 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/python3 -m pip install --upgrade -r <(./venv/bin/poetry export --with dev --without-hashes --format=requirements.txt)
PYTHONPATH= ./venv/bin/python3 -m pip freeze > $@


Expand All @@ -37,4 +35,4 @@ clean:
rm -rf htmlcov/
rm -rf *.egg-info/
rm -rf .antlr/
rm -f .coverage
rm -f .coverage
4 changes: 2 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# IO Place Parser
Antlr4-based parser for the input files to OpenLane custom IO placers.

With syntax and (limited) semantic error reporting.
With syntactic and (limited) semantic error reporting.

# License
Apache License, version 2.0. See 'License'.
Apache License, version 2.0. See 'License'.
23 changes: 11 additions & 12 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
lib,
nix-gitignore,
buildPythonPackage,
poetry-core,
setuptools,
pytest,
coverage,
}:
Expand All @@ -23,31 +25,28 @@ let
license = licenses.bsd3;
};
};
in buildPythonPackage rec {
in buildPythonPackage {
name = "ioplace_parser";

version_file = builtins.readFile ./ioplace_parser/__version__.py;
version_list = builtins.match ''.+''\n__version__ = "([^"]+)"''\n.+''$'' version_file;
version = builtins.head version_list;
version = (builtins.fromTOML (builtins.readFile ./pyproject.toml)).tool.poetry.version;
format = "pyproject";

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

PIP_DISABLE_PIP_VERSION_CHECK = "1";

nativeBuildInputs = [
poetry-core
antlr4_10
black
];

propagatedBuildInputs = [
antlr4_10-python3-runtime
];

nativeCheckInputs = [
pytest
black
coverage
];

preBuild = "make antlr";
checkPhase = "pytest";

propagatedBuildInputs = [
antlr4_10-python3-runtime
];
}
7 changes: 4 additions & 3 deletions flake.lock

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

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.
{
inputs = {
nixpkgs.url = github:nixos/nixpkgs/nixos-23.11;
nixpkgs.url = github:nixos/nixpkgs/nixos-24.05;
};

outputs = {
Expand Down
1 change: 0 additions & 1 deletion ioplace_parser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from .parse import Side, Order, parse
from .__version__ import __version__
17 changes: 0 additions & 17 deletions ioplace_parser/__version__.py

This file was deleted.

8 changes: 0 additions & 8 deletions nix/gitignore.nix

This file was deleted.

Loading

0 comments on commit e762ba4

Please sign in to comment.