-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathsetup.py
118 lines (101 loc) · 3.28 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 Mark Lee
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
####
# Dirty Monkeypatching Hacks
####
# distutils sdist for Vagrant
#
# Allow distutils sdist to work correctly when using Vagrant + VirtualBox
# shared folders, where hard links are not implemented.
#
# See also: http://bugs.python.org/msg208792
import os
import sys
if 'sdist' in sys.argv and os.environ.get('USER', '') == 'vagrant':
if hasattr(os, 'link'):
del os.link
# distutils check ReST + pygments
#
# When the long description contains a code block, the distutils ``check -r``
# will fail because the default options do not include ``syntax_highlight``.
# Monkeypatch ``docutils.frontend.OptionParser`` to provide a default for
# this option.
if 'check' in sys.argv:
try:
from docutils.frontend import OptionParser
except ImportError:
pass # docutils isn't installed, ignore
else:
OptionParser.settings_defaults['syntax_highlight'] = None
####
# Your regularly scheduled setup file
####
import json
import re
from setuptools import find_packages, setup
GPL3PLUS = 'License :: OSI Approved :: ' \
'GNU General Public License v3 or later (GPLv3+)',
CLASSIFIERS = [
'Development Status :: 4 - Beta',
'Framework :: Flask',
GPL3PLUS,
'Operating System :: POSIX',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
]
RE_REQ_COMMENT = re.compile(r'#.*$')
def requires_from_req_txt(filename):
requires = []
with open(filename) as f:
for line in f:
req = RE_REQ_COMMENT.sub('', line).strip()
if req == '' or '://' in req:
continue
if req.startswith('-r '):
requires += requires_from_req_txt(req[3:])
else:
requires.append(req)
return requires
with open('package.json') as f:
metadata = json.load(f)
with open('README.rst') as f:
long_description = f.read()
requires = requires_from_req_txt('requirements.txt')
attrs = {
'name': metadata['name'],
'version': metadata['version'],
'description': metadata['description'],
'long_description': long_description,
'author': metadata['author']['name'],
'author_email': '[email protected]',
'url': metadata['homepage'],
'packages': find_packages(),
'include_package_data': True,
'zip_safe': False,
'entry_points': {
'console_scripts': [
'gmusicprocurator = gmusicprocurator.__main__:run',
],
},
'install_requires': requires,
'extras_require': {
'libsass': ['libsass'],
},
'classifiers': CLASSIFIERS,
}
setup(**attrs)