diff --git a/.gitlab/ci/cibuildwheel_build_deps_before_build_wheel.sh b/.gitlab/ci/cibuildwheel_build_deps_before_build_wheel.sh index ed3d542bd53ebcac00824da3316e2b5e7337fd3a..16c39da0010af405c46153b653a69024e602b81b 100755 --- a/.gitlab/ci/cibuildwheel_build_deps_before_build_wheel.sh +++ b/.gitlab/ci/cibuildwheel_build_deps_before_build_wheel.sh @@ -1,21 +1,26 @@ #!/bin/bash set -x set -e -for repo in $AIDGE_DEPENDENCIES ; do # ${AIDGE_DEPENDENCIES} is defined in the pyproject.toml - REPO_PATH=$(find /host -type d -name $repo \ - -not -path '*proc*' \ - -not -path '*install*' \ - -not -path '*.git*' \ - -not -path '*miniconda*' \ - -not -path '*.local*' \ - -not -path "*lib*" \ - -not -path "*/$repo/$repo" \ - -print -quit) - - cd $REPO_PATH +if [[ $repo == "" ]]; then # case for aidge_ core mkdir -p build # creating build if its not already there to hold the build of cpp files rm -rf build/* # build from scratch - pip install . -v -done +else + for repo in $AIDGE_DEPENDENCIES ; do # case for other projects + REPO_PATH=$(find /host/home/ -type d -name $repo \ + -not -path '*install*' \ + -not -path '*.git*' \ + -not -path '*miniconda*' \ + -not -path '*conda*' \ + -not -path '*.local*' \ + -not -path "*lib*" \ + -not -path "*/$repo/$repo" \ + -print -quit) + + cd $REPO_PATH + mkdir -p build # creating build if its not already there to hold the build of cpp files + rm -rf build/* # build from scratch + pip install . -v + done +fi set +x set +e diff --git a/pyproject.toml b/pyproject.toml index 5148011cb235f193138fcb909b0d409172df63ed..d3d43a57264f787b684f4f8918538a76df0648f4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "aidge_backend_cpu" description="CPU implementations of the operators of aidge framework" -dependencies = ["numpy", "aidge_core"] +dependencies = ["numpy>=1.21.6", "aidge_core>=0.3.0"] requires-python = ">= 3.7" dynamic = ["version"] #Â defined in tool.setuptools_scm readme = "README.md" @@ -12,25 +12,42 @@ classifiers = [ ] [build-system] -requires = ["setuptools>=68", "setuptools-scm"] +requires = [ + "setuptools>=64", + "setuptools_scm[toml]==7.1.0", + "cmake", + "toml" +] build-backend = "setuptools.build_meta" ##################################################### -#Â CIBUILDWHEEL +# SETUPTOOLS +[tool.setuptools] +##################################################### +# SETUPTOOLS_SCM +[tool.setuptools_scm] +write_to = "aidge_core/_version.py" + +##################################################### +# CIBUILDWHEEL [tool.cibuildwheel] build-frontend = "build" -before-build = ["bash .gitlab/ci/cibuildwheel_build_deps_before_build_wheel.sh ${AIDGE_DEPENDENCIES}"] -[tool.cibuildwheel.environment] +### AIDGE DEPENDENCIES DECLARATION # aidge_core do not rely on any aidge dependency, hence this string is empty +[tool.cibuildwheel.linux.environment] AIDGE_DEPENDENCIES = "aidge_core" # format => "dep_1 dep_2 ... dep_n" +[tool.cibuildwheel.windows.environment] +AIDGE_DEPENDENCIES = "aidge_core" # format => "dep_1","dep_2", ... ,"dep_n" -##################################################### -#Â SETUPTOOLS -[tool.setuptools] -# packages=["aidge_core", "export"] +[tool.cibuildwheel.linux] +before-build = [ + "bash .gitlab/ci/cibuildwheel_build_deps_before_build_wheel.sh ${AIDGE_DEPENDENCIES}" +] +[tool.cibuildwheel.windows] +before-build = [ + "powershell -File .\\.gitlab\\ci\\cibuildwheel_build_deps_before_build_wheel.ps1" +] -[tool.setuptools_scm] -version_file = "_version.py" ##################################################### diff --git a/setup.py b/setup.py index 9e1c141e7aefc271642936d6df9b2c2b0788a208..4552c8f13ea9cd6d973e64af97616570cb04f49a 100644 --- a/setup.py +++ b/setup.py @@ -26,19 +26,16 @@ import multiprocessing from math import ceil +import toml + from setuptools import setup, Extension from setuptools import find_packages from setuptools.command.build_ext import build_ext - def get_project_name() -> str: - return open(pathlib.Path().absolute() / "project_name.txt", "r").read() - - -def get_project_version() -> str: - aidge_root = pathlib.Path().absolute() - version = open(aidge_root / "version.txt", "r").read().strip() - return version + with open(pathlib.Path().absolute() / "pyproject.toml", "r") as file : + project_toml = toml.load(file) + return project_toml["project"]["name"] class CMakeExtension(Extension): @@ -116,21 +113,12 @@ class CMakeBuild(build_ext): if __name__ == "__main__": - setup( - name=get_project_name(), - version=get_project_version(), python_requires=">=3.7", - description=DOCLINES[0], - long_description_content_type="text/markdown", - long_description="\n".join(DOCLINES[2:]), - classifiers=[c for c in CLASSIFIERS.split("\n") if c], - packages=find_packages(where="."), include_package_data=True, ext_modules=[CMakeExtension(get_project_name())], cmdclass={ "build_ext": CMakeBuild, }, - install_requires=["aidge_core"], zip_safe=False, )