Merge pull request #2264 from jonpas/make_versionFiles_subFolder_support

Add subfolder support to importantFiles and versionFiles to make.py
This commit is contained in:
Thomas Kooi 2016-02-04 19:35:15 +01:00
commit 692ead07f1

View File

@ -73,8 +73,8 @@ dssignfile = ""
prefix = "ace"
pbo_name_prefix = "ace_"
signature_blacklist = ["ace_server.pbo"]
importantFiles = ["mod.cpp", "README.md", "AUTHORS.txt", "LICENSE", "logo_ace3_ca.paa"]
versionFiles = ["README.md", "mod.cpp"]
importantFiles = ["mod.cpp", "README.md", "docs\\README_DE.md", "docs\\README_PL.md", "AUTHORS.txt", "LICENSE", "logo_ace3_ca.paa"]
versionFiles = ["README.md", "docs\\README_DE.md", "docs\\README_PL.md", "mod.cpp"]
###############################################################################
# http://akiscode.com/articles/sha-1directoryhash.shtml
@ -330,15 +330,20 @@ def copy_important_files(source_dir,destination_dir):
originalDir = os.getcwd()
#copy importantFiles
# Copy importantFiles
try:
print_blue("\nSearching for important files in {}".format(source_dir))
print("Source_dir: {}".format(source_dir))
print("Destination_dir: {}".format(destination_dir))
for file in importantFiles:
filePath = os.path.join(module_root_parent, file)
# Take only file name for destination path (to put it into root of release dir)
if "\\" in file:
count = file.count("\\")
file = file.split("\\", count)[-1]
print_green("Copying file => {}".format(os.path.join(source_dir,file)))
shutil.copyfile(os.path.join(source_dir,file),os.path.join(destination_dir,file))
shutil.copyfile(os.path.join(source_dir,filePath),os.path.join(destination_dir,file))
except:
print_error("COPYING IMPORTANT FILES.")
raise
@ -626,6 +631,10 @@ def stash_version_files_for_building():
try:
for file in versionFiles:
filePath = os.path.join(module_root_parent, file)
# Take only file name for stash location if in subfolder (otherwise it gets removed when removing folders from release dir)
if "\\" in file:
count = file.count("\\")
file = file.split("\\", count)[-1]
stashPath = os.path.join(release_dir, file)
print("Temporarily stashing {} => {}.bak for version update".format(filePath, stashPath))
shutil.copy(filePath, "{}.bak".format(stashPath))
@ -642,6 +651,10 @@ def restore_version_files():
try:
for file in versionFiles:
filePath = os.path.join(module_root_parent, file)
# Take only file name for stash path if in subfolder (otherwise it gets removed when removing folders from release dir)
if "\\" in file:
count = file.count("\\")
file = file.split("\\", count)[-1]
stashPath = os.path.join(release_dir, file)
print("Restoring {}".format(filePath))
shutil.move("{}.bak".format(stashPath), filePath)