-
Notifications
You must be signed in to change notification settings - Fork 6
/
setup.py
66 lines (56 loc) · 1.67 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
import re
import setuptools
with open("README.md", "r") as f:
LONG_DESCRIPTION = f.read()
with open("requirements.txt", "r") as f:
REQUIREMENTS = f.read().splitlines()
version = ""
with open("kick/__init__.py") as f:
version = re.search(
r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), re.MULTILINE
).group( # type: ignore
1
)
if not version:
raise RuntimeError("version is not set")
if version.endswith(("a", "b", "rc")):
# append version identifier based on commit count
try:
import subprocess
p = subprocess.Popen(
["git", "rev-list", "--count", "HEAD"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
out, err = p.communicate()
if out:
version += out.decode("utf-8").strip()
p = subprocess.Popen(
["git", "rev-parse", "--short", "HEAD"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
out, err = p.communicate()
if out:
version += "+g" + out.decode("utf-8").strip()
except Exception:
pass
PACKAGES = ["kick", "kick.types"]
setuptools.setup(
name="kick.py",
author="cibere",
author_email="[email protected]",
url="https://github.com/cibere/kick.py",
project_urls={
"Code": "https://github.com/cibere/kick.py",
"Issue tracker": "https://github.com/cibere/kick.py/issues",
},
version="0.0.1",
python_requires=">=3.11",
install_requires=REQUIREMENTS,
packages=PACKAGES,
description="",
long_description=LONG_DESCRIPTION,
long_description_content_type="text/markdown",
license="MIT",
)