-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathconfig.py
More file actions
134 lines (111 loc) · 3.42 KB
/
config.py
File metadata and controls
134 lines (111 loc) · 3.42 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
"""Global configuration and internal defaults for Affinity CLI."""
from __future__ import annotations
from pathlib import Path
from typing import Dict
# Project metadata ---------------------------------------------------------
VERSION = "1.1.1"
APP_NAME = "Affinity CLI"
# Paths --------------------------------------------------------------------
HOME_DIR = Path.home()
CONFIG_DIR = HOME_DIR / ".config" / "affinity-cli"
CACHE_DIR = HOME_DIR / ".cache" / "affinity-cli"
DEFAULT_INSTALLERS_PATH = HOME_DIR / "Downloads" / "affinity-installers"
DEFAULT_WINE_PREFIX = HOME_DIR / ".wine-affinity"
DEFAULT_WINE_INSTALL = HOME_DIR / ".local" / "wine"
# Versions -----------------------------------------------------------------
DEFAULT_INSTALLER_VERSION = "v2"
SUPPORTED_INSTALLER_VERSIONS = ("v1", "v2")
# Wine ---------------------------------------------------------------------
WINE_VERSION_DEFAULT = "latest"
ELEMENTALWARRIOR_REPO = "https://gitlab.com/elementalwarrior/wine"
# Installer discovery -------------------------------------------------------
INSTALLER_SUFFIXES = (".exe", ".msi", ".msix")
INSTALLER_NAME_PREFIX = "affinity"
# Affinity Products --------------------------------------------------------
AFFINITY_PRODUCTS: Dict[str, Dict[str, str]] = {
"photo": {
"name": "Affinity Photo",
"exe_name": "Photo.exe",
"install_path": "Program Files/Affinity/Photo 2",
},
"designer": {
"name": "Affinity Designer",
"exe_name": "Designer.exe",
"install_path": "Program Files/Affinity/Designer 2",
},
"publisher": {
"name": "Affinity Publisher",
"exe_name": "Publisher.exe",
"install_path": "Program Files/Affinity/Publisher 2",
},
}
# Dependencies by category -------------------------------------------------
CORE_WINE_DEPS = [
"wine",
"wine64",
"libwine",
]
MULTIARCH_32BIT_DEPS = [
"libc6:i386",
"libgcc-s1:i386",
"libstdc++6:i386",
"libx11-6:i386",
"libxext6:i386",
]
GRAPHICS_DEPS = [
"libvulkan1",
"libvulkan1:i386",
"libgl1-mesa-glx",
"libgl1-mesa-glx:i386",
"libxrender1",
"libxrender1:i386",
]
FONT_DEPS = [
"fontconfig",
"fontconfig:i386",
"fonts-dejavu",
"fonts-liberation",
]
BUILD_DEPS = [
"build-essential",
"gcc",
"gcc-multilib",
"bison",
"flex",
]
# Ensure config directories exist (best-effort; ignore permission errors) --
for path in (CONFIG_DIR, CACHE_DIR):
try:
path.mkdir(parents=True, exist_ok=True)
except PermissionError:
# In restricted environments we still want imports to succeed.
pass
# Convenience re-exports ----------------------------------------------------
# Imported lazily to avoid circular imports during module initialization.
from affinity_cli.core.config_loader import ConfigLoader, ConfigError, ResolvedConfig, UserConfig # noqa: E402,F401
__all__ = [
"ConfigLoader",
"ConfigError",
"ResolvedConfig",
"UserConfig",
"VERSION",
"APP_NAME",
"HOME_DIR",
"CONFIG_DIR",
"CACHE_DIR",
"DEFAULT_INSTALLERS_PATH",
"DEFAULT_WINE_PREFIX",
"DEFAULT_WINE_INSTALL",
"DEFAULT_INSTALLER_VERSION",
"SUPPORTED_INSTALLER_VERSIONS",
"WINE_VERSION_DEFAULT",
"ELEMENTALWARRIOR_REPO",
"INSTALLER_SUFFIXES",
"INSTALLER_NAME_PREFIX",
"AFFINITY_PRODUCTS",
"CORE_WINE_DEPS",
"MULTIARCH_32BIT_DEPS",
"GRAPHICS_DEPS",
"FONT_DEPS",
"BUILD_DEPS",
]