From 54e3fc5881a82aa399614cb9849bf232a298744f Mon Sep 17 00:00:00 2001 From: root Date: Tue, 17 Jan 2023 17:12:21 +0300 Subject: [PATCH] =?UTF-8?q?TG-130=20=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B0=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=B4=D0=BE=D1=81=D1=82=D1=83=D0=BF=D0=B0=20?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=B7=D0=B0=D0=BF=D0=B8=D1=81=D1=8C=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B8=20=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B8=20=D0=BF=D1=80=D0=BE=D1=84=D0=B8=D0=BB=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pym/update/variables/update.py | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/pym/update/variables/update.py b/pym/update/variables/update.py index fa7087a..7f2658b 100644 --- a/pym/update/variables/update.py +++ b/pym/update/variables/update.py @@ -28,7 +28,7 @@ from calculate.lib.datavars import (Variable, VariableError, SimpleDataVars, DataVarsError) from calculate.lib.utils.binhosts import (Binhosts, PackagesIndex, HOURS, BinhostSignError) -from calculate.lib.utils.files import readFile, listDirectory, process, pathJoin, quite_unlink +from calculate.lib.utils.files import readFile, listDirectory, process, pathJoin from calculate.lib.configparser import ConfigParser from calculate.lib.cl_lang import setLocalTranslate @@ -964,25 +964,11 @@ class VariableClUpdateProfileDependUrl(FieldValue, ReadonlyVariable): class VariableClUpdateProfileCheckSyncAllowed(Variable): - urls = 'cl_update_rep_url' - names = 'cl_update_rep_name' - path = 'cl_update_profile_path' - cache_path = 'cl_update_package_cache' + path = 'cl_update_repos_storage' def get(self): - if not self.Get(self.urls) or not self.Get(self.names): - return False - repos = self.Get(self.path) - try: - for rep in repos: - with open(f'{rep}/test', 'w') as inf: - inf.write("test") - os.unlink(f"{rep}/test") - path = self.Get(self.cache_path) - with open(f'{path}/test', 'w') as inf: - inf.write("test") - os.unlink(f"{path}/test") - except OSError: + repo_path = path.join(self.Get(self.path), self.Get('cl_update_profile_repo_name')) + if path.exists(repo_path) and not os.access(repo_path, os.W_OK): return False return True