forked from bokeh/bokeh
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevdeps.py
More file actions
79 lines (63 loc) · 1.92 KB
/
Copy pathdevdeps.py
File metadata and controls
79 lines (63 loc) · 1.92 KB
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
78
79
from __future__ import print_function
from os import path
try:
import colorama
def blue(text): return "%s%s%s" % (colorama.Fore.BLUE, text, colorama.Style.RESET_ALL)
def red(text): return "%s%s%s" % (colorama.Fore.RED, text, colorama.Style.RESET_ALL)
except ImportError:
def blue(text) : return text
def red(text) : return text
npm_missing = """
npm packages do not appear to be installed.
Please navigate to the bokehjs directory and type 'npm install'\n
"""
def npm_check():
"""Check that the bokehjs/node_modules directory exists, as its absence
is the best indication that npm is not installed."""
if not path.exists('../bokehjs/node_modules'):
print(red(npm_missing))
def depend_check(deps_name, *args):
"""Check for missing dependencies"""
missing = []
for dependency in args:
try:
__import__(dependency)
except ImportError:
missing.append(dependency)
found = False
print('-'*80)
if len(missing):
print(red("You are missing the following %s dependencies:") % deps_name)
for dep in missing:
name = pkg_info_dict.get(dep, dep)
print(" * ", name)
print()
return False
else:
print(blue("All %s dependencies installed! You are good to go!\n") % deps_name)
return True
if __name__ == '__main__':
npm_check()
#Dictionary maps module names to package names
pkg_info_dict = {
'bs4': 'beautiful-soup',
'websocket': 'websocket-client',
'pytest_selenium': 'pytest-selenium',
'pytest_cov': 'pytest-cov',
}
dev_deps = [
'bs4',
'colorama',
'pytest',
'pytest_cov',
'pytest_selenium',
'mock',
'websocket'
]
depend_check('Dev', *dev_deps)
docs_deps = [
'graphviz',
'sphinx',
'pygments',
]
depend_check('Docs', *docs_deps)