This repository was archived by the owner on Nov 6, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup.py
90 lines (77 loc) · 2.42 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
83
84
85
86
87
88
89
90
from typing import Any
import setuptools
import ast
import re
import os
try:
BASEDIR = os.path.dirname(os.path.realpath(__file__))
except NameError:
BASEDIR = None
def read_file(name: str) -> str:
"""Get the string contained in the file named name.
Args:
name (str): File name
Returns:
str: File content
"""
with open(name, "r", encoding="utf8") as f:
return f.read()
def _get_constant(name: str) -> Any:
"""Read a __magic__ constant from skippy/__init__.py.
We don't import Skippy here because it can go wrong for multiple
reasons. Instead we use re/ast to get the value directly from the source
file.
Args:
name: The name of the argument to get.
Return:
The value of the argument.
"""
field_re = re.compile(r"__{}__\s+=\s+(.*)".format(re.escape(name)))
path = os.path.join(BASEDIR, "skippy", "__init__.py")
line = field_re.search(read_file(path)).group(1)
value = ast.literal_eval(line)
return value
readme = read_file("README.md")
requirements = read_file("requirements.txt").splitlines()
setuptools.setup(
name="skippy-pad",
version=_get_constant("version"),
description=_get_constant("description"),
long_description=readme,
long_description_content_type="text/markdown",
url="https://github.com/skippy-dev/skippy/",
author=_get_constant("author"),
author_email=_get_constant("email"),
python_requires=">=3.7",
license=_get_constant("license"),
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Other Audience",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
],
keywords=["scp", "wikidot", "pyscp", "skippy"],
packages=setuptools.find_packages(),
install_requires=requirements,
extras_require={
"preview": ["PyQtWebEngine==5.15.5"],
"ftml": ["PyQtWebEngine==5.15.5", "pyftml==0.1.2"],
},
package_dir={"skippy": "skippy"},
package_data={
"skippy": [
"resources/*",
"resources/*/*",
"lang/*.toml",
"plugins/*.py"
]
},
entry_points={
"console_scripts": [
"skippy = skippy.app:run",
],
},
)