-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdev_install_plugin.py
More file actions
56 lines (44 loc) · 1.61 KB
/
dev_install_plugin.py
File metadata and controls
56 lines (44 loc) · 1.61 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
import logging
import subprocess
from pathlib import Path
from dev_install_dependencies import install_dependencies
print(subprocess.check_call(["python", "-m", "pip", "install", "-y", "apppath"]))
from plugin_config import PROFILE, QGIS_APP_PATH
from warg import ensure_existence, is_mac, is_windows
logger = logging.getLogger(__name__)
if is_windows():
qgis_profile_dir = QGIS_APP_PATH.user_config
elif is_mac():
qgis_profile_dir = QGIS_APP_PATH.user_data # TOOD: USE CORRECT!
else:
qgis_profile_dir = QGIS_APP_PATH.user_data
if __name__ == "__main__":
for f_n in (
"mi_companion",
# f"mi_companion_bundle.{VERSION}"
):
source_folder = (Path(__file__).parent / f_n).absolute()
target_folder = (
qgis_profile_dir
/ "profiles"
/ PROFILE
/ "python"
/ "plugins"
/ source_folder.name
)
ensure_existence(target_folder.parent)
if (
not target_folder.exists()
): # Does it check for casing of filepath in windows?
try:
target_folder.symlink_to(source_folder)
except OSError as e:
logger.warning(
"Probably missing privileges to make symlink in target parent folder, try running symlinking as "
"administrator or change write access('may be read only') / owner."
)
raise e
print("symlinked src->target", source_folder, "->", target_folder)
else:
print(target_folder, "already exists!")
install_dependencies()