This repository has been archived by the owner on Jan 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
141 lines (121 loc) · 3.93 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
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import io
import os
import re
import sys
from setuptools import Command, find_packages, setup
PROJECT_NAME = 'latex-ji18n'
PACKAGE_NAME = PROJECT_NAME.replace('-', '_')
URL = 'https://github.com/mondeja/%s' % PROJECT_NAME
EMAIL = 'mondejar1994@gmail.com'
AUTHOR = 'Álvaro Mondéjar Rubio'
REQUIRES_PYTHON = '>=3'
REQUIRED = [
'jinja2>=2.11.2',
'inflection>=0.5.1',
'ruamel.yaml>=0.16.10',
'click>=7.1.2',
'bibtexparser>=1.2.0',
]
LINT_EXTRAS = [
'flake8==3.9.1',
'flake8-print==4.0.0',
'flake8-implicit-str-concat==0.2.0',
'isort==5.8.0',
'yamllint==1.26.1',
]
DEV_EXTRAS = [
'twine==3.4.1',
'bump2version==1.0.1',
'pre-commit==2.12.1',
]
HERE = os.path.abspath(os.path.dirname(__file__))
with io.open(os.path.join(HERE, 'README.md'), encoding='utf-8') as f:
LONG_DESCRIPTION = '\n' + f.read()
ABOUT = {}
INIT_FILEPATH = os.path.join(HERE, PACKAGE_NAME, '__init__.py')
with io.open(INIT_FILEPATH, encoding='utf-8') as f:
content = f.read()
ABOUT['__title__'] = \
re.search(r'__title__\s=\s[\'"]([^\'"]+)[\'"]', content).group(1)
ABOUT['__version__'] = \
re.search(r'__version__\s=\s[\'"]([^\'"]+)[\'"]', content).group(1)
class UploadCommand(Command):
'Support setup.py upload.'
description = 'Build and publish the package.'
user_options = [
('test', None, 'Specify if you want to test your upload to Pypi.'),
]
@staticmethod
def status(s):
'Prints things in bold.'
sys.stdout.write('\033[1m{0}\033[0m\n'.format(s))
def initialize_options(self):
self.test = None
def finalize_options(self):
pass
def run(self):
from shutil import rmtree
try:
self.status('Removing previous builds…')
rmtree(os.path.join(HERE, 'dist'))
except OSError:
pass
self.status('Building Source and Wheel (universal) distribution…')
os.system('{0} setup.py sdist bdist_wheel --universal'.format(
sys.executable))
self.status('Uploading the package to PyPI via Twine…')
cmd = 'twine upload%s dist/*' % (
' --repository-url https://test.pypi.org/legacy/' if self.test
else ''
)
os.system(cmd)
sys.exit()
setup(
name=ABOUT['__title__'],
version=ABOUT['__version__'],
description='LaTeX Jinja2 i18n utilities.',
long_description=LONG_DESCRIPTION,
long_description_content_type='text/markdown',
author=AUTHOR,
author_email=EMAIL,
python_requires=REQUIRES_PYTHON,
url=URL,
project_urls={
'GitHub Project': 'https://github.com/mondeja/%s' % PROJECT_NAME,
'Issue Tracker': 'https://github.com/mondeja/%s/issues' % PROJECT_NAME
},
entry_points={
'console_scripts': [
'%s = %s.__main__:cli' % (PROJECT_NAME, PACKAGE_NAME),
],
},
packages=find_packages(exclude=['test']),
install_requires=REQUIRED,
extras_require={
'dev': DEV_EXTRAS,
'lint': LINT_EXTRAS,
},
include_package_data=True,
license='BSD License',
classifiers=[
# Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Development Status :: 4 - Beta',
'Programming Language :: Python',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Software Development :: Internationalization',
'Topic :: Text Processing',
'Topic :: Text Processing :: Markup :: LaTeX',
],
cmdclass={
'upload': UploadCommand,
},
)