OSX version still needs a bit of work, but completely works now (#43)

This commit is contained in:
Micah Lee 2014-06-19 22:05:56 -07:00
parent 31ec0c11d5
commit a464b6fe1d
5 changed files with 33 additions and 13 deletions

1
.gitignore vendored
View file

@ -16,6 +16,7 @@ sdist
develop-eggs
.installed.cfg
MANIFEST
env
# Installer logs
pip-log.txt

View file

@ -23,24 +23,28 @@ Note that python-stem appears in Debian wheezy and newer (so by extension Tails
## Mac OS X
*Note: This is a work-in-progress. The OnionShare GUI doesn't yet work in Mac OS X. See https://github.com/micahflee/onionshare/issues/43 for progress.*
The first time you're setting up your dev environment:
Get a copy of the source code:
echo export PYTHONPATH=\$PYTHONPATH:/usr/local/lib/python2.7/site-packages/ >> ~/.profile
source ~/.profile
brew install qt4 pyqt
virtualenv env
. env/bin/activate
pip install flask stem py2app
# fixes a silly bug https://bitbucket.org/ronaldoussoren/py2app/issue/143/resulting-app-mistakenly-looks-for-pyside
patch env/lib/python2.7/site-packages/py2app/util.py < setup/py2app.patch
git clone https://github.com/micahflee/onionshare.git
cd onionshare
Each time you start work:
Install py2app (if you don't have pip installed, you can `sudo easy_install pip`):
. env/bin/activate
sudo pip install py2app
Then build the .app:
Build the .app:
python setup.py py2app
Now you'll see `dist/OnionShare.app` with a nice icon. However, it won't run yet.
Now you should have `dist/OnionShare.app`.
## Windows
*Note: Haven't started figuring this out yet.*
*Coming soon.*

View file

@ -20,19 +20,22 @@ version = open('version').read().strip()
args = {}
if platform.system() == 'Darwin':
args['data_files'] = ['LICENSE', 'README.md', 'BUILD.md', 'version', 'onionshare', 'onionshare_gui']
args['app'] = ['setup/onionshare_osx.py']
args['data_files'] = ['LICENSE', 'README.md', 'version']
args['app'] = ['setup/onionshare-launcher.py']
args['options'] = {
'py2app': {
'argv_emulation': True,
'packages': ['flask', 'stem', 'jinja2', 'onionshare_gui', 'onionshare'],
'includes': ['PyQt4'],
'excludes': ['PyQt4.QtDesigner', 'PyQt4.QtOpenGL', 'PyQt4.QtScript', 'PyQt4.QtSql', 'PyQt4.QtTest', 'PyQt4.QtXml', 'PyQt4.phonon'],
'iconfile': 'setup/onionshare.icns',
'packages': ['flask', 'stem'],
'site_packages': True,
'plist': {
'CFBundleName': 'OnionShare',
}
}
}
args['setup_requires'] = 'py2app'
elif platform.system() == 'Windows':
pass

12
setup/py2app.patch Normal file
View file

@ -0,0 +1,12 @@
--- original-util.py 2014-06-17 12:50:15.000000000 -0700
+++ util.py 2014-06-17 12:51:33.000000000 -0700
@@ -148,6 +148,9 @@
log.info("copying file %s -> %s", source, destination)
with zipio.open(source, 'rb') as fp_in:
if not dry_run:
+ if os.path.exists(destination):
+ os.unlink(destination)
+
with open(destination, 'wb') as fp_out:
data = fp_in.read()
fp_out.write(data)