From cebe52051314c75cd78dbae55d4387702094a6c2 Mon Sep 17 00:00:00 2001 From: ViperMaul Date: Tue, 21 Apr 2015 08:47:55 -0700 Subject: [PATCH 1/3] Userconfig folder is now properly added to the release folder for final distribution. #783 --- tools/make.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tools/make.py b/tools/make.py index aaaf6501c5..a5c3069887 100644 --- a/tools/make.py +++ b/tools/make.py @@ -340,14 +340,14 @@ def copy_optionals_for_building(mod,pbos): src_directories = os.listdir(optionals_root) current_dir = os.getcwd() - print("") + print_blue("\nChecking Optionals folder...") try: #special server.pbo processing files = glob.glob(os.path.join(release_dir, "@ace","optionals","*.pbo")) for file in files: file_name = os.path.basename(file) - print ("Adding the following file: " + file_name) + #print ("Adding the following file: " + file_name) pbos.append(file_name) pbo_path = os.path.join(release_dir, "@ace","optionals",file_name) if (os.path.isfile(pbo_path)): @@ -364,13 +364,19 @@ def copy_optionals_for_building(mod,pbos): try: for dir_name in src_directories: mod.append(dir_name) + #userconfig requires special handling since it is not a PBO source folder. + #CfgConvert fails to build server.pbo if userconfig is not found in P:\ if (dir_name == "userconfig"): + if (os.path.exists(os.path.join(release_dir, "@ace","optionals",dir_name))): + shutil.rmtree(os.path.join(release_dir, "@ace","optionals",dir_name), True) + shutil.copytree(os.path.join(optionals_root,dir_name), os.path.join(release_dir, "@ace","optionals",dir_name)) destination = os.path.join(work_drive,dir_name) else: destination = os.path.join(module_root,dir_name) print("Temporarily copying " + os.path.join(optionals_root,dir_name) + " => " + destination + " for building.") - shutil.rmtree(destination, True) + if (os.path.exists(destination)): + shutil.rmtree(destination, True) shutil.copytree(os.path.join(optionals_root,dir_name), destination) except: print_error("Copy Optionals Failed") @@ -382,6 +388,7 @@ def cleanup_optionals(mod,pbos): print("") try: for dir_name in mod: + #userconfig requires special handling since it is not a PBO source folder. if (dir_name == "userconfig"): destination = os.path.join(work_drive,dir_name) else: @@ -681,6 +688,7 @@ See the make.cfg file for additional build options. # For each module, prep files and then build. + print_blue("\nBuilding...") for module in modules: print_green("\nMaking " + module + "-"*max(1, (60-len(module)))) missing = False From ced0d3d5769b0cf588ae8c2ff2e5ea85f41e031a Mon Sep 17 00:00:00 2001 From: ViperMaul Date: Tue, 21 Apr 2015 10:02:56 -0700 Subject: [PATCH 2/3] Removing extra spaces from the end of line #783 --- tools/make.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/make.py b/tools/make.py index a5c3069887..bdf04f6810 100644 --- a/tools/make.py +++ b/tools/make.py @@ -386,7 +386,7 @@ def copy_optionals_for_building(mod,pbos): def cleanup_optionals(mod,pbos): print("") - try: + try: for dir_name in mod: #userconfig requires special handling since it is not a PBO source folder. if (dir_name == "userconfig"): From e605a8dbca1511ac8c852f311d386a121b58b8cd Mon Sep 17 00:00:00 2001 From: ViperMaul Date: Tue, 21 Apr 2015 10:05:11 -0700 Subject: [PATCH 3/3] Trimming more trailing spaces #783 --- tools/make.py | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/tools/make.py b/tools/make.py index bdf04f6810..3b7bf9d94e 100644 --- a/tools/make.py +++ b/tools/make.py @@ -293,9 +293,9 @@ def print_yellow(msg): print(msg) color("reset") - + def copy_important_files(source_dir,destination_dir): - + originalDir = os.getcwd() importantFiles = ["mod.cpp", "README.md", @@ -303,10 +303,10 @@ def copy_important_files(source_dir,destination_dir): "LICENSE", "logo_ace3_ca.paa" ] - + print_yellow ("source_dir: " + source_dir) print_yellow("destination_dir: " + destination_dir) - + #copy importantFiles try: print_blue("\nSearching for important files in " + source_dir) @@ -316,16 +316,16 @@ def copy_important_files(source_dir,destination_dir): except: print_error("COPYING IMPORTANT FILES.") raise - + #copy all extension dlls try: os.chdir(os.path.join(source_dir)) print_blue("\nSearching for DLLs in " + os.getcwd()) filenames = glob.glob("*.dll") - + if not filenames: print ("Empty SET") - + for dll in filenames: print_green("Copying dll => " + os.path.join(source_dir,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): src_directories = os.listdir(optionals_root) current_dir = os.getcwd() - + print_blue("\nChecking Optionals folder...") try: - + #special server.pbo processing files = glob.glob(os.path.join(release_dir, "@ace","optionals","*.pbo")) for file in files: @@ -383,7 +383,7 @@ def copy_optionals_for_building(mod,pbos): raise finally: os.chdir(current_dir) - + def cleanup_optionals(mod,pbos): print("") try: @@ -393,9 +393,9 @@ def cleanup_optionals(mod,pbos): destination = os.path.join(work_drive,dir_name) else: destination = os.path.join(module_root,dir_name) - + print("Cleaning " + destination) - + try: file_name = "ace_{}.pbo".format(dir_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") continue shutil.rmtree(destination) - + except: print_error("Cleaning Optionals Failed") raise @@ -535,7 +535,7 @@ See the make.cfg file for additional build options. global release_dir global module_root_parent global optionals_root - + cfg.read(os.path.join(make_root, "make.cfg")) # 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_dir = cfg.get(make_target, "release_dir", fallback="release") - + # Project PBO file prefix (files are renamed to prefix_name.pbo) 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")) optionals_root = os.path.join(module_root_parent, "optionals") print_green ("module_root: " + module_root) - + if (os.path.isdir(module_root)): os.chdir(module_root) else: @@ -590,9 +590,9 @@ See the make.cfg file for additional build options. else: print_error ("Directory " + optionals_root + " does not exist.") sys.exit() - + print_green ("release_dir: " + release_dir) - + except: raise print_error("Could not parse make.cfg.") @@ -640,14 +640,14 @@ See the make.cfg file for additional build options. print ("No cache found.") 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 = [] optional_files = [] copy_optionals_for_building(optionals_modules,optional_files) - + # Get list of subdirs in make root. dirs = next(os.walk(module_root))[1] - + # Autodetect what directories to build. if module_autodetect and not arg_modules: modules = [] @@ -692,7 +692,7 @@ See the make.cfg file for additional build options. for module in modules: print_green("\nMaking " + module + "-"*max(1, (60-len(module)))) missing = False - + # Cache check if module in cache: old_sha = cache[module] @@ -705,7 +705,7 @@ See the make.cfg file for additional build options. # Hash the module new_sha = get_directory_hash(os.path.join(module_root, module)) - + # Is the pbo file missing? missing = not os.path.isfile(os.path.join(release_dir, project, "addons", "ace_{}.pbo".format(module))) 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.") 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")) - + # Include build number try: @@ -807,7 +807,7 @@ See the make.cfg file for additional build options. f.close() else: 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: raise print_error("Failed to include build number")