-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
81 lines (70 loc) · 2.82 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
#!/usr/bin/env python
from setuptools import setup
from setuptools import find_packages
import pathlib
import re
this_dir = pathlib.Path(__file__).parent.absolute()
project_name = "embedimg"
package_dir = "src"
path_to_init_file = this_dir / package_dir / project_name / "__init__.py"
with open(this_dir / "README.md", encoding="utf-8") as file:
long_description = file.read()
with open(this_dir / "requirements.txt", encoding="utf-8") as reqs:
requirements = [line.strip() for line in reqs]
def get_property(property: str, path_to_init_file: pathlib.Path) -> str:
"""
Reads a property from the project's __init__.py
e.g. get_property("__version__") --> "1.2.3"
"""
regex = re.compile(r"{}\s*=\s*[\"'](?P<value>[^\"']*)[\"']".format(property))
try:
with open(path_to_init_file) as initfh:
try:
result = regex.search(initfh.read()).group("value")
except AttributeError:
result = None
except FileNotFoundError:
result = None
return result
setup(
name=project_name,
version=get_property("version", path_to_init_file.parent / "version.py"),
description="Embeds linked images into html as base64 data",
long_description=long_description,
long_description_content_type="text/markdown",
author=get_property("__author__", path_to_init_file),
author_email=get_property("__author_email__", path_to_init_file),
url="https://github.com/Nagidal/embedimg",
classifiers=[
"Development Status :: 2 - Pre-Alpha",
# "Development Status :: 3 - Alpha",
# "Development Status :: 4 - Beta",
# "Development Status :: 5 - Production/Stable",
"Intended Audience :: End Users/Desktop",
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"Environment :: Console",
# "Topic :: Software Development :: Testing",
"Topic :: Utilities",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Programming Language :: Python :: 3.9",
"Operating System :: OS Independent",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS :: MacOS X",
],
keywords="html image embedding base64",
package_dir={"": package_dir},
packages=find_packages(where=package_dir),
package_data={
project_name: [],
},
python_requires=">=3.9",
install_requires=requirements,
entry_points={
"console_scripts": [f"{project_name} = {project_name}.__main__:{project_name}",
],
},
platforms=["any"],
)