-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
50 lines (43 loc) · 1.58 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
from setuptools import setup
descrip = 'Streamlined text writing on images, using the Pillow (PIL) library'
long_description = (
"An extension for the Pillow (PIL) library for streamlined "
"writing of text in an image, with automatic textwrapping and "
"indendation, optional text-block justification, configurable font "
"settings, and basic bold/italic formatting.\n\n"
"Visit [the GitHub repository](https://github.com/JamesPImes/piltextbox) "
"for a quickstart guide."
)
MODULE_DIR = 'piltextbox'
def get_constant(constant):
setters = {
"version": "__version__ = ",
"author": "__author__ = ",
"author_email": "__email__ = ",
"url": "__website__ = "
}
var_setter = setters[constant]
with open(rf".\{MODULE_DIR}\_constants.py", "r") as file:
for line in file:
if line.startswith(var_setter):
version = line[len(var_setter):].strip('\'\n \"')
return version
raise RuntimeError(f"Could not get {constant} info.")
setup(
name='piltextbox',
version=get_constant('version'),
packages=[
'piltextbox',
'piltextbox.textbox',
'piltextbox.textbox.formatting'
],
url=get_constant('url'),
license='MIT',
author=get_constant('author'),
author_email=get_constant('author_email'),
description=descrip,
long_description=long_description,
long_description_content_type="text/markdown",
package_data={'': ['LICENSE.txt', 'requirements.txt']},
include_package_data=True
)