-
Notifications
You must be signed in to change notification settings - Fork 106
/
setup.py
82 lines (72 loc) · 1.98 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# -*- coding: utf-8 -*-
# Copyright 2023 OpenSPG Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied.
import os
from setuptools import setup, find_packages
package_name = "openspg-kag"
# version
cwd = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(cwd, "KAG_VERSION"), "r") as rf:
version = rf.readline().strip("\n").strip()
# license
license = ""
with open(os.path.join(cwd, "LICENSE"), "r") as rf:
line = rf.readline()
while line:
line = line.strip()
if line:
license += "# " + line + "\n"
else:
license += "#\n"
line = rf.readline()
# Generate kag.__init__.py
with open(os.path.join(cwd, "kag/__init__.py"), "w") as wf:
content = f"""{license}
__package_name__ = "{package_name}"
__version__ = "{version}"
from kag.common.env import init_env
init_env()
"""
wf.write(content)
setup(
name=package_name,
version=version,
description="kag",
url="https://github.com/OpenSPG/openspg",
packages=find_packages(
where=".",
exclude=[
".*test.py",
"*_test.py",
"*_debug.py",
"*.txt",
"tests",
"tests.*",
"configs",
"configs.*",
"test",
"test.*",
"*.tests",
"*.tests.*",
"*.pyc",
],
),
python_requires=">=3.8",
install_requires=[
r.strip()
for r in open("requirements.txt", "r")
if not r.strip().startswith("#")
],
include_package_data=True,
package_data={
"bin": ["*"],
},
)