-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
145 lines (117 loc) · 3.78 KB
/
setup.py
File metadata and controls
145 lines (117 loc) · 3.78 KB
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# 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.
"""
Module to setup HaTeMiLe for Python.
"""
import os
from setuptools import find_packages
from setuptools import setup
BASE_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
LOCALES_DIRECTORY = '_locales'
def get_long_description():
"""
Returns the long description of HaTeMiLe for Python.
:return: The long description of HaTeMiLe for Python.
:rtype: str
"""
with open(
os.path.join(BASE_DIRECTORY, 'README.md'),
'r',
encoding='utf-8'
) as readme_file:
return readme_file.read()
def get_packages():
"""
Returns the packages used for HaTeMiLe for Python.
:return: The packages used for HaTeMiLe for Python.
:rtype: list(str)
"""
packages = find_packages(exclude=['tests'])
packages.append('')
packages.append('js')
packages.append(LOCALES_DIRECTORY)
for directory in os.listdir(LOCALES_DIRECTORY):
packages.append(LOCALES_DIRECTORY + '.' + directory)
return packages
def get_package_data():
"""
Returns the packages with static files of HaTeMiLe for Python.
:return: The packages with static files of HaTeMiLe for Python.
:rtype: dict(str, list(str))
"""
package_data = {
'': ['*.xml'],
'js': ['*.js'],
LOCALES_DIRECTORY: ['*']
}
for directory in os.listdir(LOCALES_DIRECTORY):
package_data[LOCALES_DIRECTORY + '.' + directory] = ['*.json']
return package_data
def get_requirements():
"""
Returns the content of 'requirements.txt' in a list.
:return: The content of 'requirements.txt'.
:rtype: list(str)
"""
requirements = []
with open(
os.path.join(BASE_DIRECTORY, 'requirements.txt'),
'r',
encoding='utf-8'
) as requirements_file:
lines = requirements_file.readlines()
for line in lines:
requirements.append(line.strip())
return requirements
def get_requirements_dev():
"""
Returns the content of 'requirements-dev.txt' in a list.
:return: The content of 'requirements-dev.txt'.
:rtype: list(str)
"""
requirements = []
with open(
os.path.join(BASE_DIRECTORY, 'requirements-dev.txt'),
'r',
encoding='utf-8'
) as requirements_file:
lines = requirements_file.readlines()
for line in lines:
requirements.append(line.strip())
return requirements
setup(
name='hatemile',
description=(
'HaTeMiLe is a library that can convert a HTML code in a HTML code '
+ 'more accessible.'
),
long_description=get_long_description(),
long_description_content_type='text/markdown',
version='2.0.1',
url='https://github.com/hatemile/hatemile-for-python',
author='Carlson Santana Cruz',
license='Apache2',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python :: 3',
'Natural Language :: English',
'Topic :: Software Development :: Libraries'
],
packages=get_packages(),
package_data=get_package_data(),
install_requires=get_requirements(),
extras_require={
'dev': get_requirements_dev()
}
)