Skip to content
Snippets Groups Projects
Verified Commit 2d054551 authored by Dominik Rimpf's avatar Dominik Rimpf :chipmunk:
Browse files

fix build

parent 31a75996
No related branches found
No related tags found
No related merge requests found
Pipeline #377176 passed
File moved
File moved
File moved
[build-system]
# Minimum requirements for the build system to execute.
requires = ["setuptools", "wheel", "net_api_generator @ git+https://gitlab.kit.edu/scc-net/netvs/api-generator.git@main", "semver", "requests"]
requires = ["setuptools", "wheel", "semver", "requests", "net_api_generator @ git+https://gitlab.kit.edu/scc-net/netvs/api-generator.git@main"]
build-backend = "setuptools.build_meta"
[project]
name = 'netdb_client'
authors = [{name = 'NETVS Team', email = 'netvs@scc.kit.edu'}]
description = 'This is a meta package to install the automatically generated NET-API definitions for the currently supported API versions.'
requires-python = ">=3.7"
license = {file = "LICENSE"}
dependencies = [
"requests",
]
dynamic = ["version"]
[project.urls]
homepage = 'https://gitlab.kit.edu/scc-net/netvs/netdb-client'
[tool.setuptools]
packages = ["netdb_client"]
......@@ -4,8 +4,12 @@ import subprocess
import os
import requests
import semver
from importlib.metadata import version
vers = requests.get(f"{os.environ.get('NETDB_SCHEME', 'https')}://{os.environ.get('NETDB_ENDPOINT')}").json()[0]
vers = requests.get(
f"{os.environ.get('NETDB_SCHEME', 'https')}://{os.environ.get('NETDB_ENDPOINT', 'api.netdb.scc.kit.edu')}"
).json()[0]
largest_ver = None
for v in vers:
sem_v = semver.Version.parse(v['numeric'])
......@@ -20,8 +24,8 @@ if post_version is not None and not post_version.isdigit():
def get_gen_version():
ver = subprocess.run(['pip freeze | grep net_api_generator'], shell=True, text=True, check=True, capture_output=True).stdout
return ver.split('@')[-1][:12]
ver = version('net_api_generator')
return ver.split('+')[-1]
class APIGenBuild(build_py):
......@@ -29,10 +33,10 @@ class APIGenBuild(build_py):
build_versions = [f'{v["major"]}.{v["minor"]}' for v in vers]
default_version = f'{largest_ver.major}.{largest_ver.minor}'
environ = os.environ.copy()
for version in build_versions:
target_dir = os.path.join(self.build_lib, 'netdb_client', f"api{version.replace('.', '')}")
for b_version in build_versions:
target_dir = os.path.join(self.build_lib, 'netdb_client', f"api{b_version.replace('.', '')}")
self.mkpath(target_dir)
environ['NETDB_VERSION'] = version
environ['NETDB_VERSION'] = b_version
subprocess.run(['net-api-generator', 'python', f'--output-dir={target_dir}'], check=True, env=environ)
target_dir = os.path.join(self.build_lib, 'netdb_client')
environ['NETDB_VERSION'] = default_version
......@@ -49,13 +53,6 @@ if util_version != latest_previous_util_version and str(largest_ver) == latest_p
post_version = int(post_version) + 1
setup(
name='netdb_client',
version=f'{str(largest_ver)}{".post" + str(post_version) if post_version is not None else ""}{".dev1" if os.environ.get("CI_COMMIT_BRANCH", "local") == "devel" else ""}+{util_version}',
author='NETVS-Team <netvs@scc.kit.edu>',
description='This is a meta package to install the automatically generated NET-API definitions for the currently supported API versions.',
url='https://gitlab.kit.edu/scc-net/netvs/netdb-client',
install_requires=['requests'],
python_requires='>=3.7',
packages=['netdb_client'],
cmdclass={'build_py': APIGenBuild},
)
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