Embed PySide2 as default Qt binding

This commit is contained in:
albertosottile 2018-05-07 18:50:23 +02:00
commit 1f696c5014
8 changed files with 77 additions and 107 deletions

View File

@ -9,7 +9,9 @@ init:
- set PATH=C:\Miniconda;C:\Miniconda\Scripts;C:\Program Files (x86)\NSIS;%PATH%
- conda create -n syncplay -y
- activate syncplay
- conda install python pywin32 pyside -y
- conda install python=2.7.13 -y
- conda install pywin32 -y
- conda install -c conda-forge pyside2 -y
- pip install twisted py2exe_py2 zope.interface
- type nul > C:\Miniconda\envs\syncplay\lib\site-packages\zope\__init__.py
- pip freeze
@ -19,17 +21,22 @@ install:
- cd %APPVEYOR_BUILD_FOLDER%
- for /F "tokens=2 delims='" %%a in ('findstr version syncplay\__init__.py') do @set ver=%%a
- python buildPy2exe.py
- del syncplay_v%ver%\lib\api-*
- del syncplay_v%ver%\lib\DNSAPI.dll
- del syncplay_v%ver%\lib\IPHLPAPI.dll
- del syncplay_v%ver%\lib\MPR.dll
- mkdir syncplay_v%ver%\platforms
#- copy C:\Miniconda\envs\syncplay\library\plugins\platforms\qwindows.dll C:\projects\syncplay\syncplay_v1.5.0\platforms\
- copy C:\Miniconda\envs\syncplay\library\plugins\platforms\qwindows.dll syncplay_v%ver%\platforms\
- type nul > syncplay_v%ver%\syncplay.ini
- copy resources\win_lua_note.txt syncplay_v%ver%\"VLC LUA Script installation.txt"
# Not a project with an msbuild file, build done at install.
build: off
build: off
artifacts:
- path: 'syncplay_v$(ver)'
type: zip
name: Syncplay-$(ver)-win
name: Syncplay_v$(ver)_Portable
- path: Syncplay-$(ver)-Setup.exe
name: Syncplay-$(ver)-win-setup
@ -37,6 +44,7 @@ artifacts:
# Push artefact to S3 bucket and list all
before_deploy:
- dir
- dir syncplay_v%ver%
#- python -c "from PySide2 import QtCore; print QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.PluginsPath)"

View File

@ -1,25 +1,37 @@
language: objective-c
osx_image: xcode6.4
osx_image: xcode7.3
branches:
only:
- master_local
script:
- python2 buildPy2app.py py2app fix
- python buildPy2app.py py2app
before_install:
- brew update
- travis/download-homebrew
- export PATH="/usr/local/opt/python@2/bin:$PATH"
- travis/download-python
- brew tap cartr/qt4
- brew tap-pin cartr/qt4
- brew install pyside
- curl -O http://syncplay.s3.amazonaws.com/qt595.rb
- mv qt595.rb qt.rb
- brew install ./qt.rb
- which python
- which pip
- curl -L https://bintray.com/alby128/Syncplay/download_file?file_path=PySide2-5.9.0a1-5.9.5-cp27-cp27m-macosx_10_11_x86_64.whl -o PySide2-5.9.0a1-5.9.5-cp27-cp27m-macosx_10_11_x86_64.whl
- pip install PySide2-5.9.0a1-5.9.5-cp27-cp27m-macosx_10_11_x86_64.whl
- ln -s /usr/local/lib/python2.7/site-packages/PySide2/libshiboken2-python2.7v.5.9.dylib /usr/local/lib/
- ln -s /usr/local/lib/python2.7/site-packages/PySide2/libpyside2-python2.7v.5.9.dylib /usr/local/lib/
#- python -c "from PySide2 import QtCore"
- python -c "from PySide2.QtCore import __version__; print __version__"
- hg clone https://alby128@bitbucket.org/alby128/py2app
- cd py2app
- python setup.py install
- cd ..
- python -c "from py2app.recipes import pyside2"
install:
- export QT_PREFERRED_BINDING="PySide"
- pip2 install twisted appnope pyobjc py2app
- pip install twisted appnope
#- git clone -b qtpy-pyside2 https://github.com/alby128/syncplay.git syncplay-qtpy-PySide2
#- cd syncplay-qtpy-PySide2
#- git checkout qtpy-pyside2
before_deploy:
#- travis/cache-homebrew
@ -29,7 +41,7 @@ before_deploy:
- mv resources/lua/intf/syncplay.lua resources/lua/intf/.syncplay.lua
- mv resources/macOS_readme.pdf resources/.macOS_readme.pdf
- export VER="$(cat syncplay/__init__.py | awk '/version/ {gsub("\047", "", $3); print $NF}')"
- dmgbuild -s appdmg.py "Syncplay" dist_dmg/Syncplay_${VER}_macOS.dmg
- dmgbuild -s appdmg.py "Syncplay" dist_dmg/Syncplay_${VER}.dmg
deploy:
skip_cleanup: true

View File

@ -5,21 +5,20 @@ Usage:
python setup.py py2app
"""
from setuptools import setup, Command
from setuptools import setup
from glob import glob
import shutil
import syncplay
cmdlist = {}
APP = ['syncplayClient.py']
DATA_FILES = [
('resources', glob('resources/*.png') + glob('resources/*.rtf') + glob('resources/*.lua')),
]
OPTIONS = {
'iconfile':'resources/icon.icns',
'includes': {'PySide.QtCore', 'PySide.QtUiTools', 'PySide.QtGui'},
'plist': {
'includes': {'PySide2.QtCore', 'PySide2.QtUiTools', 'PySide2.QtGui','PySide2.QtWidgets'},
'excludes': {'PySide', 'PySide.QtCore', 'PySide.QtUiTools', 'PySide.QtGui'},
'qt_plugins': ['platforms/libqcocoa.dylib', 'platforms/libqminimal.dylib','platforms/libqoffscreen.dylib'],
'plist': {
'CFBundleName':'Syncplay',
'CFBundleShortVersionString':syncplay.version,
'CFBundleIdentifier':'pl.syncplay.Syncplay',
@ -27,32 +26,10 @@ OPTIONS = {
}
}
class Fix(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def trim_packages(self):
"""Remove big files in external dependencies that Syncplay doesn't need"""
shutil.rmtree('dist/Syncplay.app/Contents/Frameworks/QtDesigner.framework', ignore_errors=True)
shutil.rmtree('dist/Syncplay.app/Contents/Frameworks/QtScript.framework', ignore_errors=True)
shutil.rmtree('dist/Syncplay.app/Contents/Frameworks/QtXml.framework', ignore_errors=True)
def run(self):
self.trim_packages()
cmdlist['fix'] = Fix
setup(
app=APP,
name='Syncplay',
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
cmdclass=cmdlist
)

View File

@ -720,9 +720,9 @@ info = dict(
# console=['syncplayServer.py', {"script":"syncplayClient.py", "icon_resources":[(1, "resources\\icon.ico")], 'dest_base': "Syncplay"}],
options={'py2exe': {
'dist_dir': OUT_DIR,
'packages': 'PySide.QtUiTools',
'includes': 'twisted, sys, encodings, datetime, os, time, math, PySide, liburl, ast, unicodedata',
'excludes': 'venv, doctest, pdb, unittest, win32clipboard, win32file, win32pdh, win32security, win32trace, win32ui, winxpgui, win32pipe, win32process, Tkinter',
'packages': 'PySide2.QtUiTools',
'includes': 'twisted, sys, encodings, datetime, os, time, math, PySide2, liburl, ast, unicodedata',
'excludes': 'venv, _ssl, doctest, pdb, unittest, win32clipboard, win32file, win32pdh, win32security, win32trace, win32ui, winxpgui, win32pipe, win32process, Tkinter',
'dll_excludes': 'msvcr71.dll, MSVCP90.dll, POWRPROF.dll',
'optimize': 2,
'compressed': 1
@ -733,5 +733,5 @@ info = dict(
cmdclass = {"py2exe": build_installer},
)
sys.argv.extend(['py2exe', '-p win32com ', '-i twisted.web.resource', '-p PySide.QtGui'])
sys.argv.extend(['py2exe', '-p win32com ', '-i twisted.web.resource', '-i PySide2.QtCore', '-p PySide2.QtGui', '-i PySide2.QtWidgets'])
setup(**info)

View File

@ -24,26 +24,25 @@ The above copyright notice and this permission notice shall be included in all\
copies or substantial portions of the Software.\
\
\b PySide\
\b Qt for Python\
\b0 \
Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).\
Contact: PySide team <contact@pyside.org>\
Copyright (C) 2018 The Qt Company Ltd.\
Contact: https://www.qt.io/licensing/\
\
This library is free software; you can redistribute it and/or\
modify it under the terms of the GNU Lesser General Public\
License as published by the Free Software Foundation; either\
version 2.1 of the License, or (at your option) any later version.\
This library is distributed in the hope that it will be useful,\
This program is free software: you can redistribute it and/or modify\
it under the terms of the GNU Lesser General Public License as published\
by the Free Software Foundation, either version 3 of the License, or\
(at your option) any later version.\
\
This program is distributed in the hope that it will be useful,\
but WITHOUT ANY WARRANTY; without even the implied warranty of\
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\
Lesser General Public License for more details.\
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\
GNU Lesser General Public License for more details.\
\
You should have received a copy of the GNU Lesser General Public License\
along with this program. If not, see <http://www.gnu.org/licenses/>.\
\
\pard\pardeftab720\partightenfactor0
\cf0 You should have received a copy of the GNU Lesser General Public License\
along with this program. If not, see <http://www.gnu.org/licenses/>\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0
\cf0 \
\b Twisted\
\
@ -113,27 +112,6 @@ The above copyright notice and this permission notice shall be\
included in all copies or substantial portions of the Software.\
\b \
Qt 4\
\
\b0 Copyright (C) 2015 The Qt Company Ltd.\
Contact: http://www.qt.io/licensing/\
\
This library is free software; you can redistribute it and/or\
modify it under the terms of the GNU Lesser General Public\
License as published by the Free Software Foundation; either\
version 2.1 of the License, or (at your option) any later version.\
This library is distributed in the hope that it will be useful,\
but WITHOUT ANY WARRANTY; without even the implied warranty of\
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\
Lesser General Public License for more details.\
\
\pard\pardeftab720\partightenfactor0
\cf0 You should have received a copy of the GNU Lesser General Public License\
along with this program. If not, see <http://www.gnu.org/licenses/>\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0
\b \cf0 \
appnope\
\b0 \
@ -157,17 +135,6 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\
\b \
PyObjC\
\b0 \
Copyright 2002, 2003 - Bill Bumgarner, Ronald Oussoren, Steve Majewski, Lele Gaifax, et.al.\
Copyright 2003-2016 - Ronald Oussoren\
\
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\
\
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\
\
\b py2exe\

6
resources/win_lua_note.txt Executable file
View File

@ -0,0 +1,6 @@
You must follow the following instructions to use Syncplay with VLC:
Place the syncplay.lua file from /resources/lua/intf/ into the main (all user) VLC /lua/intf/ sub-directory:
* Window: %ProgramFiles%\VideoLAN\VLC\lua\intf\
Note: A version of these instructions is also available from http://syncplay.pl/LUA

View File

@ -1,4 +1,4 @@
version = '1.5.3'
version = '1.5.4'
milestone = 'Yoitsu'
release_number = '61'
release_number = '62'
projectURL = 'https://syncplay.pl/'

View File

@ -467,17 +467,17 @@ class ConfigurationGetter(object):
self._overrideConfigWithArgs(args)
if not self._config['noGui']:
try:
from syncplay.vendor.Qt import QtWidgets, IsPySide, IsPySide2
from syncplay.vendor.Qt.QtCore import QCoreApplication
from syncplay.vendor import qt5reactor
if not (IsPySide2 or IsPySide):
raise ImportError
if QCoreApplication.instance() is None:
self.app = QtWidgets.QApplication(sys.argv)
qt5reactor.install()
if isMacOS():
import appnope
appnope.nope()
from syncplay.vendor.Qt import QtWidgets, IsPySide, IsPySide2
from syncplay.vendor.Qt.QtCore import QCoreApplication
from syncplay.vendor import qt5reactor
if not (IsPySide2 or IsPySide):
raise ImportError
if QCoreApplication.instance() is None:
self.app = QtWidgets.QApplication(sys.argv)
qt5reactor.install()
if isMacOS():
import appnope
appnope.nope()
except ImportError:
print getMessage("unable-import-gui-error")
self._config['noGui'] = True