From 2cf1510af9e5cc91c0359d2312d67ccf28bff9ea Mon Sep 17 00:00:00 2001 From: rzaitov Date: Tue, 12 Nov 2013 16:04:14 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9C=D0=BE=D0=B4=D0=B8=D1=84=D0=B8=D1=86?= =?UTF-8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BB=20=D0=BA=D0=BE=D0=BC=D0=BC?= =?UTF-8?q?=D0=B0=D0=BD=D0=B4=D1=83=20=D1=83=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=B1=D1=8D=D0=BA=D0=B0=D0=BF=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CommandBuilders/DeleteBackupCommandBuilder.py | 4 ++-- scripts/TouchinBuild/Tests/ManualTests/delete_backup_test.py | 2 +- .../commands/BaseBackupCommand/DeleteBackupCommand.py | 4 ++++ .../TouchinBuild/parsers/ParserBackup/DeleteBackupParser.py | 3 +-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/TouchinBuild/CommandBuilders/DeleteBackupCommandBuilder.py b/scripts/TouchinBuild/CommandBuilders/DeleteBackupCommandBuilder.py index 5fd5b66..53e9238 100644 --- a/scripts/TouchinBuild/CommandBuilders/DeleteBackupCommandBuilder.py +++ b/scripts/TouchinBuild/CommandBuilders/DeleteBackupCommandBuilder.py @@ -18,7 +18,7 @@ class DeleteBackupCommandBuilder: assert line is not None parser = DeleteBackupParser() - folderPath = parser.parseLine(line) + parser.parseLine(line) - command = DeleteBackupCommand(folderPath) + command = DeleteBackupCommand() return command diff --git a/scripts/TouchinBuild/Tests/ManualTests/delete_backup_test.py b/scripts/TouchinBuild/Tests/ManualTests/delete_backup_test.py index 92f6b2e..4c312c4 100644 --- a/scripts/TouchinBuild/Tests/ManualTests/delete_backup_test.py +++ b/scripts/TouchinBuild/Tests/ManualTests/delete_backup_test.py @@ -1,6 +1,6 @@ from CommandBuilders.DeleteBackupCommandBuilder import DeleteBackupCommandBuilder -line = "delete backup 'BuildSample'" +line = "delete backup" cmdBuilder = DeleteBackupCommandBuilder() command = cmdBuilder.getCommandFor(line) diff --git a/scripts/TouchinBuild/commands/BaseBackupCommand/DeleteBackupCommand.py b/scripts/TouchinBuild/commands/BaseBackupCommand/DeleteBackupCommand.py index 6cc0806..c29f5ce 100644 --- a/scripts/TouchinBuild/commands/BaseBackupCommand/DeleteBackupCommand.py +++ b/scripts/TouchinBuild/commands/BaseBackupCommand/DeleteBackupCommand.py @@ -1,3 +1,4 @@ +import os import shutil from commands.BaseBackupCommand.BaseBackupCommand import BaseBackupCommand @@ -7,4 +8,7 @@ class DeleteBackupCommand(BaseBackupCommand): BaseBackupCommand.__init__(self) def execute(self): + if not os.path.exists(self.backupDirAbsPath): + raise Exception('backup folder: {0} not exists'.format(self.backupDirAbsPath)) + shutil.rmtree(self.backupDirAbsPath, ignore_errors=True) diff --git a/scripts/TouchinBuild/parsers/ParserBackup/DeleteBackupParser.py b/scripts/TouchinBuild/parsers/ParserBackup/DeleteBackupParser.py index c210f32..936f4ec 100644 --- a/scripts/TouchinBuild/parsers/ParserBackup/DeleteBackupParser.py +++ b/scripts/TouchinBuild/parsers/ParserBackup/DeleteBackupParser.py @@ -10,8 +10,7 @@ class DeleteBackupParser(ParserBackupBase): def getMatchInfo(self, line): assert line is not None - folderNameRegexp = r"'(?P[^']+)'$" - regexpSource = self.startsWith('delete') + self.than('backup') + folderNameRegexp + regexpSource = self.startsWith('delete') + self.endsWith('backup') regexp = re.compile(regexpSource, re.UNICODE) match = regexp.match(line)