Создал файл с вспомогательными функциями

This commit is contained in:
Rustam Zaitov 2013-09-15 01:30:22 +04:00
parent c5090aa183
commit 0594fa2644
2 changed files with 19 additions and 0 deletions

View File

@ -3,6 +3,7 @@ import os
import re
import settings
import instruments
# print("all projects:")
# print(settings.all_projects)

18
scripts/instruments.py Normal file
View File

@ -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