-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
72 lines (52 loc) · 1.51 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
#!/usr/bin/env python
import os
import shutil
import sys
import json
from setuptools import setup, find_packages
from setuptools.command.develop import develop
from setuptools.command.install import install
from setuptools.command.sdist import sdist
def _build_js():
from bokeh.ext import build
print("Building custom models:")
package_dir = os.path.join(os.path.dirname(__file__), "pnbkext")
build(package_dir)
class CustomDevelopCommand(develop):
"""Custom installation for development mode."""
def run(self):
_build_js()
develop.run(self)
class CustomInstallCommand(install):
"""Custom installation for install mode."""
def run(self):
_build_js()
install.run(self)
class CustomSdistCommand(sdist):
"""Custom installation for sdist mode."""
def run(self):
_build_js()
sdist.run(self)
_COMMANDS = {
'develop': CustomDevelopCommand,
'install': CustomInstallCommand,
'sdist': CustomSdistCommand,
}
try:
from wheel.bdist_wheel import bdist_wheel
class CustomBdistWheelCommand(bdist_wheel):
"""Custom bdist_wheel command to force cancelling qiskit-terra wheel
creation."""
def run(self):
"""Do nothing so the command intentionally fails."""
_build_js()
bdist_wheel.run(self)
_COMMANDS['bdist_wheel'] = CustomBdistWheelCommand
except Exception:
pass
setup(
name='pnbkext',
version="0.0.1",
cmdclass=_COMMANDS,
packages=find_packages(),
)