forked from alastair/python-musicbrainzngs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
67 lines (57 loc) · 2.02 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
#!/usr/bin/env python
import sys
from distutils.core import setup
from distutils.core import Command
from musicbrainzngs import musicbrainz
class test(Command):
description = "run automated tests"
user_options = [
("tests=", None, "list of tests to run (default all)"),
("verbosity=", "v", "verbosity"),
]
def initialize_options(self):
self.tests = []
self.verbosity = 1
def finalize_options(self):
if self.tests:
self.tests = self.tests.split(",")
if self.verbosity:
self.verbosity = int(self.verbosity)
def run(self):
import os.path
import glob
import sys
import unittest
build = self.get_finalized_command('build')
self.run_command ('build')
sys.path.insert(0, build.build_purelib)
sys.path.insert(0, build.build_platlib)
names = []
for filename in glob.glob("test/test_*.py"):
name = os.path.splitext(os.path.basename(filename))[0]
if not self.tests or name in self.tests:
names.append("test." + name)
tests = unittest.defaultTestLoader.loadTestsFromNames(names)
t = unittest.TextTestRunner(verbosity=self.verbosity)
result = t.run(tests)
sys.exit(not result.wasSuccessful())
setup(
name="musicbrainzngs",
version=musicbrainz._version,
description="python bindings for musicbrainz NGS webservice",
author="Alastair Porter",
author_email="[email protected]",
url="https://github.com/alastair/python-musicbrainz-ngs",
packages=['musicbrainzngs'],
cmdclass={'test': test },
license='BSD 2-clause',
classifiers=[
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: BSD License",
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Topic :: Database :: Front-Ends",
"Topic :: Software Development :: Libraries :: Python Modules"
]
)