From e1547852d9accb9460573eb156fc81645b8e1871 Mon Sep 17 00:00:00 2001
From: chfl4gs <55137784+chfl4gs@users.noreply.github.com>
Date: Tue, 1 Sep 2020 22:49:55 +0800
Subject: [PATCH] Fixing python binding build and installation on cygwin (#478)

* Travis-CI build & nmake batch file updates

* Fixed zip_safe and cygwin setup
---
 bindings/python/setup.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/bindings/python/setup.py b/bindings/python/setup.py
index 9505cfe..e65732b 100755
--- a/bindings/python/setup.py
+++ b/bindings/python/setup.py
@@ -33,8 +33,10 @@ BUILD_DIR = os.path.join(SRC_DIR, 'build')
 if SYSTEM == 'darwin':
     LIBRARY_FILE = "libkeystone.dylib"
     MAC_LIBRARY_FILE = "libkeystone*.dylib"
-elif SYSTEM in ('win32', 'cygwin'):
+elif SYSTEM == 'win32':
     LIBRARY_FILE = "keystone.dll"
+elif SYSTEM == 'cygwin':
+    LIBRARY_FILE = "cygkeystone-0.dll"
 else:
     LIBRARY_FILE = "libkeystone.so"
 
@@ -111,7 +113,10 @@ def build_libraries():
     else:
         cmd = ['sh', '../make-share.sh', 'lib_only']
         subprocess.call(cmd)
-        obj_dir = os.path.join(BUILD_DIR, 'llvm', 'lib')
+        if SYSTEM == "cygwin":
+            obj_dir = os.path.join(BUILD_DIR, 'llvm', 'bin')
+        else:
+            obj_dir = os.path.join(BUILD_DIR, 'llvm', 'lib')
         obj64_dir = os.path.join(BUILD_DIR, 'llvm', 'lib64')
         if SYSTEM == 'darwin':
             for file in glob.glob(os.path.join(obj_dir, MAC_LIBRARY_FILE)):
@@ -229,7 +234,7 @@ setup(
     ],
     requires=['ctypes'],
     cmdclass={'build': build, 'develop': develop, 'sdist': sdist, 'bdist_egg': bdist_egg},
-    zip_safe=True,
+    zip_safe=False,
     include_package_data=True,
     is_pure=False,
     package_data={
-- 
GitLab