-
-
Notifications
You must be signed in to change notification settings - Fork 204
/
setup.py
77 lines (65 loc) · 2.57 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
import re
from itertools import chain
from os.path import basename
from os.path import dirname
from os.path import join
from os.path import splitext
from distutils.core import setup
from distutils.command.build import build
from setuptools.command.develop import develop
from setuptools.command.easy_install import easy_install
from setuptools.command.install_lib import install_lib
class BuildWithPTH(build):
def run(self):
build.run(self)
path = join(dirname(__file__), 'better_exceptions_hook.pth')
dest = join(self.build_lib, basename(path))
self.copy_file(path, dest)
class EasyInstallWithPTH(easy_install):
def run(self):
easy_install.run(self)
path = join(dirname(__file__), 'better_exceptions_hook.pth')
dest = join(self.install_dir, basename(path))
self.copy_file(path, dest)
class InstallLibWithPTH(install_lib):
def run(self):
install_lib.run(self)
path = join(dirname(__file__), 'better_exceptions_hook.pth')
dest = join(self.install_dir, basename(path))
self.copy_file(path, dest)
self.outputs = [dest]
def get_outputs(self):
return chain(install_lib.get_outputs(self), self.outputs)
class DevelopWithPTH(develop):
def run(self):
develop.run(self)
path = join(dirname(__file__), 'better_exceptions_hook.pth')
dest = join(self.install_dir, basename(path))
self.copy_file(path, dest)
with open('better_exceptions/__init__.py', 'r') as file:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
file.read(), re.MULTILINE).group(1)
setup(
name = 'better_exceptions',
packages = ['better_exceptions', 'better_exceptions.integrations'],
version = version,
description = 'Pretty and helpful exceptions, automatically',
author = 'Josh Junon',
author_email = '[email protected]',
url = 'https://github.com/qix-/better-exceptions',
download_url = 'https://github.com/qix-/better-exceptions/archive/{}.tar.gz'.format(version),
license = 'MIT',
keywords = ['pretty', 'better', 'exceptions', 'exception', 'error', 'local', 'debug', 'debugging', 'locals'],
classifiers = [],
extras_require = {
':sys_platform=="win32"': ['colorama']
},
# This all comes from pytest-cov repository:
# https://github.com/pytest-dev/pytest-cov/blob/cde7c378b6a1971957759f42ac91e2860b41cf89/setup.py
cmdclass = {
'build': BuildWithPTH,
'easy_install': EasyInstallWithPTH,
'install_lib': InstallLibWithPTH,
'develop': DevelopWithPTH,
}
)