This repository was archived by the owner on Jan 27, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.py
More file actions
executable file
·76 lines (65 loc) · 2.36 KB
/
Copy pathsetup.py
File metadata and controls
executable file
·76 lines (65 loc) · 2.36 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
#!/usr/bin/env python3
"""Setup file for Magritte.
Reference:
https://hynek.me/articles/sharing-your-labor-of-love-pypi-quick-and-dirty/
"""
import os
import re
import sys
from setuptools import setup, find_packages
from pip.req import parse_requirements
README_FILENAME = "README.rst"
REQUIREMENTS = {
'prod': "requirements.txt",
'dev': "requirements-dev.txt"
}
def get_version(package):
"""Return package version as listed in `__version__` in `init.py`."""
with open(os.path.join(package, '__init__.py'), 'rb') as init_py:
src = init_py.read().decode('utf-8')
return re.search("__version__ = ['\"]([^'\"]+)['\"]", src).group(1)
def parse_reqs(filename):
"""Parse setup requirements from a requirements.txt file."""
install_reqs = parse_requirements(filename, session=False)
return [str(ir.req) for ir in install_reqs]
def get_req_list():
"""Get the requirements by weather we're building develop or not."""
req_list = parse_reqs(REQUIREMENTS['prod'])
if len(sys.argv) > 2 and sys.argv[2] == ('develop'):
req_list += parse_reqs(REQUIREMENTS['dev'])
return req_list
with open(README_FILENAME, 'r') as readme_file:
LONG_DESCRIPTION = readme_file.read()
setup(
name='magritte',
version=get_version('magritte'),
description='Optimize image files and comic archives with external tools',
author='AJ Slater',
author_email='aj@slater.net',
url='https://github.com/ajslater/magritte/',
install_requires=get_req_list(),
entry_points={
'console_scripts': [
'magritte=magritte.cli:main'
]
},
long_description=LONG_DESCRIPTION,
license="GPLv2",
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Intended Audience :: End Users/Desktop',
'Natural Language :: English',
'Environment :: Console',
'License :: OSI Approved :: GNU General Public License v2 (GPLv2)',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Topic :: Multimedia :: Graphics :: Graphics Conversion',
'Topic :: System :: Archiving :: Backup',
'Topic :: System :: Archiving :: Mirroring',
'Topic :: Utilities'
],
packages=find_packages(),
test_suite='magritte.tests',
)