-
Notifications
You must be signed in to change notification settings - Fork 17
/
setup.py
50 lines (41 loc) · 1.59 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
# Copyright 2021-2022 NetCracker Technology Corporation
#
# 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.
# See the License for the specific language governing permissions and
# limitations under the License.
import re
from setuptools import setup
def read(path):
with open(path, 'r', encoding='utf-8') as f:
return f.read()
VERSION = read("kubemarine/version").strip()
README = read("README.md")
# Special case to refer to anchor within the current README page should be translated to explicit README referring.
README = re.sub(
r'\[(.*?)]\((#.*?)\)',
rf'[\1](https://github.com/Netcracker/KubeMarine/blob/{VERSION}/README.md\2)',
README
)
# Replace all relative links (not starting with http[s]://) to absolute referring to specific version on GitHub
README = re.sub(
r'\[(.*?)]\((?!https?://)(.*?)\)',
rf'[\1](https://github.com/Netcracker/KubeMarine/blob/{VERSION}/\2)',
README
)
# Though deprecated, it seems to be the only way to provide shell scripts.
SCRIPTS=["bin/kubemarine.cmd", "bin/kubemarine"]
setup(
scripts=SCRIPTS,
version=VERSION,
long_description=README,
long_description_content_type='text/markdown',
url='https://github.com/Netcracker/KubeMarine'
)