-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathsetup.py
67 lines (57 loc) · 1.83 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env python3
import importlib.util
import glob
import os
import sys
import subprocess
from setuptools import setup
from setuptools.command.install import install
from shutil import copyfile, copytree, rmtree
# A temporary path so we can access above the Python project root and fetch scripts and jars we need
TEMP_PATH = "deps"
OAP_HOME = os.path.abspath("../")
# Provide guidance about how to use setup.py
incorrect_invocation_message = """
If you are installing oap_mllib from source, you must first build oap_mllib and
run sdist.
After Building source code:
cd python
python setup.py sdist
pip install dist/*.tar.gz"""
# Figure out is the jar compiled.
JAR_PATH = os.path.join(OAP_HOME, "mllib-dal/target")
EXAMPLES_PATH = os.path.join(OAP_HOME, "examples")
JARS_TARGET = os.path.join(TEMP_PATH, "jars")
EXAMPLES_TARGET = os.path.join(TEMP_PATH, "examples")
try:
copytree(JAR_PATH, JARS_TARGET)
copytree(EXAMPLES_PATH, EXAMPLES_TARGET)
with open('../README.md') as f:
long_description = f.read()
VERSION = "1.6.0"
setup(
name='oap_mllib',
version=VERSION,
description='OAP MLlib',
long_description=long_description,
long_description_content_type="text/markdown",
packages=['oap_mllib',
'oap_mllib.jars',
'oap_mllib.examples'],
install_requires=[],
package_dir={
'oap_mllib': 'oap_mllib',
'oap_mllib.jars': 'deps/jars',
'oap_mllib.examples': 'deps/examples'
},
package_data={
'oap_mllib': ['*'],
'oap_mllib.jars': ['*.jar'],
'oap_mllib.examples': ['*'],
},
python_requires='>=3.6',
)
finally:
rmtree(os.path.join(TEMP_PATH, "jars"))
rmtree(os.path.join(TEMP_PATH, "examples"))
os.rmdir(TEMP_PATH)