Skip to content

Commit

Permalink
many fixes. most importantly:
Browse files Browse the repository at this point in the history
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
  • Loading branch information
maltfield committed Jun 22, 2020
1 parent 6c4c806 commit 848ccdd
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions build/mac/buildDmg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ set -x
# SETTINGS #
############

PYTHON_PATH='/usr/bin/python3'
PYTHON_PATH='/usr/local/bin/python3'
APP_NAME='helloWorld'

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

# first update brew
# * https://blog.fossasia.org/deploying-a-kivy-application-with-pyinstaller-for-mac-osx-to-github/
brew update

# install os-level depends
brew install wget
brew install wget python3
#brew reinstall --build-bottle sdl2 sdl2_image sdl2_ttf sdl2_mixer
brew reinstall sdl2 sdl2_image sdl2_ttf sdl2_mixer

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

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

#######################
# PREPARE PYINSTALLER #
Expand All @@ -86,7 +91,8 @@ mkdir pyinstaller
pushd pyinstaller

# TODO: change this to cat
pyinstaller -y --clean --windowed --name ${APP_NAME} \
${PYTHON_PATH} -m PyInstaller -y --clean --windowed --name ${APP_NAME} \
--hidden-import 'pkg_resources.py2_warn' \
--exclude-module _tkinter \
--exclude-module Tkinter \
--exclude-module enchant \
Expand All @@ -97,7 +103,7 @@ pyinstaller -y --clean --windowed --name ${APP_NAME} \
# BUILD #
#########

pyinstaller -y --clean --windowed ${APP_NAME}.spec
#pyinstaller -y --clean --windowed ${APP_NAME}.spec

pushd dist
hdiutil create ./${APP_NAME}.dmg -srcfolder ${APP_NAME}.app -ov
Expand Down

0 comments on commit 848ccdd

Please sign in to comment.