From 0594fa26443d91ae0b699dbc48310456d5cc9738 Mon Sep 17 00:00:00 2001 From: Rustam Zaitov Date: Sun, 15 Sep 2013 01:30:22 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0=D0=BB=20=D1=84?= =?UTF-8?q?=D0=B0=D0=B9=D0=BB=20=D1=81=20=D0=B2=D1=81=D0=BF=D0=BE=D0=BC?= =?UTF-8?q?=D0=BE=D0=B3=D0=B0=D1=82=D0=B5=D0=BB=D1=8C=D0=BD=D1=8B=D0=BC?= =?UTF-8?q?=D0=B8=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D1=8F=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/buld.py | 1 + scripts/instruments.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 scripts/instruments.py diff --git a/scripts/buld.py b/scripts/buld.py index 4362b3c..8586fdd 100644 --- a/scripts/buld.py +++ b/scripts/buld.py @@ -3,6 +3,7 @@ import os import re import settings +import instruments # print("all projects:") # print(settings.all_projects) diff --git a/scripts/instruments.py b/scripts/instruments.py new file mode 100644 index 0000000..4ed1ad5 --- /dev/null +++ b/scripts/instruments.py @@ -0,0 +1,18 @@ +import shutil +import os + +def CreateOrRestoreFromBackup(base_dir, relative_path_to_files): + + for rel_path in relative_path_to_files: + + abs_path = os.path.join(base_dir, rel_path) + abs_path_backup = "{0}.build_backup".format(os.path) + + if os.path.exists(abs_path_backup): + # restore from backup + shutil.copyfile(abs_path_backup, abs_path) + else: + # create backup + shutil.copyfile(abs_path, abs_path_backup) + + return None