umu-commander 1.5.4__tar.gz → 1.5.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of umu-commander might be problematic. Click here for more details.
- umu_commander-1.5.6/.idea/shelf/Uncommitted_changes_before_rebase_[Changes]/shelved.patch +229 -0
- umu_commander-1.5.6/.idea/shelf/Uncommitted_changes_before_rebase_[Changes]1/shelved.patch +12 -0
- umu_commander-1.5.6/.idea/shelf/Uncommitted_changes_before_rebase__Changes_.xml +4 -0
- {umu_commander-1.5.4 → umu_commander-1.5.6}/.idea/workspace.xml +293 -248
- umu_commander-1.5.6/PKG-INFO +61 -0
- umu_commander-1.5.6/README.md +45 -0
- {umu_commander-1.5.4 → umu_commander-1.5.6}/pyproject.toml +11 -5
- umu_commander-1.5.6/src/umu_commander/__init__.py +1 -0
- umu_commander-1.5.6/src/umu_commander/__main__.py +71 -0
- {umu_commander-1.5.4 → umu_commander-1.5.6}/src/umu_commander/classes.py +1 -1
- umu_commander-1.5.6/src/umu_commander/configuration.py +73 -0
- umu_commander-1.5.6/src/umu_commander/database.py +52 -0
- {umu_commander-1.5.4 → umu_commander-1.5.6}/src/umu_commander/proton.py +3 -3
- {umu_commander-1.5.4 → umu_commander-1.5.6}/src/umu_commander/tracking.py +13 -8
- {umu_commander-1.5.4 → umu_commander-1.5.6}/src/umu_commander/umu_config.py +7 -3
- {umu_commander-1.5.4 → umu_commander-1.5.6}/src/umu_commander/util.py +11 -0
- {umu_commander-1.5.4 → umu_commander-1.5.6}/tests/test_config.py +2 -2
- {umu_commander-1.5.4 → umu_commander-1.5.6}/tests/test_db.py +9 -5
- {umu_commander-1.5.4 → umu_commander-1.5.6}/tests/test_proton.py +1 -1
- {umu_commander-1.5.4 → umu_commander-1.5.6}/tests/test_tracking.py +2 -3
- umu_commander-1.5.4/PKG-INFO +0 -59
- umu_commander-1.5.4/README.md +0 -43
- umu_commander-1.5.4/src/umu_commander/__init__.py +0 -0
- umu_commander-1.5.4/src/umu_commander/configuration.py +0 -72
- umu_commander-1.5.4/src/umu_commander/database.py +0 -43
- umu_commander-1.5.4/src/umu_commander/main.py +0 -68
- {umu_commander-1.5.4 → umu_commander-1.5.6}/.gitignore +0 -0
- {umu_commander-1.5.4 → umu_commander-1.5.6}/.idea/.gitignore +0 -0
- {umu_commander-1.5.4 → umu_commander-1.5.6}/.idea/inspectionProfiles/Project_Default.xml +0 -0
- {umu_commander-1.5.4 → umu_commander-1.5.6}/.idea/inspectionProfiles/profiles_settings.xml +0 -0
- {umu_commander-1.5.4 → umu_commander-1.5.6}/.idea/misc.xml +0 -0
- {umu_commander-1.5.4 → umu_commander-1.5.6}/.idea/modules.xml +0 -0
- {umu_commander-1.5.4 → umu_commander-1.5.6}/.idea/umu-commander.iml +0 -0
- {umu_commander-1.5.4 → umu_commander-1.5.6}/.idea/vcs.xml +0 -0
- {umu_commander-1.5.4 → umu_commander-1.5.6}/LICENSE.txt +0 -0
- {umu_commander-1.5.4 → umu_commander-1.5.6}/example_config.toml +0 -0
- {umu_commander-1.5.4 → umu_commander-1.5.6}/tests/__init__.py +0 -0
- {umu_commander-1.5.4 → umu_commander-1.5.6}/tests/test_manual.py +0 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
Index: tests/test_db.py
|
|
2
|
+
IDEA additional info:
|
|
3
|
+
Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
|
|
4
|
+
<+>import unittest\nfrom json import JSONDecodeError\n\nimport umu_commander.configuration as config\nfrom tests import *\nfrom umu_commander.database import Database as db\n\n\nclass Database(unittest.TestCase):\n def setUp(self):\n config.DB_DIR = TESTING_DIR\n setup()\n\n def tearDown(self):\n teardown()\n\n def test_missing_db(self):\n db.load()\n self.assertEqual(db.get(), {})\n\n def test_malformed_db(self):\n with open(os.path.join(config.DB_DIR, config.DB_NAME), \"tw\") as db_file:\n db_file.write(\"{\")\n\n with self.assertRaises(JSONDecodeError):\n db.load()\n\n def test_addition_removal(self):\n db.load()\n db.get(PROTON_DIR_1, PROTON_BIG).append(USER_DIR)\n\n self.assertIn(PROTON_BIG, db.get(PROTON_DIR_1))\n self.assertIn(USER_DIR, db.get(PROTON_DIR_1, PROTON_BIG))\n\n db.get(PROTON_DIR_1, PROTON_BIG).remove(USER_DIR)\n\n self.assertIn(PROTON_BIG, db.get(PROTON_DIR_1))\n self.assertNotIn(USER_DIR, db.get(PROTON_DIR_1, PROTON_BIG))\n\n del db.get(PROTON_DIR_1)[PROTON_BIG]\n self.assertNotIn(PROTON_BIG, db.get(PROTON_DIR_1))\n
|
|
5
|
+
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
|
6
|
+
<+>UTF-8
|
|
7
|
+
===================================================================
|
|
8
|
+
diff --git a/tests/test_db.py b/tests/test_db.py
|
|
9
|
+
--- a/tests/test_db.py (revision 2c990ed1cab5a20498dc2cfe9bd4e331f60cb3af)
|
|
10
|
+
+++ b/tests/test_db.py (date 1754467945899)
|
|
11
|
+
@@ -2,8 +2,8 @@
|
|
12
|
+
from json import JSONDecodeError
|
|
13
|
+
|
|
14
|
+
import umu_commander.configuration as config
|
|
15
|
+
+import umu_commander.database as db
|
|
16
|
+
from tests import *
|
|
17
|
+
-from umu_commander.database import Database as db
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class Database(unittest.TestCase):
|
|
21
|
+
Index: tests/test_config.py
|
|
22
|
+
IDEA additional info:
|
|
23
|
+
Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
|
|
24
|
+
<+>import os.path\nimport unittest\n\nimport umu_commander.configuration as config\nfrom tests import *\nfrom umu_commander import configuration\n\n\nclass Config(unittest.TestCase):\n def setUp(self):\n configuration._CONFIG_DIR = TESTING_DIR\n configuration.DB_DIR = TESTING_DIR\n setup()\n\n def tearDown(self):\n teardown()\n\n def test_missing_config(self):\n config.load()\n self.assertTrue(\n os.path.exists(os.path.join(TESTING_DIR, configuration._CONFIG_NAME))\n )\n config.load()\n
|
|
25
|
+
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
|
26
|
+
<+>UTF-8
|
|
27
|
+
===================================================================
|
|
28
|
+
diff --git a/tests/test_config.py b/tests/test_config.py
|
|
29
|
+
--- a/tests/test_config.py (revision 2c990ed1cab5a20498dc2cfe9bd4e331f60cb3af)
|
|
30
|
+
+++ b/tests/test_config.py (date 1754467762383)
|
|
31
|
+
@@ -8,7 +8,7 @@
|
|
32
|
+
|
|
33
|
+
class Config(unittest.TestCase):
|
|
34
|
+
def setUp(self):
|
|
35
|
+
- configuration._CONFIG_DIR = TESTING_DIR
|
|
36
|
+
+ configuration.CONFIG_DIR = TESTING_DIR
|
|
37
|
+
configuration.DB_DIR = TESTING_DIR
|
|
38
|
+
setup()
|
|
39
|
+
|
|
40
|
+
@@ -18,6 +18,6 @@
|
|
41
|
+
def test_missing_config(self):
|
|
42
|
+
config.load()
|
|
43
|
+
self.assertTrue(
|
|
44
|
+
- os.path.exists(os.path.join(TESTING_DIR, configuration._CONFIG_NAME))
|
|
45
|
+
+ os.path.exists(os.path.join(TESTING_DIR, configuration.CONFIG_NAME))
|
|
46
|
+
)
|
|
47
|
+
config.load()
|
|
48
|
+
Index: src/umu_commander/database.py
|
|
49
|
+
IDEA additional info:
|
|
50
|
+
Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
|
|
51
|
+
<+>import json\nimport os\nfrom collections import defaultdict\n\nimport umu_commander.configuration as config\n\n\nclass Database:\n _db: defaultdict[str, defaultdict[str, list[str]]]\n\n @staticmethod\n def load():\n if not os.path.exists(config.DB_DIR):\n os.mkdir(config.DB_DIR)\n\n try:\n with open(os.path.join(config.DB_DIR, config.DB_NAME), \"rt\") as db_file:\n Database._db = defaultdict(lambda: defaultdict(list))\n Database._db.update(json.load(db_file))\n\n except FileNotFoundError:\n Database._db = defaultdict(lambda: defaultdict(list))\n\n @staticmethod\n def dump():\n with open(os.path.join(config.DB_DIR, config.DB_NAME), \"wt\") as db_file:\n # noinspection PyTypeChecker\n json.dump(Database._db, db_file, indent=\"\\t\")\n\n @staticmethod\n def get(\n proton_dir: str = None, proton_ver: str = None\n ) -> dict[str, dict[str, list[str]]] | dict[str, list[str]] | list[str]:\n if proton_dir is None and proton_ver is None:\n return Database._db\n\n if proton_ver is None:\n return Database._db[proton_dir]\n\n if proton_ver not in Database._db[proton_dir]:\n Database._db[proton_dir][proton_ver] = []\n\n return Database._db[proton_dir][proton_ver]\n
|
|
52
|
+
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
|
53
|
+
<+>UTF-8
|
|
54
|
+
===================================================================
|
|
55
|
+
diff --git a/src/umu_commander/database.py b/src/umu_commander/database.py
|
|
56
|
+
--- a/src/umu_commander/database.py (revision 2c990ed1cab5a20498dc2cfe9bd4e331f60cb3af)
|
|
57
|
+
+++ b/src/umu_commander/database.py (date 1754467762394)
|
|
58
|
+
@@ -4,40 +4,46 @@
|
|
59
|
+
|
|
60
|
+
import umu_commander.configuration as config
|
|
61
|
+
|
|
62
|
+
+_db: defaultdict[str, defaultdict[str, list[str]]] = defaultdict(
|
|
63
|
+
+ lambda: defaultdict(list)
|
|
64
|
+
+)
|
|
65
|
+
|
|
66
|
+
-class Database:
|
|
67
|
+
- _db: defaultdict[str, defaultdict[str, list[str]]]
|
|
68
|
+
|
|
69
|
+
- @staticmethod
|
|
70
|
+
- def load():
|
|
71
|
+
- if not os.path.exists(config.DB_DIR):
|
|
72
|
+
- os.mkdir(config.DB_DIR)
|
|
73
|
+
+def load():
|
|
74
|
+
+ global _db
|
|
75
|
+
+
|
|
76
|
+
+ if not os.path.exists(config.DB_DIR):
|
|
77
|
+
+ os.mkdir(config.DB_DIR)
|
|
78
|
+
|
|
79
|
+
- try:
|
|
80
|
+
- with open(os.path.join(config.DB_DIR, config.DB_NAME), "rt") as db_file:
|
|
81
|
+
- Database._db = defaultdict(lambda: defaultdict(list))
|
|
82
|
+
- Database._db.update(json.load(db_file))
|
|
83
|
+
+ db_path: str = os.path.join(config.DB_DIR, config.DB_NAME)
|
|
84
|
+
+ if not os.path.exists(db_path):
|
|
85
|
+
+ return
|
|
86
|
+
|
|
87
|
+
- except FileNotFoundError:
|
|
88
|
+
- Database._db = defaultdict(lambda: defaultdict(list))
|
|
89
|
+
+ with open(os.path.join(db_path), "rt") as db_file:
|
|
90
|
+
+ _db.update(json.load(db_file))
|
|
91
|
+
|
|
92
|
+
- @staticmethod
|
|
93
|
+
- def dump():
|
|
94
|
+
- with open(os.path.join(config.DB_DIR, config.DB_NAME), "wt") as db_file:
|
|
95
|
+
- # noinspection PyTypeChecker
|
|
96
|
+
- json.dump(Database._db, db_file, indent="\t")
|
|
97
|
+
+
|
|
98
|
+
+def dump():
|
|
99
|
+
+ if not os.path.exists(config.DB_DIR):
|
|
100
|
+
+ os.mkdir(config.DB_DIR)
|
|
101
|
+
+
|
|
102
|
+
+ with open(os.path.join(config.DB_DIR, config.DB_NAME), "wt") as db_file:
|
|
103
|
+
+ # noinspection PyTypeChecker
|
|
104
|
+
+ json.dump(_db, db_file, indent="\t")
|
|
105
|
+
|
|
106
|
+
- @staticmethod
|
|
107
|
+
- def get(
|
|
108
|
+
- proton_dir: str = None, proton_ver: str = None
|
|
109
|
+
- ) -> dict[str, dict[str, list[str]]] | dict[str, list[str]] | list[str]:
|
|
110
|
+
- if proton_dir is None and proton_ver is None:
|
|
111
|
+
- return Database._db
|
|
112
|
+
+
|
|
113
|
+
+def get(
|
|
114
|
+
+ proton_dir: str = None, proton_ver: str = None
|
|
115
|
+
+) -> dict[str, dict[str, list[str]]] | dict[str, list[str]] | list[str]:
|
|
116
|
+
+ global _db
|
|
117
|
+
+
|
|
118
|
+
+ if proton_dir is None and proton_ver is None:
|
|
119
|
+
+ return _db
|
|
120
|
+
|
|
121
|
+
- if proton_ver is None:
|
|
122
|
+
- return Database._db[proton_dir]
|
|
123
|
+
+ if proton_ver is None:
|
|
124
|
+
+ return _db[proton_dir]
|
|
125
|
+
|
|
126
|
+
- if proton_ver not in Database._db[proton_dir]:
|
|
127
|
+
- Database._db[proton_dir][proton_ver] = []
|
|
128
|
+
+ if proton_ver not in _db[proton_dir]:
|
|
129
|
+
+ _db[proton_dir][proton_ver] = []
|
|
130
|
+
|
|
131
|
+
- return Database._db[proton_dir][proton_ver]
|
|
132
|
+
+ return _db[proton_dir][proton_ver]
|
|
133
|
+
Index: tests/test_tracking.py
|
|
134
|
+
IDEA additional info:
|
|
135
|
+
Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
|
|
136
|
+
<+>import unittest\n\nimport umu_commander.configuration as config\nfrom tests import *\nfrom umu_commander import tracking\nfrom umu_commander.classes import ProtonVer\nfrom umu_commander.database import Database as db\n\n\nclass Tracking(unittest.TestCase):\n def setUp(self):\n config.DB_DIR = TESTING_DIR\n setup()\n db.load()\n\n def tearDown(self):\n teardown()\n\n def test_track_untrack(self):\n os.chdir(USER_DIR)\n\n tracking.track(ProtonVer(PROTON_DIR_1, PROTON_BIG), refresh_versions=False)\n self.assertIn(PROTON_BIG, db.get(PROTON_DIR_1))\n self.assertIn(USER_DIR, db.get(PROTON_DIR_1, PROTON_BIG))\n\n tracking.untrack(quiet=True)\n self.assertIn(PROTON_BIG, db.get(PROTON_DIR_1))\n self.assertNotIn(USER_DIR, db.get(PROTON_DIR_1, PROTON_BIG))\n\n def test_track_auto_untrack(self):\n os.chdir(USER_DIR)\n\n tracking.track(ProtonVer(PROTON_DIR_1, PROTON_BIG), refresh_versions=False)\n self.assertIn(PROTON_BIG, db.get(PROTON_DIR_1))\n self.assertIn(USER_DIR, db.get(PROTON_DIR_1, PROTON_BIG))\n\n os.rmdir(USER_DIR)\n tracking.untrack_unlinked()\n self.assertIn(PROTON_BIG, db.get(PROTON_DIR_1))\n self.assertNotIn(\n USER_DIR,\n db.get(PROTON_DIR_1, PROTON_BIG),\n \"Auto untrack did not untrack removed directory.\",\n )\n
|
|
137
|
+
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
|
138
|
+
<+>UTF-8
|
|
139
|
+
===================================================================
|
|
140
|
+
diff --git a/tests/test_tracking.py b/tests/test_tracking.py
|
|
141
|
+
--- a/tests/test_tracking.py (revision 2c990ed1cab5a20498dc2cfe9bd4e331f60cb3af)
|
|
142
|
+
+++ b/tests/test_tracking.py (date 1754467945864)
|
|
143
|
+
@@ -1,10 +1,10 @@
|
|
144
|
+
import unittest
|
|
145
|
+
|
|
146
|
+
import umu_commander.configuration as config
|
|
147
|
+
+import umu_commander.database as db
|
|
148
|
+
from tests import *
|
|
149
|
+
from umu_commander import tracking
|
|
150
|
+
from umu_commander.classes import ProtonVer
|
|
151
|
+
-from umu_commander.database import Database as db
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
class Tracking(unittest.TestCase):
|
|
155
|
+
Index: src/umu_commander/proton.py
|
|
156
|
+
IDEA additional info:
|
|
157
|
+
Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
|
|
158
|
+
<+>import os\nimport re\nimport subprocess\n\nimport umu_commander.configuration as config\nfrom umu_commander.classes import ProtonDir, ProtonVer\nfrom umu_commander.database import Database as db\n\n\ndef _natural_sort_proton_ver_key(p: ProtonVer, _nsre=re.compile(r\"(\\d+)\")):\n s: str = p.version_num\n return [int(text) if text.isdigit() else text for text in _nsre.split(s)]\n\n\ndef refresh_proton_versions():\n print(\"Updating umu Proton.\")\n umu_update_process = subprocess.run(\n [\"umu-run\", '\"\"'],\n env={\"PROTONPATH\": \"UMU-Latest\", \"UMU_LOG\": \"debug\"},\n capture_output=True,\n text=True,\n )\n\n for line in umu_update_process.stderr.split(\"\\n\"):\n if \"PROTONPATH\" in line and \"/\" in line:\n try:\n left: int = line.rfind(\"/\") + 1\n print(f\"Using {line[left:len(line) - 1]}.\")\n except ValueError:\n print(\"Could not fetch latest UMU-Proton.\")\n\n break\n\n\ndef _sort_proton_versions(versions: list[ProtonVer]) -> list[ProtonVer]:\n return sorted(versions, key=_natural_sort_proton_ver_key, reverse=True)\n\n\ndef collect_proton_versions(\n sort: bool = False, user_count: bool = False\n) -> list[ProtonDir]:\n def get_user_count(proton_dir: str, proton_ver) -> str:\n return (\n \"(\" + str(len(db.get(proton_dir, proton_ver))) + \")\"\n if proton_ver in db.get(proton_dir)\n else \"(-)\"\n )\n\n proton_dirs: list[ProtonDir] = []\n for proton_dir in config.PROTON_PATHS:\n versions: list[ProtonVer] = [\n ProtonVer(\n proton_dir,\n version,\n get_user_count(proton_dir, version) if user_count else \"\",\n )\n for version in os.listdir(proton_dir)\n if os.path.isdir(os.path.join(proton_dir, version))\n ]\n\n if sort:\n versions = sorted(versions, key=_natural_sort_proton_ver_key, reverse=True)\n\n proton_dirs.append(\n ProtonDir(proton_dir, f\"Proton versions in {proton_dir}:\", versions)\n )\n\n return proton_dirs\n\n\ndef get_latest_umu_proton():\n umu_proton_versions: list[ProtonVer] = [\n ProtonVer(config.UMU_PROTON_PATH, version)\n for version in os.listdir(config.UMU_PROTON_PATH)\n if \"UMU\" in version\n and os.path.isdir(os.path.join(config.UMU_PROTON_PATH, version))\n ]\n umu_proton_versions = sorted(\n umu_proton_versions, key=_natural_sort_proton_ver_key, reverse=True\n )\n\n return umu_proton_versions[0].version_num\n
|
|
159
|
+
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
|
160
|
+
<+>UTF-8
|
|
161
|
+
===================================================================
|
|
162
|
+
diff --git a/src/umu_commander/proton.py b/src/umu_commander/proton.py
|
|
163
|
+
--- a/src/umu_commander/proton.py (revision 2c990ed1cab5a20498dc2cfe9bd4e331f60cb3af)
|
|
164
|
+
+++ b/src/umu_commander/proton.py (date 1754467945890)
|
|
165
|
+
@@ -3,8 +3,8 @@
|
|
166
|
+
import subprocess
|
|
167
|
+
|
|
168
|
+
import umu_commander.configuration as config
|
|
169
|
+
+import umu_commander.database as db
|
|
170
|
+
from umu_commander.classes import ProtonDir, ProtonVer
|
|
171
|
+
-from umu_commander.database import Database as db
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
def _natural_sort_proton_ver_key(p: ProtonVer, _nsre=re.compile(r"(\d+)")):
|
|
175
|
+
Index: src/umu_commander/tracking.py
|
|
176
|
+
IDEA additional info:
|
|
177
|
+
Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
|
|
178
|
+
<+>import os\nimport shutil\n\nfrom umu_commander.classes import ProtonDir, ProtonVer\nfrom umu_commander.database import Database as db\nfrom umu_commander.proton import (\n collect_proton_versions,\n get_latest_umu_proton,\n refresh_proton_versions,\n)\nfrom umu_commander.util import (\n get_selection,\n)\n\n\ndef untrack(quiet: bool = False):\n current_dir: str = os.getcwd()\n for proton_dir in db.get().keys():\n for proton_ver in db.get(proton_dir):\n if current_dir in db.get(proton_dir, proton_ver):\n db.get(proton_dir, proton_ver).remove(current_dir)\n\n if not quiet:\n print(\"Directory removed from all user lists.\")\n\n\ndef track(\n proton_ver: ProtonVer = None, refresh_versions: bool = True, quiet: bool = False\n):\n if refresh_versions:\n refresh_proton_versions()\n\n if proton_ver is None:\n proton_ver: ProtonVer = get_selection(\n \"Select Proton version to add directory as user:\",\n None,\n collect_proton_versions(sort=True),\n ).as_proton_ver()\n\n untrack(quiet=True)\n current_directory: str = os.getcwd()\n db.get(proton_ver.dir, proton_ver.version_num).append(current_directory)\n\n if not quiet:\n print(\n f\"Directory {current_directory} added to Proton version's {proton_ver.version_num} in {proton_ver.dir} user list.\"\n )\n\n\ndef users():\n proton_dirs: list[ProtonDir] = collect_proton_versions(sort=True, user_count=True)\n\n proton_ver: ProtonVer = get_selection(\n \"Select Proton version to view user list:\", None, proton_dirs\n ).as_proton_ver()\n\n if proton_ver.dir in db.get() and proton_ver.version_num in db.get(proton_ver.dir):\n version_users: list[str] = db.get(proton_ver.dir, proton_ver.version_num)\n if len(version_users) > 0:\n print(f\"Directories using {proton_ver.version_num} of {proton_ver.dir}:\")\n print(*version_users, sep=\"\\n\")\n else:\n print(\"No directories currently use this version.\")\n else:\n print(\"This version hasn't been used by umu before.\")\n\n\ndef delete():\n for proton_dir in db.get().keys():\n for proton_ver, version_users in db.get(proton_dir).copy().items():\n if proton_ver == get_latest_umu_proton():\n continue\n\n if len(version_users) == 0:\n selection: str = input(\n f\"{proton_ver} in {proton_dir} has no using directories, delete? (Y/N) ? \"\n )\n if selection.lower() == \"y\":\n try:\n shutil.rmtree(os.path.join(proton_dir, proton_ver))\n except FileNotFoundError:\n pass\n del db.get(proton_dir)[proton_ver]\n\n\ndef untrack_unlinked():\n for proton_dir in db.get().keys():\n for proton_ver, version_users in db.get()[proton_dir].items():\n for user in version_users:\n if not os.path.exists(user):\n db.get(proton_dir, proton_ver).remove(user)\n
|
|
179
|
+
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
|
180
|
+
<+>UTF-8
|
|
181
|
+
===================================================================
|
|
182
|
+
diff --git a/src/umu_commander/tracking.py b/src/umu_commander/tracking.py
|
|
183
|
+
--- a/src/umu_commander/tracking.py (revision 2c990ed1cab5a20498dc2cfe9bd4e331f60cb3af)
|
|
184
|
+
+++ b/src/umu_commander/tracking.py (date 1754467945881)
|
|
185
|
+
@@ -1,8 +1,8 @@
|
|
186
|
+
import os
|
|
187
|
+
import shutil
|
|
188
|
+
|
|
189
|
+
+import umu_commander.database as db
|
|
190
|
+
from umu_commander.classes import ProtonDir, ProtonVer
|
|
191
|
+
-from umu_commander.database import Database as db
|
|
192
|
+
from umu_commander.proton import (
|
|
193
|
+
collect_proton_versions,
|
|
194
|
+
get_latest_umu_proton,
|
|
195
|
+
Index: src/umu_commander/main.py
|
|
196
|
+
IDEA additional info:
|
|
197
|
+
Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
|
|
198
|
+
<+>#!/usr/bin/python3\nimport os\nimport sys\nfrom json import JSONDecodeError\n\nimport umu_commander.configuration as config\nfrom umu_commander import tracking, umu_config\nfrom umu_commander.classes import ExitCode\nfrom umu_commander.configuration import _CONFIG_DIR, _CONFIG_NAME\nfrom umu_commander.database import Database as db\n\n\ndef print_help():\n print(\n \"umu-commander is an interactive CLI tool to help you manage Proton versions used by umu, as well as create enhanced launch configs.\",\n \"\",\n \"For details, explanations, and more, see the README.md file, or visit https://github.com/Mpaxlamitsounas/umu-commander.\",\n sep=\"\\n\",\n )\n\n\ndef main() -> ExitCode:\n try:\n config.load()\n except (JSONDecodeError, KeyError):\n config_path: str = os.path.join(_CONFIG_DIR, _CONFIG_NAME)\n print(f\"Config file at {config_path} could not be read.\")\n os.rename(config_path, os.path.join(_CONFIG_DIR, _CONFIG_NAME + \".old\"))\n\n try:\n db.load()\n except JSONDecodeError:\n db_path: str = os.path.join(config.DB_DIR, config.DB_NAME)\n print(f\"Tracking file at {db_path} could not be read.\")\n os.rename(db_path, os.path.join(config.DB_DIR, config.DB_NAME + \".old\"))\n\n if len(sys.argv) == 1:\n print_help()\n return ExitCode.SUCCESS.value\n\n verb: str = sys.argv[1]\n match verb:\n case \"track\":\n tracking.track()\n case \"untrack\":\n tracking.untrack()\n case \"users\":\n tracking.users()\n case \"delete\":\n tracking.delete()\n case \"create\":\n umu_config.create()\n case \"run\":\n umu_config.run()\n case _:\n print(\"Invalid verb.\")\n print_help()\n return ExitCode.INVALID_SELECTION.value\n\n tracking.untrack_unlinked()\n db.dump()\n config.dump()\n\n return ExitCode.SUCCESS.value\n\n\nif __name__ == \"__main__\":\n exit(main())\n
|
|
199
|
+
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
|
200
|
+
<+>UTF-8
|
|
201
|
+
===================================================================
|
|
202
|
+
diff --git a/src/umu_commander/main.py b/src/umu_commander/main.py
|
|
203
|
+
--- a/src/umu_commander/main.py (revision 2c990ed1cab5a20498dc2cfe9bd4e331f60cb3af)
|
|
204
|
+
+++ b/src/umu_commander/main.py (date 1754467945908)
|
|
205
|
+
@@ -4,10 +4,10 @@
|
|
206
|
+
from json import JSONDecodeError
|
|
207
|
+
|
|
208
|
+
import umu_commander.configuration as config
|
|
209
|
+
+import umu_commander.database as db
|
|
210
|
+
from umu_commander import tracking, umu_config
|
|
211
|
+
from umu_commander.classes import ExitCode
|
|
212
|
+
-from umu_commander.configuration import _CONFIG_DIR, _CONFIG_NAME
|
|
213
|
+
-from umu_commander.database import Database as db
|
|
214
|
+
+from umu_commander.configuration import CONFIG_DIR, CONFIG_NAME
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
def print_help():
|
|
218
|
+
@@ -23,9 +23,9 @@
|
|
219
|
+
try:
|
|
220
|
+
config.load()
|
|
221
|
+
except (JSONDecodeError, KeyError):
|
|
222
|
+
- config_path: str = os.path.join(_CONFIG_DIR, _CONFIG_NAME)
|
|
223
|
+
+ config_path: str = os.path.join(CONFIG_DIR, CONFIG_NAME)
|
|
224
|
+
print(f"Config file at {config_path} could not be read.")
|
|
225
|
+
- os.rename(config_path, os.path.join(_CONFIG_DIR, _CONFIG_NAME + ".old"))
|
|
226
|
+
+ os.rename(config_path, os.path.join(CONFIG_DIR, CONFIG_NAME + ".old"))
|
|
227
|
+
|
|
228
|
+
try:
|
|
229
|
+
db.load()
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Index: src/umu_commander/__init__.py
|
|
2
|
+
IDEA additional info:
|
|
3
|
+
Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
|
|
4
|
+
<+>VERSION = \"v1.5.6\"\n
|
|
5
|
+
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
|
6
|
+
<+>UTF-8
|
|
7
|
+
===================================================================
|
|
8
|
+
diff --git a/src/umu_commander/__init__.py b/src/umu_commander/__init__.py
|
|
9
|
+
--- a/src/umu_commander/__init__.py (revision ebc968e623b6ee38499de12ff2a04c4bf2311db2)
|
|
10
|
+
+++ b/src/umu_commander/__init__.py (date 1754484120387)
|
|
11
|
+
@@ -1,1 +1,0 @@
|
|
12
|
+
-VERSION = "v1.5.6"
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<changelist name="Uncommitted_changes_before_rebase_[Changes]" date="1754468467307" recycled="true" deleted="true">
|
|
2
|
+
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_rebase_[Changes]/shelved.patch" />
|
|
3
|
+
<option name="DESCRIPTION" value="Uncommitted changes before rebase [Changes]" />
|
|
4
|
+
</changelist>
|