Backed out changeset 25e197bc4c13 (bug 1918706) for causing SM bustages on PlainDateT...
[gecko.git] / third_party / python / dlmanager / setup.py
blobb2a8fd392d9d3e0a15e7ffc5c281fb5983336036
1 # -*- coding: utf-8 -*-
3 import os
4 import re
5 import sys
6 from setuptools import setup
7 from setuptools.command.test import test as TestCommand
9 HERE = os.path.dirname(os.path.realpath(__file__))
12 class PyTest(TestCommand):
13 """
14 Run py.test with the "python setup.py test command"
15 """
16 user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")]
18 def initialize_options(self):
19 TestCommand.initialize_options(self)
20 self.pytest_args = ''
22 def finalize_options(self):
23 TestCommand.finalize_options(self)
24 self.pytest_args += (' ' + self.distribution.test_suite)
26 def run_tests(self):
27 import pytest
28 errno = pytest.main(self.pytest_args)
29 sys.exit(errno)
32 def read(*parts):
33 with open(os.path.join(HERE, *parts)) as f:
34 return f.read()
37 def parse_requirements(data, exclude=()):
38 return [line for line in data.splitlines()
39 if line and not line.startswith("#") and line not in exclude]
42 def version():
43 return re.findall(r"__version__ = \"([\d.]+)\"",
44 read("dlmanager", "__init__.py"))[0]
46 setup(
47 name="dlmanager",
48 version=version(),
49 description="download manager library",
50 long_description=read("README.rst"),
51 author="Julien Pagès",
52 author_email="j.parkouss@gmail.com",
53 url="http://github.com/parkouss/dlmanager",
54 license="GPL/LGPL",
55 install_requires=parse_requirements(read("requirements.txt")),
56 cmdclass={'test': PyTest},
57 tests_require=parse_requirements(read("requirements.txt"),
58 exclude=("-e .",)),
59 test_suite='tests',