From 18cfe73a85670ff1dc0c1028140458c9064503af Mon Sep 17 00:00:00 2001
From: Inso <insomniak.fr@gmail.com>
Date: Sun, 31 Jan 2016 17:14:35 +0100
Subject: [PATCH] Try with .spec file

---
 ci/appveyor/build.cmd |  2 +-
 ci/travis/build.sh    |  5 ++---
 sakia.spec            | 41 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 44 insertions(+), 4 deletions(-)
 create mode 100644 sakia.spec

diff --git a/ci/appveyor/build.cmd b/ci/appveyor/build.cmd
index 87b403b2..d5b374fb 100644
--- a/ci/appveyor/build.cmd
+++ b/ci/appveyor/build.cmd
@@ -20,5 +20,5 @@ if %errorlevel% neq 0 exit /b 1s
 python gen_translations.py
 if %errorlevel% neq 0 exit /b 1
 
-pyinstaller src/sakia/main.py --additional-hooks-dir hooks
+pyinstaller sakia.spec
 if %errorlevel% neq 0 exit /b 1
diff --git a/ci/travis/build.sh b/ci/travis/build.sh
index 7513f6ab..bd31a385 100755
--- a/ci/travis/build.sh
+++ b/ci/travis/build.sh
@@ -19,10 +19,9 @@ python gen_translations.py
 
 if [ $TRAVIS_OS_NAME == "osx" ]
 then
-    pyi-makespec src/sakia/main.py --debug --additional-hooks-dir hooks
-    cat main.spec
+    pyinstaller sakia.spec
 elif [ $TRAVIS_OS_NAME == "linux" ]
 then
-    pyinstaller src/sakia/main.py --debug --additional-hooks-dir hooks
+    pyinstaller sakia.spec
 fi
 
diff --git a/sakia.spec b/sakia.spec
new file mode 100644
index 00000000..9ab862da
--- /dev/null
+++ b/sakia.spec
@@ -0,0 +1,41 @@
+# -*- mode: python -*-
+from PyInstaller.compat import is_darwin
+
+block_cipher = None
+
+a = Analysis(['src/sakia/main.py'],
+             pathex=['.'],
+             binaries=None,
+             datas=None,
+             hiddenimports=[],
+             hookspath=['hooks'],
+             runtime_hooks=[],
+             excludes=[],
+             win_no_prefer_redirects=False,
+             win_private_assemblies=False,
+             cipher=block_cipher)
+
+if is_darwin:
+    a.binaries = a.binaries - TOC([
+     ('/usr/local/lib/libsodium.so', None, None),])
+
+pyz = PYZ(a.pure, a.zipped_data,
+             cipher=block_cipher)
+
+exe = EXE(pyz,
+          a.scripts,
+          exclude_binaries=True,
+          name='sakia',
+          debug=True,
+          strip=False,
+          upx=True,
+          console=True )
+
+coll = COLLECT(exe,
+               a.binaries,
+               a.zipfiles,
+               a.datas,
+               strip=False,
+               upx=True,
+               name='sakia')
+
-- 
GitLab