Skip to content
Snippets Groups Projects
Commit 42e13ee9 authored by Grégoire Kubler's avatar Grégoire Kubler
Browse files

fix : setup.py no longers try to install core

parent c7b476a2
No related branches found
No related tags found
2 merge requests!93Release v0.3.0,!64Feat/release pip
Pipeline #49370 waiting for manual action
#! /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,
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment