mirror of
https://github.com/onionshare/onionshare.git
synced 2025-06-24 06:24:19 -04:00
Made sure switch to python3 and Qt5 works in OSX (#261). Updated OSX instructions in BUILD.md.
This commit is contained in:
parent
62c69c4c0b
commit
deac54db92
10 changed files with 54 additions and 37 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -6,6 +6,7 @@
|
||||||
# Packages
|
# Packages
|
||||||
*.egg
|
*.egg
|
||||||
*.egg-info
|
*.egg-info
|
||||||
|
*.eggs
|
||||||
dist
|
dist
|
||||||
deb_dist
|
deb_dist
|
||||||
build
|
build
|
||||||
|
|
38
BUILD.md
38
BUILD.md
|
@ -33,19 +33,43 @@ There is a PKBUILD available [here](https://aur.archlinux.org/packages/onionshar
|
||||||
|
|
||||||
## Mac OS X
|
## Mac OS X
|
||||||
|
|
||||||
Install the [latest python 2.x](https://www.python.org/downloads/) from python.org. If you use the built-in version of python that comes with OS X, your .app might not run on other people's computers.
|
Install Xcode from the Mac App Store. Once it's installed, run it for the first time to set it up.
|
||||||
|
|
||||||
To install the right dependencies, you need homebrew and pip installed on your Mac. Follow instructions at http://brew.sh/ to install homebrew, and run `sudo easy_install pip` to install pip.
|
Install the [latest Python 3.x from python.org](https://www.python.org/downloads/). If you use the built-in version of python that comes with OS X, your .app might not run on other people's computers.
|
||||||
|
|
||||||
The first time you're setting up your dev environment:
|
Download and install Qt5 from https://www.qt.io/download-open-source/. I downloaded `qt-unified-mac-x64-2.0.2-2-online.dmg`. There's no need to login to a Qt account during installation. Make sure you install the latest Qt 5.x for clang.
|
||||||
|
|
||||||
|
Download the source code for [SIP](http://www.riverbankcomputing.co.uk/software/sip/download) and [PyQt](http://www.riverbankcomputing.co.uk/software/pyqt/download5). I downloaded `sip-4.17.tar.gz` and `PyQt-gpl-5.5.1.tar.gz`.
|
||||||
|
|
||||||
|
Now extract the source code:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
echo export PYTHONPATH=\$PYTHONPATH:/usr/local/lib/python2.7/site-packages/ >> ~/.profile
|
tar xvf sip-4.17.tar.gz
|
||||||
source ~/.profile
|
tar xvf PyQt-gpl-5.5.1.tar.gz
|
||||||
brew install qt4 pyqt
|
|
||||||
sudo pip install py2app flask stem
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Compile SIP:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cd sip-4.17
|
||||||
|
python3 configure.py --arch x86_64
|
||||||
|
make
|
||||||
|
sudo make install
|
||||||
|
sudo make clean
|
||||||
|
```
|
||||||
|
|
||||||
|
Compile PyQt:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cd ../PyQt-gpl-5.5.1
|
||||||
|
python3 configure.py --qmake ~/Qt/5.5/clang_64/bin/qmake --sip /Library/Frameworks/Python.framework/Versions/3.5/bin/sip --disable=QtPositioning
|
||||||
|
make
|
||||||
|
sudo make install
|
||||||
|
sudo make clean
|
||||||
|
```
|
||||||
|
|
||||||
|
Finally, install some dependencies using pip3: `sudo pip3 install py2app flask stem`
|
||||||
|
|
||||||
Get the source code:
|
Get the source code:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|
|
@ -9,14 +9,14 @@ rm -rf $ROOT/dist &>/dev/null 2>&1
|
||||||
|
|
||||||
# build the .app
|
# build the .app
|
||||||
echo Building OnionShare.app
|
echo Building OnionShare.app
|
||||||
python setup.py py2app
|
python3 setup.py py2app
|
||||||
|
|
||||||
if [ "$1" = "--sign" ]; then
|
if [ "$1" = "--sign" ]; then
|
||||||
SIGNING_IDENTITY_APP="Developer ID Application: Micah Lee"
|
SIGNING_IDENTITY_APP="Developer ID Application: Micah Lee"
|
||||||
SIGNING_IDENTITY_INSTALLER="Developer ID Installer: Micah Lee"
|
SIGNING_IDENTITY_INSTALLER="Developer ID Installer: Micah Lee"
|
||||||
|
|
||||||
# codesign the .app
|
# codesign the .app
|
||||||
python $ROOT/install/prepare_for_codesign.py
|
python3 $ROOT/install/prepare_for_codesign.py
|
||||||
cd dist
|
cd dist
|
||||||
|
|
||||||
# for some reason --deep fails, so sign each binary individually
|
# for some reason --deep fails, so sign each binary individually
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
OnionShare | https://onionshare.org/
|
OnionShare | https://onionshare.org/
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
OnionShare | https://onionshare.org/
|
OnionShare | https://onionshare.org/
|
||||||
|
|
|
@ -10,11 +10,11 @@ import shutil
|
||||||
path_to_app = "dist/OnionShare.app"
|
path_to_app = "dist/OnionShare.app"
|
||||||
|
|
||||||
def move_func(file):
|
def move_func(file):
|
||||||
print "moving %s to %s " % (os.path.join(dir_name, file), os.path.join(dir_name, 'Versions', "Current"))
|
print("moving %s to %s " % (os.path.join(dir_name, file), os.path.join(dir_name, 'Versions', "Current")))
|
||||||
try:
|
try:
|
||||||
shutil.move(os.path.join(dir_name, file), os.path.join(dir_name, 'Versions', "Current"))
|
shutil.move(os.path.join(dir_name, file), os.path.join(dir_name, 'Versions', "Current"))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print e
|
print(e)
|
||||||
return file
|
return file
|
||||||
|
|
||||||
def filter_func(x):
|
def filter_func(x):
|
||||||
|
@ -29,7 +29,7 @@ for dir_name, subdir_list, file_list in os.walk(dir):
|
||||||
|
|
||||||
if p.match(dir_name_short):
|
if p.match(dir_name_short):
|
||||||
print('Found directory: %s' % dir_name_short)
|
print('Found directory: %s' % dir_name_short)
|
||||||
print file_list
|
print(file_list)
|
||||||
if os.path.islink(os.path.join(dir_name, file_list[0])):
|
if os.path.islink(os.path.join(dir_name, file_list[0])):
|
||||||
os.unlink(os.path.join(dir_name, file_list[0]))
|
os.unlink(os.path.join(dir_name, file_list[0]))
|
||||||
list(map(move_func, file_list[1:]))
|
list(map(move_func, file_list[1:]))
|
||||||
|
|
|
@ -66,9 +66,9 @@ def get_version():
|
||||||
if p == 'Linux':
|
if p == 'Linux':
|
||||||
version_filename = os.path.join(sys.prefix, 'share/onionshare/version')
|
version_filename = os.path.join(sys.prefix, 'share/onionshare/version')
|
||||||
elif p == 'Darwin':
|
elif p == 'Darwin':
|
||||||
version_filename = os.path.join(helpers.osx_resources_dir, 'version')
|
version_filename = os.path.join(osx_resources_dir, 'version')
|
||||||
else:
|
else:
|
||||||
version_filename = os.path.join(os.path.dirname(helpers.get_onionshare_dir()), 'version')
|
version_filename = os.path.join(os.path.dirname(get_onionshare_dir()), 'version')
|
||||||
return open(version_filename).read().strip()
|
return open(version_filename).read().strip()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,8 @@ def load_strings(default="en"):
|
||||||
abs_filename = os.path.join(locale_dir, filename)
|
abs_filename = os.path.join(locale_dir, filename)
|
||||||
lang, ext = os.path.splitext(filename)
|
lang, ext = os.path.splitext(filename)
|
||||||
if abs_filename.endswith('.json'):
|
if abs_filename.endswith('.json'):
|
||||||
translations[lang] = json.loads(open(abs_filename).read())
|
lang_json = open(abs_filename, encoding='utf-8').read()
|
||||||
|
translations[lang] = json.loads(lang_json)
|
||||||
|
|
||||||
strings = translations[default]
|
strings = translations[default]
|
||||||
lc, enc = locale.getdefaultlocale()
|
lc, enc = locale.getdefaultlocale()
|
||||||
|
|
|
@ -23,10 +23,6 @@ from PyQt5 import QtCore, QtWidgets, QtGui
|
||||||
|
|
||||||
from . import common
|
from . import common
|
||||||
|
|
||||||
try:
|
|
||||||
import onionshare
|
|
||||||
except ImportError:
|
|
||||||
sys.path.append(os.path.abspath(common.onionshare_gui_dir + "/.."))
|
|
||||||
import onionshare
|
import onionshare
|
||||||
from onionshare import strings, helpers, web
|
from onionshare import strings, helpers, web
|
||||||
|
|
||||||
|
@ -56,7 +52,7 @@ class Application(QtWidgets.QApplication):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class OnionShareGui(QtWidgets.QWidget):
|
class OnionShareGui(QtWidgets.QMainWindow):
|
||||||
"""
|
"""
|
||||||
OnionShareGui is the main window for the GUI that contains all of the
|
OnionShareGui is the main window for the GUI that contains all of the
|
||||||
GUI elements.
|
GUI elements.
|
||||||
|
@ -112,8 +108,9 @@ class OnionShareGui(QtWidgets.QWidget):
|
||||||
self.status_bar = QtWidgets.QStatusBar()
|
self.status_bar = QtWidgets.QStatusBar()
|
||||||
self.status_bar.setSizeGripEnabled(False)
|
self.status_bar.setSizeGripEnabled(False)
|
||||||
version_label = QtWidgets.QLabel('v{0:s}'.format(helpers.get_version()))
|
version_label = QtWidgets.QLabel('v{0:s}'.format(helpers.get_version()))
|
||||||
version_label.setStyleSheet('color: #666666;')
|
version_label.setStyleSheet('color: #666666; padding: 0 10px;')
|
||||||
self.status_bar.addPermanentWidget(version_label)
|
self.status_bar.addPermanentWidget(version_label)
|
||||||
|
self.setStatusBar(self.status_bar)
|
||||||
|
|
||||||
# main layout
|
# main layout
|
||||||
self.layout = QtWidgets.QVBoxLayout()
|
self.layout = QtWidgets.QVBoxLayout()
|
||||||
|
@ -122,8 +119,9 @@ class OnionShareGui(QtWidgets.QWidget):
|
||||||
self.layout.addWidget(self.filesize_warning)
|
self.layout.addWidget(self.filesize_warning)
|
||||||
self.layout.addLayout(self.downloads)
|
self.layout.addLayout(self.downloads)
|
||||||
self.layout.addLayout(self.options)
|
self.layout.addLayout(self.options)
|
||||||
self.layout.addWidget(self.status_bar)
|
central_widget = QtWidgets.QWidget()
|
||||||
self.setLayout(self.layout)
|
central_widget.setLayout(self.layout)
|
||||||
|
self.setCentralWidget(central_widget)
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
# check for requests frequently
|
# check for requests frequently
|
||||||
|
|
16
setup.py
16
setup.py
|
@ -106,7 +106,8 @@ elif system == 'Darwin':
|
||||||
data_files=[
|
data_files=[
|
||||||
('images', images),
|
('images', images),
|
||||||
('locale', locale),
|
('locale', locale),
|
||||||
('html', ['onionshare/index.html', 'onionshare/404.html'])
|
('html', ['onionshare/index.html', 'onionshare/404.html']),
|
||||||
|
('', ['version'])
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'py2app': {
|
'py2app': {
|
||||||
|
@ -114,17 +115,8 @@ elif system == 'Darwin':
|
||||||
'iconfile': 'install/onionshare.icns',
|
'iconfile': 'install/onionshare.icns',
|
||||||
'extra_scripts': ['install/osx_scripts/onionshare'],
|
'extra_scripts': ['install/osx_scripts/onionshare'],
|
||||||
'includes': [
|
'includes': [
|
||||||
'PyQt4', 'PyQt4.QtCore', 'PyQt4.QtGui',
|
'PyQt5', 'PyQt5.QtCore', 'PyQt5.QtGui', 'PyQt5.QtWidgets',
|
||||||
'jinja2', 'jinja2.ext', 'jinja2.ext.autoescape'],
|
'jinja2', 'jinja2.ext', 'jinja2.ext.autoescape', 'sip']
|
||||||
'excludes': [
|
|
||||||
'PyQt4.QtDesigner', 'PyQt4.QtNetwork',
|
|
||||||
'PyQt4.QtOpenGL', 'PyQt4.QtScript',
|
|
||||||
'PyQt4.QtSql', 'PyQt4.QtTest',
|
|
||||||
'PyQt4.QtWebKit', 'PyQt4.QtXml',
|
|
||||||
'PyQt4.phonon', 'PyQt4.QtDeclarative',
|
|
||||||
'PyQt4.QtHelp', 'PyQt4.QtMultimedia',
|
|
||||||
'PyQt4.QtScript', 'PyQt4.QtScriptTools',
|
|
||||||
'PyQt4.QtSvg', 'PyQt4.QtXmlPatterns']
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setup_requires=['py2app', 'flask', 'stem'],
|
setup_requires=['py2app', 'flask', 'stem'],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue