-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py.in
115 lines (93 loc) · 2.83 KB
/
setup.py.in
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
import os
from setuptools import setup, Distribution
packages = []
package_data = {}
def write_version_py(filename='python/paddle_custom_device/sophgo/__init__.py'):
cnt = '''# THIS FILE IS GENERATED FROM PADDLEPADDLE SETUP.PY
#
full_version = '@PADDLE_VERSION@'
git_commit_id = '@GIT_HASH@'
cntoolkit_version = '@CNTOOLKIT_VERSION@'
cnnl_version = '@CNNL_VERSION@'
cncl_version = '@CNCL_VERSION@'
sophgoops_version = '@SOPHGOOPS_VERSION@'
__all__ = ['version']
def version():
"""Get the version info of paddle custom sophgo
Returns:
version: version of paddle custom sophgo
commit: the commit id of paddle custom sophgo
cann: the cann version of paddle custom sophgo
Examples:
.. code-block:: python
import paddle_custom_device
paddle_custom_device.sophgo.version()
# version: 0.0.0
# commit: 98ae7a84b51e36fc15a1fef7808a82ed8b792fdf
# cntoolkit: 3.4.2
# cnnl: 1.17.0
# cncl: 1.9.3
# sophgoops: 0.6.0
"""
print('version:', full_version)
print('commit:', git_commit_id)
print('cntoolkit:', cntoolkit_version)
print('cnnl:', cnnl_version)
print('cncl:', cncl_version)
print('sophgoops:', sophgoops_version)
'''
dirname = os.path.dirname(filename)
if not os.path.exists(dirname):
os.makedirs(dirname)
with open(filename, 'w') as f:
f.write(cnt)
def write_init_py(filename='python/paddle_custom_device/__init__.py'):
cnt = '''# THIS FILE IS GENERATED FROM PADDLEPADDLE SETUP.PY
#
from . import sophgo # noqa: F401
__all__ = [ # noqa
'sophgo',
]
'''
with open(filename, 'w') as f:
f.write(cnt)
class BinaryDistribution(Distribution):
def has_ext_modules(self):
return True
def main():
write_version_py()
write_init_py()
setup(
name = '@CMAKE_PROJECT_NAME@',
version='@PADDLE_VERSION@',
description='PaddlePaddle Custom Device sophgo Plugin',
long_description='',
long_description_content_type="text/markdown",
author_email="[email protected]",
maintainer="PaddlePaddle",
maintainer_email="[email protected]",
project_urls={},
license='Apache Software License',
packages= [
'paddle_custom_device',
'paddle_custom_device.sophgo'
],
include_package_data=True,
package_data = {
'': ['*.so', '*.h', '*.py', '*.hpp'],
},
package_dir = {
'': 'python',
},
zip_safe=False,
distclass=BinaryDistribution,
entry_points={
'console_scripts': [
]
},
classifiers=[
],
keywords='PaddlePaddle Custom Device sophgo Plugin',
)
if __name__ == '__main__':
main()