|
1 | 1 | import os |
2 | 2 | from setuptools import setup |
| 3 | +from setuptools.command.install import install |
| 4 | +import site |
3 | 5 |
|
4 | 6 | here = os.path.abspath(os.path.dirname(__file__)) |
5 | 7 | with open(os.path.join(here, 'README.md'), encoding='utf-8') as f: |
6 | 8 | long_description = f.read() |
7 | 9 |
|
| 10 | +TRUSTY_VERSION = "1.12.0.Final" |
| 11 | + |
| 12 | + |
| 13 | +class PostInstall(install): |
| 14 | + """Fetch TrustyAI explainability JARs from Maven Central""" |
| 15 | + |
| 16 | + def run(self): |
| 17 | + install.run(self) |
| 18 | + _ROOT = os.path.join(site.getsitepackages()[0], "trustyai", "dep") |
| 19 | + print(f"Installing Maven dependencies into {_ROOT}") |
| 20 | + os.system(f"mvn org.apache.maven.plugins:maven-dependency-plugin:2.10:get " |
| 21 | + f"-DremoteRepositories=https://repository.sonatype.org/content/repositories/central " |
| 22 | + f"-Dartifact=org.kie.kogito:explainability-core:{TRUSTY_VERSION} -Dmaven.repo.local={_ROOT} -q") |
| 23 | + _TESTS_FILE = os.path.join("org", "kie", "kogito", "explainability-core", TRUSTY_VERSION, |
| 24 | + f"explainability-core-{TRUSTY_VERSION}-tests.jar") |
| 25 | + os.system(f"wget -O {os.path.join(_ROOT, _TESTS_FILE)} https://repo1.maven.org/maven2/{_TESTS_FILE}") |
| 26 | + |
| 27 | + |
8 | 28 | setup( |
9 | 29 | name="trustyai", |
10 | 30 | version="0.0.5", |
|
29 | 49 | packages=['trustyai', 'trustyai.model', 'trustyai.utils', 'trustyai.local'], |
30 | 50 | include_package_data=False, |
31 | 51 | install_requires=['Jpype1'], |
| 52 | + cmdclass={"install": PostInstall}, |
32 | 53 | ) |
0 commit comments