aboutsummaryrefslogtreecommitdiff
path: root/scripts/mingw_package.py
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-10-05 07:15:55 +0200
committerdec05eba <dec05eba@protonmail.com>2020-07-06 07:39:33 +0200
commit45e00fd7c7695adb9d69e8621ab76fdfa085900b (patch)
tree167d2a660db7bc4bdc199a438b8255ffc8b45cca /scripts/mingw_package.py
parent5250cb90406693163763a214af95f670e0e3a4e0 (diff)
Fix for windows & mingw
Diffstat (limited to 'scripts/mingw_package.py')
-rwxr-xr-xscripts/mingw_package.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/scripts/mingw_package.py b/scripts/mingw_package.py
new file mode 100755
index 0000000..b304128
--- /dev/null
+++ b/scripts/mingw_package.py
@@ -0,0 +1,31 @@
+#!/usr/bin/env python3
+
+import sys
+import os
+import mingw_ldd
+import shutil
+
+def usage():
+ print("usage: mingw-package.py <executable_path>")
+ exit(1)
+
+def main():
+ if len(sys.argv) != 2:
+ usage()
+
+ executable_path = sys.argv[1]
+ if not os.path.isfile(executable_path):
+ print("arg executable_path is not a file or it's a directory")
+ exit(2)
+ executable_path = os.path.realpath(executable_path)
+ executable_dir = os.path.dirname(executable_path)
+
+ print("Checking dynamic library dependencies of %s..." % executable_path)
+ deps = mingw_ldd.dep_tree(executable_path)
+ for dll, full_path in deps.items():
+ if full_path != "not found":
+ print("Copying %s to %s" % (dll, executable_dir))
+ shutil.copyfile(full_path, os.path.join(executable_dir, dll))
+
+if __name__ == "__main__":
+ main() \ No newline at end of file