forked from gitter-badger/hackedit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.pyw
More file actions
76 lines (58 loc) · 2.19 KB
/
bootstrap.pyw
File metadata and controls
76 lines (58 loc) · 2.19 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
#!/usr/bin/env python3
"""
The bootstrap script lets you run HackEdit from source checkout:
1) patch sys.path with the vendor package that contains most external libraries
Before running this script, you should:
1) install python3 and pyqt5 using your package manager (or the installer
files for your platform)
2) install hackedit as an editable package::
(sudo) pip3 install -e
This is needed so that the plugin entrypoints are written to
hackedit.egg-info/
3) install additional plugins (e.g. hackedit-cobol, hackedit-python) as
editable packages (pip3 install -e .)
4) run the script: python3 bootstrap.pyw
"""
import glob
import os
import os.path as osp
import sys
# --------- bootstrapping HackEdit
print("Executing HackEdit from source checkout")
# ------ patching sys.path
DEVPATH = osp.dirname(osp.abspath(__file__))
sys.path.insert(0, DEVPATH)
print("01. Patched sys.path with %r" % DEVPATH)
# ------ check if python setup.py develop has been executed
if len(glob.glob('*.egg-info')) == 0:
print('Please run ``(sudo) pip3 install -e .`` to install all dependencies and plugins...')
# ------ check PyQt5
try:
from PyQt5.QtCore import PYQT_VERSION_STR
from PyQt5.QtCore import QT_VERSION_STR
from PyQt5.QtGui import QIcon
except ImportError:
print('02. Failed to import PyQt5, package not found.')
sys.exit(1)
else:
print('02. Imported PyQt5')
print(' [Qt %s, PyQt5 %s]' % (QT_VERSION_STR, PYQT_VERSION_STR))
icons_path = os.path.join(sys.prefix, 'share', 'hackedit', 'icons')
if 'linux' not in sys.platform.lower() and not os.path.exists(icons_path):
paths = QIcon.themeSearchPaths()
paths.append('data/resources/icons')
QIcon.setThemeSearchPaths(paths)
# ------ run the application
try:
from hackedit.main import main
from hackedit.app import versions
except ImportError:
print('03. Failed to import hackedit')
else:
all_versions = versions.get_versions()
print("03. Imported HackEdit %s (%s)" % (
all_versions['hackedit'], versions.get_vcs_revision()))
print(" [Python %s %dbits, on %s]" % (
all_versions['python'], all_versions['bitness'],
all_versions['system']))
main()