From 1f76661a8b2ae519df8613ee6e9ff0ecebb719fa Mon Sep 17 00:00:00 2001 From: Christophe Guillon <christophe.guillon@inria.fr> Date: Thu, 18 Jul 2024 14:14:38 +0200 Subject: [PATCH] [Setup] Remove additional build dependency on toml Minimize dependencies for the setup.py script, this facilitates use in development mode and with legacy install processes. Here we remove the toml requirement at the cost of specifying the project name directly. --- pyproject.toml | 3 +-- setup.py | 12 +++--------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 7d875bb35..b82075998 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,8 +23,7 @@ test = [ requires = [ "setuptools>=64", "setuptools_scm[toml]==7.1.0", - "cmake>=3.15.3.post1", - "toml" + "cmake>=3.15.3.post1" ] build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py index 4cd3c18c1..96ccac47a 100644 --- a/setup.py +++ b/setup.py @@ -6,17 +6,11 @@ import multiprocessing from math import ceil -import toml - from setuptools import setup, Extension from setuptools.command.build_ext import build_ext -def get_project_name() -> str: - with open(pathlib.Path().absolute() / "pyproject.toml", "r") as file: - project_toml = toml.load(file) - return project_toml["project"]["name"] - +PROJECT_NAME = "aidge_core" class CMakeExtension(Extension): def __init__(self, name): @@ -75,7 +69,7 @@ class CMakeBuild(build_ext): self.spawn(["cmake", "--install", ".", "--config", compile_type]) os.chdir(str(cwd)) - aidge_package = build_lib / (get_project_name()) + aidge_package = build_lib / PROJECT_NAME # Get "aidge core" package # ext_lib = build_temp @@ -92,7 +86,7 @@ class CMakeBuild(build_ext): if __name__ == "__main__": setup( - ext_modules=[CMakeExtension(get_project_name())], + ext_modules=[CMakeExtension(PROJECT_NAME)], cmdclass={ "build_ext": CMakeBuild, }, -- GitLab