-
Notifications
You must be signed in to change notification settings - Fork 32
/
cxtestimports.py
65 lines (60 loc) · 2.63 KB
/
cxtestimports.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
#!/bin/python3
# vi:set expandtab shiftwidth=4:
#
# Try to import every ChimeraX package and module
# except for the blacklisted ones.
#
import pkgutil
import importlib
import chimerax
blacklist = set([
"chimerax.add_charge.process_lib", # creates data.py
"chimerax.alignment_algs.libalign_algs", # non-importable dynamic lib
"chimerax.alphafold.alphafold_predict_colab", # IPython notebook with syntax magic
"chimerax.alphafold.alphafold21_predict_colab", # IPython notebook with syntax magic
"chimerax.alphafold.alphafold22_predict_colab", # IPython notebook with syntax magic
"chimerax.alphafold.colabfold_predict", # IPython notebook with syntax magic
"chimerax.alphafold.colabfold_predict_test", # IPython notebook with syntax magic
"chimerax.alphafold.fix_seq_titles", # Alphafold database processing script.
"chimerax.atomic.libmolc", # non-importable dynamic lib
"chimerax.atomic.md_crds.dcd.MDToolsMarch97.md_tests", # test code
"chimerax.build_structure.process", # processes Chimera fragment files
"chimerax.coulombic.create_data", # creates data.py
"chimerax.dicom.scan_dicoms", # development script
"chimerax.kvfinder.cmd", # pyKVFinder installed from PyPi on demand
"chimerax.map.data.memoryuse", # unported code
"chimerax.map.filter.square", # unported code
"chimerax.map.series.align", # unported code
"chimerax.modeller.script_head", # fragment of a Modeller script
"chimerax.modeller.script_tail", # fragment of a Modeller script
"chimerax.remote_control.run", # imports Python2 xmlrpclib
"chimerax.segger.ChimeraExtension", # unported segger features
"chimerax.segger.Mesh",
"chimerax.segger.extract_region_dialog",
"chimerax.segger.imageviewer",
"chimerax.segger.iseg_dialog",
"chimerax.segger.modelz",
"chimerax.segger.promod_dialog",
"chimerax.segger.rseg_dialog",
"chimerax.segger.segloop_dialog",
"chimerax.structcomp", # ChimeraX command script
"chimerax.surface.geodesic", # development script
"chimerax.webcam.camera", # Uses QVideoSink only in Qt6
"chimerax.webcam.camera_qt5", # Uses QAbstractVideoSurface only in Qt5
])
failed = 0
def fail(name):
global failed
failed = 1
print(f"Failed to import {name}")
for info in pkgutil.walk_packages(chimerax.__path__, prefix=chimerax.__name__ + '.', onerror=fail):
module_finder, name, is_pkg = info
if name in blacklist:
continue
print(f"Importing {name}")
try:
m = importlib.import_module(name)
except Exception as err:
print(f"-> ERROR: {err}")
failed = 1
raise SystemExit(failed)