Skip to content

Commit 848ccdd

Browse files
committed
many fixes. most importantly:
1. switching to brew's python, since it includes necessary header files (python-dev equivalents in debian) 2. pyinstaller is a case-sensitive module. It must be PyInstaller 3. --build-bottles causes an error. Documenation fail * https://kivy.org/doc/stable/guide/packaging-osx.html 4. I had to also add the hidden import for 'pkg_resources.py2_warn'. This appears to be a bug in the later versions of PyInstaller -- I also fixed it in Windows here: * https://github.com/maltfield/cross-platform-python-gui/blob/master/build/windows/buildExe.ps1#L85
1 parent 6c4c806 commit 848ccdd

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

build/mac/buildDmg.sh

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ set -x
2020
# SETTINGS #
2121
############
2222

23-
PYTHON_PATH='/usr/bin/python3'
23+
PYTHON_PATH='/usr/local/bin/python3'
2424
APP_NAME='helloWorld'
2525

2626
PYTHON_VERSION="`${PYTHON_PATH} --version | cut -d' ' -f2`"
@@ -62,8 +62,12 @@ md5 /usr/local/bin/python*
6262
# INSTALL DEPENDS #
6363
###################
6464

65+
# first update brew
66+
# * https://blog.fossasia.org/deploying-a-kivy-application-with-pyinstaller-for-mac-osx-to-github/
67+
brew update
68+
6569
# install os-level depends
66-
brew install wget
70+
brew install wget python3
6771
#brew reinstall --build-bottle sdl2 sdl2_image sdl2_ttf sdl2_mixer
6872
brew reinstall sdl2 sdl2_image sdl2_ttf sdl2_mixer
6973

@@ -75,8 +79,9 @@ ${PYTHON_PATH} -m pip install --upgrade --user pip setuptools
7579

7680
# install kivy and all other python dependencies with pip into our virtual env
7781
#source /tmp/kivy_venv/bin/activate
78-
${PYTHON_PATH} -m pip install Cython==0.29.10
79-
${PYTHON_PATH} -m pip install -r requirements.txt
82+
${PYTHON_PATH} -m pip install --upgrade --user Cython==0.29.10
83+
${PYTHON_PATH} -m pip install --upgrade --user -r requirements.txt
84+
${PYTHON_PATH} -m pip install --upgrade --user PyInstaller
8085

8186
#######################
8287
# PREPARE PYINSTALLER #
@@ -86,7 +91,8 @@ mkdir pyinstaller
8691
pushd pyinstaller
8792

8893
# TODO: change this to cat
89-
pyinstaller -y --clean --windowed --name ${APP_NAME} \
94+
${PYTHON_PATH} -m PyInstaller -y --clean --windowed --name ${APP_NAME} \
95+
--hidden-import 'pkg_resources.py2_warn' \
9096
--exclude-module _tkinter \
9197
--exclude-module Tkinter \
9298
--exclude-module enchant \
@@ -97,7 +103,7 @@ pyinstaller -y --clean --windowed --name ${APP_NAME} \
97103
# BUILD #
98104
#########
99105

100-
pyinstaller -y --clean --windowed ${APP_NAME}.spec
106+
#pyinstaller -y --clean --windowed ${APP_NAME}.spec
101107

102108
pushd dist
103109
hdiutil create ./${APP_NAME}.dmg -srcfolder ${APP_NAME}.app -ov

0 commit comments

Comments
 (0)