This repository has been archived by the owner on Nov 6, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.py
51 lines (41 loc) · 1.46 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
import distutils
import os.path
from setuptools import Extension
from setuptools import setup
from setuptools.command.install import install as _install
PTH = (
'try:\n'
' breakpoint\n'
'except NameError:\n'
' try:\n'
' import _future_breakpoint\n'
' except ImportError:\n'
' pass\n'
' else:\n'
' import builtins\n'
' import sys\n'
' sys.breakpointhook = _future_breakpoint.breakpointhook\n'
' sys.__breakpointhook__ = _future_breakpoint.breakpointhook\n'
' builtins.breakpoint = _future_breakpoint.breakpoint\n'
)
class install(_install):
def initialize_options(self):
super().initialize_options()
# Use this prefix to get loaded as early as possible
name = f'aaaaa_{self.distribution.metadata.name}'
contents = f'import sys; exec({PTH!r})\n'
self.extra_path = (name, contents)
def finalize_options(self):
super().finalize_options()
if self.install_lib.endswith(self.extra_path[1]):
self.install_lib = self.install_libbase
distutils.log.info(
"will install .pth to '%s.pth'",
os.path.join(self.install_lib, self.extra_path[0]),
)
else:
distutils.log.info('skipping install of .pth during easy-install')
setup(
ext_modules=[Extension('_future_breakpoint', ['_future_breakpoint.c'])],
cmdclass={'install': install},
)