From 8bb09cc773fd0323d12dce4ae5946075ef640e73 Mon Sep 17 00:00:00 2001
From: Jonathan Harris <jonathan@marginal.org.uk>
Date: Tue, 22 Nov 2016 23:31:59 +0000
Subject: [PATCH] Fix signature verification on OSX with SIP

---
 README.md | 2 +-
 setup.py  | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 0ffc2f4e..28506260 100644
--- a/README.md
+++ b/README.md
@@ -144,7 +144,7 @@ Download and extract the source code of the [latest release](https://github.com/
 
 Mac:
 
-* Requires the Python “requests” and “watchdog” modules - install these with `easy_install requests watchdog` .
+* Requires the Python “requests” and “watchdog” modules, plus an up-to-date “py2app” module if you also want to package the app - install these with `easy_install -U requests watchdog py2app` .
 * Run with `./EDMarketConnector.py` .
 
 Windows:
diff --git a/setup.py b/setup.py
index a153d7b1..299826d6 100755
--- a/setup.py
+++ b/setup.py
@@ -26,6 +26,11 @@ if sys.platform=='win32':
     import py2exe
     dist_dir = 'dist.win32'
 elif sys.platform=='darwin':
+    if sys.executable.startswith('/usr'):
+        # SIP doesn't allow symlinks to /usr/bin/...
+        import subprocess
+        subprocess.call(['/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python'] + sys.argv, stdout=sys.stdout, stderr=sys.stderr)
+        sys.exit(0)
     dist_dir = 'dist.macosx'
 else:
     assert False, 'Unsupported platform %s' % sys.platform