From c8d03fc3154a34d2d2904491ee36a7ab8239289c Mon Sep 17 00:00:00 2001 From: John Lindsay Date: Sun, 23 Oct 2022 11:19:19 -0400 Subject: [PATCH] Update build.py --- build.py | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/build.py b/build.py index ecd3835c..ac10bf5e 100755 --- a/build.py +++ b/build.py @@ -23,8 +23,8 @@ if len(result.stdout) > 0: print(result.stdout) - if os.path.exists(output_dir): - rmtree(output_dir) +if os.path.exists(output_dir): + rmtree(output_dir) print("Compiling...") result = subprocess.run(['cargo', 'build', '--release'], stdout=subprocess.PIPE) @@ -34,7 +34,6 @@ if not os.path.exists(output_plugin_dir): os.makedirs(output_plugin_dir) - ext = '' if platform.system() == 'Windows': ext = '.exe' @@ -43,6 +42,8 @@ exe_file = os.path.join(target_dir, 'whitebox_tools') + ext dst = os.path.join(output_dir, 'whitebox_tools') + ext copyfile(exe_file, dst) +if platform.system() != 'Windows': + result = subprocess.run(['strip', dst], stdout=subprocess.PIPE) os.system("chmod 755 " + dst) # grant executable permission # Copy the ancillary files @@ -90,6 +91,25 @@ exe_file = os.path.join(target_dir, plugin) + ext dst = os.path.join(output_plugin_dir, plugin) + ext copyfile(exe_file, dst) + if platform.system() != 'Windows': + print("Stripping", plugin) + result = subprocess.run(['strip', dst], stdout=subprocess.PIPE) + # print(result) + + os.system("chmod 755 " + dst) # grant executable permission + +# Copy the register_license binary into the plugins folder if it is available +os.chdir(app_dir) +if os.path.exists('../GeneralToolsetExtension'): + # Copy the executable file into the plugins directory + exe_file = f"../GeneralToolsetExtension/register_license{ext}" + if os.path.exists(exe_file): + dst = os.path.join(output_plugin_dir, 'register_license') + ext + copyfile(exe_file, dst) os.system("chmod 755 " + dst) # grant executable permission + else: + print("No register_license file found...") +else: + print("No directory containing the register_license file found...") print("Done!") \ No newline at end of file