diff --git a/setup.py b/setup.py index a6ddcf643028c39279bf4221af154bde1fddeafb..bda2322fa6f5d7e5ee86b9baef10b306bd011566 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,4 @@ +#! /usr/bin/env python3 import sys import os @@ -5,31 +6,13 @@ import shutil import pathlib import multiprocessing -import toml - from math import ceil +import toml + from setuptools import setup, Extension from setuptools.command.build_ext import build_ext -####################################################### -# DEPENDENCIES -""" -Dictionnary containing all aidge submodules and their required version. -WARNING : THIS IS ONLY A LOOK UP TABLE, build dependencies are listed below -""" -aidge_dependencies_LuT = { - "aidge_core": "0.2.1", -} - -third_party_dependencies = [ - "numpy", - "onnx>=1.16.0", -] -aidge_required_dependencies = [ - "aidge_core", -] - def get_project_name() -> str: with open(pathlib.Path().absolute() / "pyproject.toml", "r") as file: @@ -37,32 +20,15 @@ def get_project_name() -> str: return project_toml["project"]["name"] -def read_local_or_pypi(package_name: str, version: str = None): - """ - Allows to know if a package exists locally or if it needs to be retrieved from pypi. - We check if each submodule is initilialized by checking the existence of pyproject.toml. - If not initialized, this project will be retrieved from pypi. - - Args : - package_name : name of the pkg to look up from - version : version requirement with the condition (i.e >=2.3.4 , ==1.2 , <3.0.0) - """ - submodule = pathlib.Path(__file__).parent / ".." / package_name.replace("-", "_") - - if (submodule / "pyproject.toml").exists(): - return f"{package_name} @ file://{submodule.absolute()}" - elif version: - return f"{package_name}{version}" - return package_name - - -class CMakeExtension(Extension): +class AidgeBuildExtension(Extension): def __init__(self, name): super().__init__(name, sources=[]) -class CMakeBuild(build_ext): +class AidgePkgBuild(build_ext): def run(self): + #################################### + # BUILD PACKAGE # This lists the number of processors available on the machine # The compilation will use half of them max_jobs = str(ceil(multiprocessing.cpu_count() / 2)) @@ -124,18 +90,13 @@ class CMakeBuild(build_ext): currentFile = os.path.join(root, file) shutil.copy(currentFile, str(aidge_package.absolute())) - # Copy version.txt in aidge_package - os.chdir(os.path.dirname(__file__)) - shutil.copy("version.txt", str(aidge_package.absolute())) - if __name__ == "__main__": setup( include_package_data=True, - install_requires=aidge_required_dependencies + third_party_dependencies, - ext_modules=[CMakeExtension(get_project_name())], + ext_modules=[AidgeBuildExtension(get_project_name())], cmdclass={ - "build_ext": CMakeBuild, + "build_ext": AidgePkgBuild, }, zip_safe=False, )