mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Trimming more trailing spaces #783
This commit is contained in:
parent
ced0d3d576
commit
e605a8dbca
@ -293,9 +293,9 @@ def print_yellow(msg):
|
|||||||
print(msg)
|
print(msg)
|
||||||
color("reset")
|
color("reset")
|
||||||
|
|
||||||
|
|
||||||
def copy_important_files(source_dir,destination_dir):
|
def copy_important_files(source_dir,destination_dir):
|
||||||
|
|
||||||
originalDir = os.getcwd()
|
originalDir = os.getcwd()
|
||||||
importantFiles = ["mod.cpp",
|
importantFiles = ["mod.cpp",
|
||||||
"README.md",
|
"README.md",
|
||||||
@ -303,10 +303,10 @@ def copy_important_files(source_dir,destination_dir):
|
|||||||
"LICENSE",
|
"LICENSE",
|
||||||
"logo_ace3_ca.paa"
|
"logo_ace3_ca.paa"
|
||||||
]
|
]
|
||||||
|
|
||||||
print_yellow ("source_dir: " + source_dir)
|
print_yellow ("source_dir: " + source_dir)
|
||||||
print_yellow("destination_dir: " + destination_dir)
|
print_yellow("destination_dir: " + destination_dir)
|
||||||
|
|
||||||
#copy importantFiles
|
#copy importantFiles
|
||||||
try:
|
try:
|
||||||
print_blue("\nSearching for important files in " + source_dir)
|
print_blue("\nSearching for important files in " + source_dir)
|
||||||
@ -316,16 +316,16 @@ def copy_important_files(source_dir,destination_dir):
|
|||||||
except:
|
except:
|
||||||
print_error("COPYING IMPORTANT FILES.")
|
print_error("COPYING IMPORTANT FILES.")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
#copy all extension dlls
|
#copy all extension dlls
|
||||||
try:
|
try:
|
||||||
os.chdir(os.path.join(source_dir))
|
os.chdir(os.path.join(source_dir))
|
||||||
print_blue("\nSearching for DLLs in " + os.getcwd())
|
print_blue("\nSearching for DLLs in " + os.getcwd())
|
||||||
filenames = glob.glob("*.dll")
|
filenames = glob.glob("*.dll")
|
||||||
|
|
||||||
if not filenames:
|
if not filenames:
|
||||||
print ("Empty SET")
|
print ("Empty SET")
|
||||||
|
|
||||||
for dll in filenames:
|
for dll in filenames:
|
||||||
print_green("Copying dll => " + os.path.join(source_dir,dll))
|
print_green("Copying dll => " + os.path.join(source_dir,dll))
|
||||||
if os.path.isfile(dll):
|
if os.path.isfile(dll):
|
||||||
@ -339,10 +339,10 @@ def copy_important_files(source_dir,destination_dir):
|
|||||||
def copy_optionals_for_building(mod,pbos):
|
def copy_optionals_for_building(mod,pbos):
|
||||||
src_directories = os.listdir(optionals_root)
|
src_directories = os.listdir(optionals_root)
|
||||||
current_dir = os.getcwd()
|
current_dir = os.getcwd()
|
||||||
|
|
||||||
print_blue("\nChecking Optionals folder...")
|
print_blue("\nChecking Optionals folder...")
|
||||||
try:
|
try:
|
||||||
|
|
||||||
#special server.pbo processing
|
#special server.pbo processing
|
||||||
files = glob.glob(os.path.join(release_dir, "@ace","optionals","*.pbo"))
|
files = glob.glob(os.path.join(release_dir, "@ace","optionals","*.pbo"))
|
||||||
for file in files:
|
for file in files:
|
||||||
@ -383,7 +383,7 @@ def copy_optionals_for_building(mod,pbos):
|
|||||||
raise
|
raise
|
||||||
finally:
|
finally:
|
||||||
os.chdir(current_dir)
|
os.chdir(current_dir)
|
||||||
|
|
||||||
def cleanup_optionals(mod,pbos):
|
def cleanup_optionals(mod,pbos):
|
||||||
print("")
|
print("")
|
||||||
try:
|
try:
|
||||||
@ -393,9 +393,9 @@ def cleanup_optionals(mod,pbos):
|
|||||||
destination = os.path.join(work_drive,dir_name)
|
destination = os.path.join(work_drive,dir_name)
|
||||||
else:
|
else:
|
||||||
destination = os.path.join(module_root,dir_name)
|
destination = os.path.join(module_root,dir_name)
|
||||||
|
|
||||||
print("Cleaning " + destination)
|
print("Cleaning " + destination)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
file_name = "ace_{}.pbo".format(dir_name)
|
file_name = "ace_{}.pbo".format(dir_name)
|
||||||
src_file_path = os.path.join(release_dir, "@ace","addons",file_name)
|
src_file_path = os.path.join(release_dir, "@ace","addons",file_name)
|
||||||
@ -407,7 +407,7 @@ def cleanup_optionals(mod,pbos):
|
|||||||
print_error(file_name + " already exists")
|
print_error(file_name + " already exists")
|
||||||
continue
|
continue
|
||||||
shutil.rmtree(destination)
|
shutil.rmtree(destination)
|
||||||
|
|
||||||
except:
|
except:
|
||||||
print_error("Cleaning Optionals Failed")
|
print_error("Cleaning Optionals Failed")
|
||||||
raise
|
raise
|
||||||
@ -535,7 +535,7 @@ See the make.cfg file for additional build options.
|
|||||||
global release_dir
|
global release_dir
|
||||||
global module_root_parent
|
global module_root_parent
|
||||||
global optionals_root
|
global optionals_root
|
||||||
|
|
||||||
cfg.read(os.path.join(make_root, "make.cfg"))
|
cfg.read(os.path.join(make_root, "make.cfg"))
|
||||||
|
|
||||||
# Project name (with @ symbol)
|
# Project name (with @ symbol)
|
||||||
@ -569,7 +569,7 @@ See the make.cfg file for additional build options.
|
|||||||
|
|
||||||
# Release/build directory, relative to script dir
|
# Release/build directory, relative to script dir
|
||||||
release_dir = cfg.get(make_target, "release_dir", fallback="release")
|
release_dir = cfg.get(make_target, "release_dir", fallback="release")
|
||||||
|
|
||||||
# Project PBO file prefix (files are renamed to prefix_name.pbo)
|
# Project PBO file prefix (files are renamed to prefix_name.pbo)
|
||||||
pbo_name_prefix = cfg.get(make_target, "pbo_name_prefix", fallback=None)
|
pbo_name_prefix = cfg.get(make_target, "pbo_name_prefix", fallback=None)
|
||||||
|
|
||||||
@ -578,7 +578,7 @@ See the make.cfg file for additional build options.
|
|||||||
module_root = cfg.get(make_target, "module_root", fallback=os.path.join(make_root_parent, "addons"))
|
module_root = cfg.get(make_target, "module_root", fallback=os.path.join(make_root_parent, "addons"))
|
||||||
optionals_root = os.path.join(module_root_parent, "optionals")
|
optionals_root = os.path.join(module_root_parent, "optionals")
|
||||||
print_green ("module_root: " + module_root)
|
print_green ("module_root: " + module_root)
|
||||||
|
|
||||||
if (os.path.isdir(module_root)):
|
if (os.path.isdir(module_root)):
|
||||||
os.chdir(module_root)
|
os.chdir(module_root)
|
||||||
else:
|
else:
|
||||||
@ -590,9 +590,9 @@ See the make.cfg file for additional build options.
|
|||||||
else:
|
else:
|
||||||
print_error ("Directory " + optionals_root + " does not exist.")
|
print_error ("Directory " + optionals_root + " does not exist.")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
print_green ("release_dir: " + release_dir)
|
print_green ("release_dir: " + release_dir)
|
||||||
|
|
||||||
except:
|
except:
|
||||||
raise
|
raise
|
||||||
print_error("Could not parse make.cfg.")
|
print_error("Could not parse make.cfg.")
|
||||||
@ -640,14 +640,14 @@ See the make.cfg file for additional build options.
|
|||||||
print ("No cache found.")
|
print ("No cache found.")
|
||||||
cache = {}
|
cache = {}
|
||||||
|
|
||||||
#Temporarily copy optionals_root for building. They will be removed later.
|
#Temporarily copy optionals_root for building. They will be removed later.
|
||||||
optionals_modules = []
|
optionals_modules = []
|
||||||
optional_files = []
|
optional_files = []
|
||||||
copy_optionals_for_building(optionals_modules,optional_files)
|
copy_optionals_for_building(optionals_modules,optional_files)
|
||||||
|
|
||||||
# Get list of subdirs in make root.
|
# Get list of subdirs in make root.
|
||||||
dirs = next(os.walk(module_root))[1]
|
dirs = next(os.walk(module_root))[1]
|
||||||
|
|
||||||
# Autodetect what directories to build.
|
# Autodetect what directories to build.
|
||||||
if module_autodetect and not arg_modules:
|
if module_autodetect and not arg_modules:
|
||||||
modules = []
|
modules = []
|
||||||
@ -692,7 +692,7 @@ See the make.cfg file for additional build options.
|
|||||||
for module in modules:
|
for module in modules:
|
||||||
print_green("\nMaking " + module + "-"*max(1, (60-len(module))))
|
print_green("\nMaking " + module + "-"*max(1, (60-len(module))))
|
||||||
missing = False
|
missing = False
|
||||||
|
|
||||||
# Cache check
|
# Cache check
|
||||||
if module in cache:
|
if module in cache:
|
||||||
old_sha = cache[module]
|
old_sha = cache[module]
|
||||||
@ -705,7 +705,7 @@ See the make.cfg file for additional build options.
|
|||||||
|
|
||||||
# Hash the module
|
# Hash the module
|
||||||
new_sha = get_directory_hash(os.path.join(module_root, module))
|
new_sha = get_directory_hash(os.path.join(module_root, module))
|
||||||
|
|
||||||
# Is the pbo file missing?
|
# Is the pbo file missing?
|
||||||
missing = not os.path.isfile(os.path.join(release_dir, project, "addons", "ace_{}.pbo".format(module)))
|
missing = not os.path.isfile(os.path.join(release_dir, project, "addons", "ace_{}.pbo".format(module)))
|
||||||
if missing:
|
if missing:
|
||||||
@ -789,7 +789,7 @@ See the make.cfg file for additional build options.
|
|||||||
print_error("CfgConvert -txt return code == " + str(ret) + ". Usually means there is a syntax error within the config.cpp file.")
|
print_error("CfgConvert -txt return code == " + str(ret) + ". Usually means there is a syntax error within the config.cpp file.")
|
||||||
os.remove(os.path.join(work_drive, prefix, module, "config.cpp"))
|
os.remove(os.path.join(work_drive, prefix, module, "config.cpp"))
|
||||||
shutil.copyfile(os.path.join(work_drive, prefix, module, "config.backup"), os.path.join(work_drive, prefix, module, "config.cpp"))
|
shutil.copyfile(os.path.join(work_drive, prefix, module, "config.backup"), os.path.join(work_drive, prefix, module, "config.cpp"))
|
||||||
|
|
||||||
|
|
||||||
# Include build number
|
# Include build number
|
||||||
try:
|
try:
|
||||||
@ -807,7 +807,7 @@ See the make.cfg file for additional build options.
|
|||||||
f.close()
|
f.close()
|
||||||
else:
|
else:
|
||||||
os.remove(os.path.join(work_drive, prefix, module, "config.cpp"))
|
os.remove(os.path.join(work_drive, prefix, module, "config.cpp"))
|
||||||
os.rename(os.path.join(work_drive, prefix, module, "config.backup"), os.path.join(work_drive, prefix, module, "config.cpp"))
|
os.rename(os.path.join(work_drive, prefix, module, "config.backup"), os.path.join(work_drive, prefix, module, "config.cpp"))
|
||||||
except:
|
except:
|
||||||
raise
|
raise
|
||||||
print_error("Failed to include build number")
|
print_error("Failed to include build number")
|
||||||
|
Loading…
Reference in New Issue
Block a user