Skip to content

Commit

Permalink
Updating OSX packaging script
Browse files Browse the repository at this point in the history
-Adding a shell script to build a distributable app for OSX.
-Updating py2app script to use icon, set title etc.
-Removing build generated files from repo and ignoring in .gitignore.
-Couple of minor issues on OSX.
--multiprocessing.Queue.qwait isn't implemented for some unix platforms, so using multiprocessing.Queue.empty instead.
--use correct path on OSX to load images.
  • Loading branch information
cvanes committed Nov 30, 2013
1 parent 806c9dc commit a8ff71e
Show file tree
Hide file tree
Showing 14 changed files with 84 additions and 628 deletions.
3 changes: 2 additions & 1 deletion .gitignore
@@ -1 +1,2 @@
*.pyc
*.pyc
osx_build/
10 changes: 10 additions & 0 deletions packaging_scripts/buildOSXApp.sh
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

cd plumbing
python py2app_setup.py py2app

# workaround for now to strip out 64 bit libs as wxPython only supports 32 bit
cd ../../osx_dist
mv PythonTurtle.app PythonTurtle64.app
ditto --rsrc --arch i386 PythonTurtle64.app PythonTurtle.app
rm -rf PythonTurtle64.app
22 changes: 22 additions & 0 deletions packaging_scripts/plumbing/osx_resources/Info.plist
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>PythonTurtle</string>
<key>CFBundleExecutable</key>
<string>PythonTurtle</string>
<key>CFBundleIdentifier</key>
<string>org.pythonmac.unspecified.pythonturtle</string>
<key>CFBundleName</key>
<string>PythonTurtle</string>
<key>CFBundleShortVersionString</key>
<string>0.1</string>
<key>CFBundleVersion</key>
<string>0.1</string>
<key>LSArchitecturePriority</key>
<array>
<string>i386</string>
</array>
</dict>
</plist>
37 changes: 28 additions & 9 deletions packaging_scripts/plumbing/py2app_setup.py
Expand Up @@ -2,18 +2,37 @@
This is a setup.py script generated by py2applet
Usage:
python setup.py py2app
python py2app_setup.py py2app
"""

import os
from setuptools import setup
from pythonturtlebuildtools import smart_join, data_files

APP = ['pythonturtle.py']
DATA_FILES = []
OPTIONS = {'argv_emulation': True}
cwd = os.getcwd()
root_dir = smart_join(cwd, "..", "..")
src_dir = smart_join(root_dir, "src")
build_dir = smart_join(cwd, "osx_build")
dist_dir = smart_join(root_dir, "osx_dist")
resources_dir = smart_join(src_dir, "resources")
osx_resources_dir = smart_join(cwd, "osx_resources")
path_to_script = smart_join(src_dir, "pythonturtle.py")
path_to_icon = smart_join(resources_dir, "icon.icns")
path_to_plist = smart_join(osx_resources_dir, "Info.plist")

py2app_options = {
'arch': 'i386',
'argv_emulation': True,
'bdist_base': build_dir,
'dist_dir': dist_dir,
'iconfile': path_to_icon,
'includes': 'wx',
'plist': path_to_plist,
}

setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)
app=[path_to_script],
data_files=data_files(resources_dir),
options={'py2app': py2app_options},
setup_requires=['py2app', 'wxPython'],
)
15 changes: 15 additions & 0 deletions packaging_scripts/plumbing/pythonturtlebuildtools.py
@@ -0,0 +1,15 @@
import os

def smart_join(*args):
temp = os.path.join(*args)
optimized = os.path.realpath(temp)
return str(optimized) # to convert from unicode to ascii

def data_files(resources_dir):
data_files=[]
for file in os.listdir(resources_dir):
f1 = smart_join(resources_dir, file)
if os.path.isfile(f1): # skip directories
f2 = 'resources', [f1]
data_files.append(f2)
return data_files
97 changes: 0 additions & 97 deletions src/dist/pythonturtle.app/Contents/Info.plist

This file was deleted.

Binary file not shown.
1 change: 0 additions & 1 deletion src/dist/pythonturtle.app/Contents/PkgInfo

This file was deleted.

137 changes: 0 additions & 137 deletions src/dist/pythonturtle.app/Contents/Resources/__boot__.py

This file was deleted.

16 changes: 0 additions & 16 deletions src/dist/pythonturtle.app/Contents/Resources/__error__.sh

This file was deleted.

0 comments on commit a8ff71e

Please sign in to comment.