From b3655673d464095558e92539ee0d7d52e72c243f Mon Sep 17 00:00:00 2001 From: rzaitov Date: Tue, 5 Nov 2013 16:15:57 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BF=D0=B0=D1=80=D1=81=D0=B5=D1=80=20=D0=BA=D0=BE=D0=BC=D0=BC?= =?UTF-8?q?=D0=B0=D0=BD=D0=B4=D1=8B=20=D1=83=D1=81=D1=82=D0=B0=D0=BD=D0=BE?= =?UTF-8?q?=D0=B2=D0=BA=D0=B8=20=D0=BF=D1=80=D0=BE=D1=84=D0=B8=D0=BB=D1=8F?= =?UTF-8?q?=20=D0=BE=D0=B1=D0=B5=D1=81=D0=BF=D0=B5=D1=87=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/parser/InstallProfileParser.py | 34 ++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 scripts/parser/InstallProfileParser.py diff --git a/scripts/parser/InstallProfileParser.py b/scripts/parser/InstallProfileParser.py new file mode 100644 index 0000000..2075bb3 --- /dev/null +++ b/scripts/parser/InstallProfileParser.py @@ -0,0 +1,34 @@ +import re +import os +from parser.CopyParser.CopyArguments import CopyArguments +from parser.LineParser import LineParser + + +class InstallProfileParser(LineParser): + def __init__(self): + LineParser.__init__(self) + self.__copyArguments = CopyArguments() + self.__profileStorageDir = '~/Library/MobileDevice/Provisioning Profiles/' + + def parseLine(self, line): + assert line is not None + + profilePathRegexp = r"'(?P[^']+)'$" + regexpSource = self.startsWith('install') + self.than('profile') + profilePathRegexp + + regexp = re.compile(regexpSource, re.UNICODE) + + match = regexp.match(line) + self._guardMatch(match, line, regexpSource) + + srcPath = match.group('path') + dstPath = self.getDestinationPath(srcPath) + + self.__copyArguments.setArguments(srcPath, dstPath) + return self.__copyArguments + + def getDestinationPath(self, sourcePath): + profileFileName = os.path.basename(sourcePath) + destination = os.path.join(self.__profileStorageDir, profileFileName) + + return destination \ No newline at end of file