From b768975a4887be34ea2c16ca7980478cbcfa2541 Mon Sep 17 00:00:00 2001 From: EndrII <EndrIIMail@gmail.com> Date: Tue, 6 Apr 2021 00:33:46 +0300 Subject: [PATCH] ref #9 fix seecret manager --- BuildBotLib/cmake.py | 3 ++- BuildBotLib/crossplatformQmake.py | 3 ++- BuildBotLib/make.py | 3 ++- BuildBotLib/qmake.py | 3 ++- BuildBotLib/secretManager.py | 21 +++++++++++---------- 5 files changed, 19 insertions(+), 14 deletions(-) diff --git a/BuildBotLib/cmake.py b/BuildBotLib/cmake.py index a98fa0c..a976461 100644 --- a/BuildBotLib/cmake.py +++ b/BuildBotLib/cmake.py @@ -55,7 +55,8 @@ class CMake(Make): return ' '.join(options) def androidXmakeCmd(self, props): - secret = SecretManager(self.home + "/buildBotSecret/secret.json") + file = self.home + "/buildBotSecret/secret.json" + secret = SecretManager(file, props) toochainFile = 'build/cmake/android.toolchain.cmake' options = [ diff --git a/BuildBotLib/crossplatformQmake.py b/BuildBotLib/crossplatformQmake.py index b6ca2d4..bc40b6b 100644 --- a/BuildBotLib/crossplatformQmake.py +++ b/BuildBotLib/crossplatformQmake.py @@ -30,7 +30,8 @@ class CrossplatformQmake (QMake): return command def androidXmakeCmd(self, props): - secret = SecretManager(self.home + "/buildBotSecret/secret.json") + file = self.home + "/buildBotSecret/secret.json" + secret = SecretManager(file, props) command = [ 'qmake-android', diff --git a/BuildBotLib/make.py b/BuildBotLib/make.py index bbdaf2e..0175198 100644 --- a/BuildBotLib/make.py +++ b/BuildBotLib/make.py @@ -85,7 +85,8 @@ class Make(BaseModule): return command def androidXmakeCmd(self, props): - secret = SecretManager(self.home + "/buildBotSecret/secret.json") + file = self.home + "/buildBotSecret/secret.json" + secret = SecretManager(file, props) command = [ 'qmake-android', diff --git a/BuildBotLib/qmake.py b/BuildBotLib/qmake.py index 0883563..3ea2450 100644 --- a/BuildBotLib/qmake.py +++ b/BuildBotLib/qmake.py @@ -31,7 +31,8 @@ class QMake(Make): return self.mainCmd() def androidXmakeCmd(self, props): - secret = SecretManager(self.home + "/buildBotSecret/secret.json") + file = self.home + "/buildBotSecret/secret.json" + secret = SecretManager(file, props) command = [ 'qmake', diff --git a/BuildBotLib/secretManager.py b/BuildBotLib/secretManager.py index db4a877..dbdb8e0 100644 --- a/BuildBotLib/secretManager.py +++ b/BuildBotLib/secretManager.py @@ -5,15 +5,16 @@ from pathlib import Path class SecretManager: - def __init__(self, jsFile): - try: - contents = Path(jsFile).read_text() - self.jsfile = json.loads(contents) - except: - pass + def __init__(self, jsFile, properties=None): + + contents = Path(jsFile).read_text() + self.jsfile = json.loads(contents) + self.prop = properties def getValue(self, key): - try: - return self.jsfile[key] - except: - pass + value = self.jsfile[key] + + if self.prop: + self.prop.useSecret(value, key) + + return value