-
Notifications
You must be signed in to change notification settings - Fork 13
/
setup.py
executable file
·136 lines (120 loc) · 4.25 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
#!/usr/bin/env python3
import sys
import unittest
try:
from setuptools import setup, Command
have_setuptools = True
except ImportError:
from distutils.core import setup, Command
have_setuptools = False
from distutils.command.build import build
try:
import sphinx
from sphinx.setup_command import BuildDoc
using_sphinx = True
except ImportError:
using_sphinx = False
cmdclass = {}
if using_sphinx:
# use Sphinx to build the manpage if it is available
class BuildDocMan(BuildDoc):
def initialize_options(self):
BuildDoc.initialize_options(self)
self.builder = 'man'
self.source_dir = 'doc'
self.build_dir = 'build'
# automatically build manpages as sub target of build
build.sub_commands.append(('build_sphinx_man', None))
cmdclass['build_sphinx_man'] = BuildDocMan
import platform
if platform.system() in ['FreeBSD', 'OpenBSD']:
man_dir = 'man'
else:
man_dir = 'share/man'
import os.path
man_pages = [
(os.path.join(man_dir, 'man1'), ['build/man/isrcsubmit.1']),
(os.path.join(man_dir, 'man5'), ['build/man/isrcsubmit-config.5'])
]
else:
man_pages = []
args = {}
if have_setuptools:
args["install_requires"] = ["discid >=1.0.0", "musicbrainzngs >=0.4"],
# we load isrcsubmit on setup
args["setup_requires"] = args["install_requires"],
class Test(Command):
description = "run the test suite"
# options as listed with "--help test"
# --verbose --quiet -> self.verbose are already handles as global options
user_options = [
("tests=", None,
"a comma separated list of tests to run (default all)")
]
def initialize_options(self):
# set defaults
self.tests = None
def finalize_options(self):
if self.verbose:
self.verbosity = 2
else:
self.verbosity = 1
if self.tests is not None:
if self.tests:
self.names = self.tests.split(",")
else:
self.names = []
else:
self.names = ["test_isrcsubmit.TestInternal",
"test_isrcsubmit.TestScript"]
def run(self):
suite = unittest.defaultTestLoader.loadTestsFromNames(self.names)
runner = unittest.TextTestRunner(verbosity=self.verbosity)
result = runner.run(suite)
if result.wasSuccessful():
sys.exit(0)
else:
sys.exit(len(result.failures) + len(result.errors))
cmdclass["test"] = Test
with open("README.rst") as readme:
long_description = readme.read()
setup(name="isrcsubmit",
version="3.0.0-dev",
description="submit ISRCs from disc to MusicBrainz",
long_description=long_description,
author="Johannes Dewender",
author_email="[email protected]",
url="https://github.com/JonnyJD/musicbrainz-isrcsubmit",
requires=["discid(>=1.0.0)", "musicbrainzngs(>=0.4)"],
python_requires='>=3.7',
py_modules=["isrcsubmit"],
entry_points={
'console_scripts': [
'isrcsubmit.py=isrcsubmit:main',
],
},
license="GPLv3+",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Environment :: MacOS X",
"Environment :: Win32 (MS Windows)",
"Environment :: Win64 (MS Windows)",
"Intended Audience :: End Users/Desktop",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Database :: Front-Ends",
"Topic :: Multimedia :: Sound/Audio :: CD Audio :: CD Ripping",
"Topic :: Text Processing :: Filters"
],
data_files=man_pages,
cmdclass=cmdclass,
**args
)
# vim:set shiftwidth=4 smarttab expandtab: