From d021cf38f7d45ac6347ee3758436d82553c68930 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jastrz=C4=99bski?= Date: Wed, 15 Nov 2023 10:12:30 +0100 Subject: [PATCH] Added detection of directory duplication (close #366) --- CB/Core.py | 16 ++++++++++++++++ CurseBreaker.py | 3 +++ Pipfile.lock | 30 +++++++++++++++--------------- 3 files changed, 34 insertions(+), 15 deletions(-) diff --git a/CB/Core.py b/CB/Core.py index af53e89..b855ebe 100644 --- a/CB/Core.py +++ b/CB/Core.py @@ -167,6 +167,22 @@ def check_if_dev(self, url): else: return 0 + def check_if_overlap(self): + directories = [] + found = set() + for addon in self.config['Addons']: + directories = directories + addon['Directories'] + dupes = [x for x in directories if x in found or found.add(x)] + if len(dupes) > 0: + addons = [] + for addon in self.config['Addons']: + if set(addon['Directories']).intersection(dupes): + addons.append(addon['Name']) + addons.sort() + return '\n'.join(addons) + else: + return False + def check_if_blocked(self, addon): if addon: if 'Block' in addon.keys(): diff --git a/CurseBreaker.py b/CurseBreaker.py index 2773dec..63bbd14 100644 --- a/CurseBreaker.py +++ b/CurseBreaker.py @@ -599,6 +599,9 @@ def c_update(self, args, addline=False, update=True, force=False, reverseprovide self.console.print(self.table) if compacted > 0: self.console.print(f'Additionally [green]{compacted}[/green] addons are up-to-date.') + overlap = self.core.check_if_overlap() + if overlap: + self.console.print(f'\n[bold red]Detected addon directory overlap. This will cause issues. Affected addons:[/bold red]\n{overlap}') else: self.console.print('Apparently there are no addons installed by CurseBreaker (or you provided incorrect add' 'on name).\nCommand [green]import[/green] might be used to detect already installed addo' diff --git a/Pipfile.lock b/Pipfile.lock index 40c617f..16d768f 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -268,12 +268,12 @@ }, "prompt-toolkit": { "hashes": [ - "sha256:04505ade687dc26dc4284b1ad19a83be2f2afe83e7a828ace0c72f3a1df72aac", - "sha256:9dffbe1d8acf91e3de75f3b544e4842382fc06c6babe903ac9acb74dc6e08d88" + "sha256:941367d97fc815548822aa26c2a269fdc4eb21e9ec05fc5d447cf09bad5d75f0", + "sha256:f36fe301fafb7470e86aaf90f036eef600a3210be4decf461a5b1ca8403d3cb2" ], "index": "pypi", "markers": "python_full_version >= '3.7.0'", - "version": "==3.0.39" + "version": "==3.0.41" }, "pygments": { "hashes": [ @@ -296,7 +296,7 @@ "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9" ], "index": "pypi", - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2'", + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==2.8.2" }, "requests": { @@ -310,35 +310,35 @@ }, "rich": { "hashes": [ - "sha256:2b38e2fe9ca72c9a00170a1a2d20c63c790d0e10ef1fe35eba76e1e7b1d7d245", - "sha256:5c14d22737e6d5084ef4771b62d5d4363165b403455a30a1c8ca39dc7b644bef" + "sha256:5cb5123b5cf9ee70584244246816e9114227e0b98ad9176eede6ad54bf5403fa", + "sha256:6da14c108c4866ee9520bbffa71f6fe3962e193b7da68720583850cd4548e235" ], "index": "pypi", "markers": "python_full_version >= '3.7.0'", - "version": "==13.6.0" + "version": "==13.7.0" }, "six": { "hashes": [ "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926", "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2'", + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==1.16.0" }, "urllib3": { "hashes": [ - "sha256:c97dfde1f7bd43a71c8d2a58e369e9b2bf692d1334ea9f9cae55add7d0dd0f84", - "sha256:fdb6d215c776278489906c2f8916e6e7d4f5a9b602ccbcfdf7f016fc8da0596e" + "sha256:55901e917a5896a349ff771be919f8bd99aff50b79fe58fec595eb37bbc56bb3", + "sha256:df7aa8afb0148fa78488e7899b2c59b5f4ffcfa82e6c54ccb9dd37c1d7b52d54" ], - "markers": "python_version >= '3.7'", - "version": "==2.0.7" + "markers": "python_version >= '3.8'", + "version": "==2.1.0" }, "wcwidth": { "hashes": [ - "sha256:9a929bd8380f6cd9571a968a9c8f4353ca58d7cd812a4822bba831f8d685b223", - "sha256:a675d1a4a2d24ef67096a04b85b02deeecd8e226f57b5e3a72dbb9ed99d27da8" + "sha256:390c7454101092a6a5e43baad8f83de615463af459201709556b6e4b1c861f97", + "sha256:aec5179002dd0f0d40c456026e74a729661c9d468e1ed64405e3a6c2176ca36f" ], - "version": "==0.2.9" + "version": "==0.2.10" } }, "develop": {}