From 88b4de94c86d15d9507579d499866f423db9af07 Mon Sep 17 00:00:00 2001 From: rzaitov Date: Wed, 13 Nov 2013 19:13:07 +0400 Subject: [PATCH 1/3] =?UTF-8?q?=D0=9F=D0=BE=D1=84=D0=B8=D0=BA=D1=81=D0=B8?= =?UTF-8?q?=D0=BB=20=D1=82=D0=B5=D1=81=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tests/UnitTests/SettingsParser/test_SettingsParser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/TouchinBuild/Tests/UnitTests/SettingsParser/test_SettingsParser.py b/scripts/TouchinBuild/Tests/UnitTests/SettingsParser/test_SettingsParser.py index 6888f29..d2727de 100644 --- a/scripts/TouchinBuild/Tests/UnitTests/SettingsParser/test_SettingsParser.py +++ b/scripts/TouchinBuild/Tests/UnitTests/SettingsParser/test_SettingsParser.py @@ -8,7 +8,7 @@ from parsers.SettingsParser.SettingsParser import SettingsParser class TestSettingsParser(unittest.TestCase): def setUp(self): self.preprocessor = NullPreprocessor() - self.parser = SettingsParser(self.preprocessor) + self.parser = SettingsParser(self.preprocessor, None) def test_processLine(self): line1 = "x.y.name1 = 'value1'" @@ -44,7 +44,7 @@ class TestSettingsParser(unittest.TestCase): class PartialSettingsParser(SettingsParser): def __init__(self, textPreprocessor): - SettingsParser.__init__(self, textPreprocessor) + SettingsParser.__init__(self, textPreprocessor, None) self.processLineCall = 0 def processLine(self, line): From f42e2fce3c804005dad7a92d9f76da5560b96e3e Mon Sep 17 00:00:00 2001 From: rzaitov Date: Wed, 13 Nov 2013 19:27:14 +0400 Subject: [PATCH 2/3] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB?= =?UTF-8?q?=20=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D1=8C=20=D0=BD=D0=B5=20=D1=83=D0=BA=D0=B0=D0=B7=D1=8B=D0=B2?= =?UTF-8?q?=D0=B0=D1=82=D1=8C=20=D0=BA=D0=B0=D0=B2=D1=8B=D1=87=D0=BA=D0=B8?= =?UTF-8?q?=20=D0=BF=D1=80=D0=B8=20=D1=83=D0=BA=D0=B0=D0=B7=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B8=20=D0=B7=D0=BD=D0=B0=D1=87=D0=B5=D0=BD=D0=B8=D0=B9?= =?UTF-8?q?=20=D0=B2=20=D1=84=D0=B0=D0=B9=D0=BB=D0=B5=20=D0=BD=D0=B0=D1=81?= =?UTF-8?q?=D1=82=D1=80=D0=BE=D0=B5=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SettingsParser/test_SettingsLineParser.py | 26 +++++++++++--- .../SettingsParser/SettingsLineParser.py | 34 ++++++++++++++----- scripts/settings.txt | 4 +-- 3 files changed, 50 insertions(+), 14 deletions(-) diff --git a/scripts/TouchinBuild/Tests/UnitTests/SettingsParser/test_SettingsLineParser.py b/scripts/TouchinBuild/Tests/UnitTests/SettingsParser/test_SettingsLineParser.py index da2be49..00fb89a 100644 --- a/scripts/TouchinBuild/Tests/UnitTests/SettingsParser/test_SettingsLineParser.py +++ b/scripts/TouchinBuild/Tests/UnitTests/SettingsParser/test_SettingsLineParser.py @@ -7,9 +7,27 @@ class TestSettingsLineParser(unittest.TestCase): def setUp(self): self.parser = SettingsLineParser() - def test_getPathAndValue(self): - line = "abc.123.some_name = 'crazy value ±~ ../ 123'" + def test_whiteSpaces(self): + self.checkPathAndValue("abc.123.some_name = 'crazy value ±~ ../ 123'", 'abc.123.some_name', 'crazy value ±~ ../ 123') + self.checkPathAndValue("a.b.c = 'value'", 'a.b.c', 'value') + self.checkPathAndValue("a.b.c= 'value'", 'a.b.c', 'value') + self.checkPathAndValue("a.b.c ='value'", 'a.b.c', 'value') + self.checkPathAndValue("a.b.c='value'", 'a.b.c', 'value') + + def test_valueWithoutComma(self): + self.checkPathAndValue("a.b.c = value", 'a.b.c', 'value') + self.checkPathAndValue("a.b.c = some value", 'a.b.c', 'some value') + self.checkPathAndValue("a.b.c = some value ", 'a.b.c', 'some value') + + def test_valueWithEscapeComma(self): + self.checkPathAndValue("a.b.c = '\"value\"' ", 'a.b.c', '"value"') + self.checkPathAndValue('a.b.c = "\'value\'" ', 'a.b.c', "'value'") + + self.checkPathAndValue('a.b.c = ""value"" ', 'a.b.c', 'value') + self.checkPathAndValue("a.b.c = ''value'' ", 'a.b.c', 'value') + + def checkPathAndValue(self, line, expectedPath, expectedValue): result = self.parser.splitToPathAndValue(line) - self.assertEqual('abc.123.some_name', result[0]) - self.assertEqual('crazy value ±~ ../ 123', result[1]) + self.assertEqual(expectedPath, result[0]) + self.assertEqual(expectedValue, result[1]) diff --git a/scripts/TouchinBuild/parsers/SettingsParser/SettingsLineParser.py b/scripts/TouchinBuild/parsers/SettingsParser/SettingsLineParser.py index e7e6ca2..755d4be 100644 --- a/scripts/TouchinBuild/parsers/SettingsParser/SettingsLineParser.py +++ b/scripts/TouchinBuild/parsers/SettingsParser/SettingsLineParser.py @@ -27,17 +27,35 @@ class SettingsLineParser(LineParser): return result def splitToPathAndValue(self, line): + # some.path = some_value + result = line.split('=') - propPathRegexp = r"^(?P[\w.]+)" - valueRegexp = "'(?P.*)'" + propPath = self.getPropertyPath(result[0]) + value = self.getValue(result[1]) - regexpSource = propPathRegexp + r'\s*=\s*' + valueRegexp - regexp = re.compile(regexpSource, re.UNICODE) + return propPath, value - match = regexp.match(line) - self._guardMatch(match, line, regexpSource) + def getPropertyPath(self, rawPropertyPath): + assert rawPropertyPath is not None + stripped = rawPropertyPath.strip() + + propPathRegexp = r"^(?P[\w.]+)$" + regexp = re.compile(propPathRegexp, re.UNICODE) + + match = regexp.match(stripped) + self._guardMatch(match, stripped, propPathRegexp) propPath = match.group('prop_path') - value = match.group('value') + return propPath - return propPath, value \ No newline at end of file + def getValue(self, rawValue): + assert rawValue is not None + stripped = rawValue.strip() + + old = stripped + stripped = stripped.strip("'") + + if old == stripped: + stripped = stripped.strip('"') + + return stripped \ No newline at end of file diff --git a/scripts/settings.txt b/scripts/settings.txt index 277d2b8..ffa0f45 100644 --- a/scripts/settings.txt +++ b/scripts/settings.txt @@ -1,6 +1,6 @@ # global settings -build_tool = '/Applications/Xamarin\ Studio.app/Contents/MacOS/mdtool' -version = '0.0.0' # комментарий в тойже строке +build_tool='/Applications/Xamarin\ Studio.app/Contents/MacOS/mdtool' +version=0.0.0 # комментарий в тойже строке configs = 'appstore, staging' # ios platform settings From 609ed72335aea7bd6373f24f081f27f581419c87 Mon Sep 17 00:00:00 2001 From: rzaitov Date: Wed, 13 Nov 2013 19:29:39 +0400 Subject: [PATCH 3/3] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE=D1=81?= =?UTF-8?q?=D1=82=D1=8C=20=D0=BD=D0=B5=20=D1=83=D0=BA=D0=B0=D0=B7=D1=8B?= =?UTF-8?q?=D0=B2=D0=B0=D1=82=D1=8C=20=D0=BA=D0=B0=D0=B2=D1=8B=D1=87=D0=BA?= =?UTF-8?q?=D0=B8=20=D0=B2=20=D1=84=D0=B0=D0=B9=D0=BB=D0=B5=20=D0=BD=D0=B0?= =?UTF-8?q?=D1=81=D1=82=D1=80=D0=BE=D0=B5=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/settings.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/settings.txt b/scripts/settings.txt index ffa0f45..8edf250 100644 --- a/scripts/settings.txt +++ b/scripts/settings.txt @@ -4,7 +4,7 @@ version=0.0.0 # комментарий в тойже строке configs = 'appstore, staging' # ios platform settings -ios.sln_config = 'Release|iPhone' +ios.sln_config = Release|iPhone ios.steps = 'scripts/IosSteps.txt' ios.setup_steps = 'IosSetupSteps.txt' ios.assembly_name = 'CoolApp'