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

fix: setup.py now functions with name from pyproject.toml + fixed script .ps1 for aidge core

parent 2968bd74
No related branches found
No related tags found
No related merge requests found
if ($env:AIDGE_DEPENDENCIES.Length -split " " -eq 0) {
if ($($env:AIDGE_DEPENDENCIES -split " ").Length -eq 0) {
Write-Host "- No dependencies provided for current repsitory" Write-Host "- No dependencies provided for current repsitory"
New-Item -ItemType Directory -Force -Path ".\build" | Out-Null New-Item -ItemType Directory -Force -Path ".\build" | Out-Null
Remove-Item -Path ".\build\*" -Recurse -Force Remove-Item -Path ".\build\*" -Recurse -Force
} else { } else {
Write-Host "Retrieving given dependencies to build current package : $($deps -join ',')" Write-Host "Retrieving given dependencies to build current package : $env:AIDGE_DEPENDENCIES"
foreach ($dep in $env:AIDGE_DEPENDENCIES -split " ") { foreach ($dep in $($env:AIDGE_DEPENDENCIES -split " ")) {
Write-Host "Retrieving : $dep" Write-Host "Retrieving : $dep"
$dep_path = Get-ChildItem -Path "/host/home/" -Directory -Filter $dep -Recurse | $dep_path = Get-ChildItem -Path "/host/home/" -Directory -Filter $dep -Recurse |
Where-Object { $_.FullName -notmatch 'install' -and Where-Object { $_.FullName -notmatch 'install' -and
...@@ -23,7 +23,7 @@ if ($env:AIDGE_DEPENDENCIES.Length -split " " -eq 0) { ...@@ -23,7 +23,7 @@ if ($env:AIDGE_DEPENDENCIES.Length -split " " -eq 0) {
New-Item -Path ".\build" -ItemType Directory -Force | Out-Null New-Item -Path ".\build" -ItemType Directory -Force | Out-Null
Get-ChildItem -Path ".\build" -File | Remove-Item -Force Get-ChildItem -Path ".\build" -File | Remove-Item -Force
pip install . -Verbose pip install . -Verbose
} else { } else {
throw "$dep not found, aborting." throw "$dep not found, aborting."
} }
} }
......
...@@ -12,15 +12,28 @@ classifiers = [ ...@@ -12,15 +12,28 @@ classifiers = [
dynamic = ["version"] # defined in tool.setuptools_scm dynamic = ["version"] # defined in tool.setuptools_scm
[build-system] [build-system]
requires = ["setuptools>=68", "setuptools-scm", "cmake"] requires = [
"setuptools>=64",
"setuptools_scm[toml]==7.1.0",
"cmake",
"toml"
]
build-backend = "setuptools.build_meta" build-backend = "setuptools.build_meta"
#####################################################
# SETUPTOOLS
[tool.setuptools]
#####################################################
# SETUPTOOLS_SCM
[tool.setuptools_scm]
write_to = "aidge_core/_version.py"
##################################################### #####################################################
# CIBUILDWHEEL # CIBUILDWHEEL
[tool.cibuildwheel] [tool.cibuildwheel]
build-frontend = "build" build-frontend = "build"
############## AIDGE DEPENDENCIES DECLARATION ### AIDGE DEPENDENCIES DECLARATION
# aidge_core do not rely on any aidge dependency, hence this string is empty # aidge_core do not rely on any aidge dependency, hence this string is empty
[tool.cibuildwheel.linux.environment] [tool.cibuildwheel.linux.environment]
# AIDGE_DEPENDENCIES = "" # format => "dep_1 dep_2 ... dep_n" # AIDGE_DEPENDENCIES = "" # format => "dep_1 dep_2 ... dep_n"
...@@ -29,22 +42,13 @@ build-frontend = "build" ...@@ -29,22 +42,13 @@ build-frontend = "build"
[tool.cibuildwheel.linux] [tool.cibuildwheel.linux]
before-build = [ before-build = [
'echo "dependencies to retrieve : ${AIDGE_DEPENDENCIES}"',
"bash .gitlab/ci/cibuildwheel_build_deps_before_build_wheel.sh ${AIDGE_DEPENDENCIES}" "bash .gitlab/ci/cibuildwheel_build_deps_before_build_wheel.sh ${AIDGE_DEPENDENCIES}"
] ]
[tool.cibuildwheel.windows] [tool.cibuildwheel.windows]
before-build = [ before-build = [
'Write-Host "dependencies to retrieve : $env:{AIDGE_DEPENDENCIES}"', "powershell -File .\\.gitlab\\ci\\cibuildwheel_build_deps_before_build_wheel.ps1"
".\\.gitlab\\ci\\cibuildwheel_build_deps_before_build_wheel.ps1"
] ]
#####################################################
# SETUPTOOLS
[tool.setuptools]
# packages=["aidge_core", "export"]
[tool.setuptools_scm]
version_file = "_version.py"
##################################################### #####################################################
# PYLINT # PYLINT
......
...@@ -9,19 +9,18 @@ import multiprocessing ...@@ -9,19 +9,18 @@ import multiprocessing
from math import ceil from math import ceil
import toml
from setuptools import setup, Extension from setuptools import setup, Extension
from setuptools import find_packages from setuptools import find_packages
from setuptools.command.build_ext import build_ext from setuptools.command.build_ext import build_ext
def get_project_name() -> str: def get_project_name() -> str:
return open(pathlib.Path().absolute() / "project_name.txt", "r").read() with open(pathlib.Path().absolute() / "pyproject.toml", "r") as file :
project_toml = toml.load(file)
print(f"project_name = {project_toml["project"]["name"]}")
return project_toml["project"]["name"]
def get_project_version() -> str:
aidge_root = pathlib.Path().absolute()
version = open(aidge_root / "version.txt", "r").read().strip()
return version
class CMakeExtension(Extension): class CMakeExtension(Extension):
......
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