-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlibtbx_refresh.py
More file actions
62 lines (47 loc) · 1.33 KB
/
libtbx_refresh.py
File metadata and controls
62 lines (47 loc) · 1.33 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
from __future__ import annotations
import libtbx.pkg_utils
try:
import dials.precommitbx.nagger
dials.precommitbx.nagger.nag()
except ImportError:
pass
# Undefine libtbx.dlstbx entry points
libtbx.pkg_utils.define_entry_points({})
try:
import dlstbx.requirements
if dlstbx.requirements.check():
print(
"You can run 'python -m dlstbx.requirements' to update all packages indiscriminately."
)
print(
"Note that this will overwrite any 'pip install -e' local installations you may have."
)
except ModuleNotFoundError:
print("Could not import dlstbx")
def _install_dlstbx_setup():
"""Install dlstbx as a regular/editable python package"""
import subprocess
import sys
import libtbx.load_env
# Call pip
subprocess.run(
[
sys.executable,
"-m",
"pip",
"install",
"--no-deps",
"-e",
libtbx.env.dist_path("dlstbx"),
],
check=True,
)
def _show_dlstbx_version():
try:
from dlstbx.util.version import dlstbx_version
# the import implicitly updates the .gitversion file
print(dlstbx_version())
except ModuleNotFoundError:
print("Can't tell dlstbx version")
_install_dlstbx_setup()
_show_dlstbx_version()