From 0b250f49cbd8961dbfebe399b7063412941cf948 Mon Sep 17 00:00:00 2001 From: J08nY Date: Thu, 28 Sep 2023 17:43:33 +0200 Subject: Remove deprecated pkg_resources usage. --- pyecsca/codegen/render.py | 6 +++--- pyproject.toml | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pyecsca/codegen/render.py b/pyecsca/codegen/render.py index 19d395f..7202e86 100644 --- a/pyecsca/codegen/render.py +++ b/pyecsca/codegen/render.py @@ -7,11 +7,11 @@ from os import makedirs from typing import Optional, List, Set, Mapping, MutableMapping, Any, Tuple from jinja2 import Environment, PackageLoader -from pkg_resources import resource_filename +from importlib_resources import files, as_file from public import public from pyecsca.ec.configuration import HashType, RandomMod, Reduction, Multiplication, Squaring from pyecsca.ec.coordinates import CoordinateModel -from pyecsca.ec.formula import (Formula) +from pyecsca.ec.formula import Formula from pyecsca.ec.model import CurveModel from pyecsca.ec.mult import (ScalarMultiplier, LTRMultiplier, RTLMultiplier, CoronMultiplier, LadderMultiplier, SimpleLadderMultiplier, DifferentialLadderMultiplier, @@ -248,7 +248,7 @@ def render(config: DeviceConfiguration) -> Tuple[str, str, str]: symlinks = ["asn1", "bn", "hal", "hash", "prng", "simpleserial", "tommath", "fat.h", "rand.h", "point.h", "curve.h", "mult.h", "formulas.h", "action.h", "Makefile.inc"] for sym in symlinks: - os.symlink(resource_filename("pyecsca.codegen", sym), path.join(temp, sym)) + os.symlink(files("pyecsca.codegen").joinpath(sym), path.join(temp, sym)) gen_dir = path.join(temp, "gen") makedirs(gen_dir, exist_ok=True) diff --git a/pyproject.toml b/pyproject.toml index 8eef1b8..fd0f147 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,8 @@ name = "pyecsca-codegen" version = "0.2.0" authors = [ - { name = "Jan Jancar", email = "johny@neuromancer.sk" } + { name = "Jan Jancar", email = "johny@neuromancer.sk" }, + { name = "Andrej Batora"} ] description = "Python Elliptic Curve cryptography Side Channel Analysis toolkit (codegen package)." readme = "README.md" @@ -35,6 +36,7 @@ "asn1crypto", "jinja2", "Click", + "importlib-resources", "rainbow @ git+https://github.com/Ledger-Donjon/rainbow@master" ] -- cgit v1.3.1