Skip to content

Commit

Permalink
packaging: qt5 & pyface/traitsui 6 updates
Browse files Browse the repository at this point in the history
  • Loading branch information
bpteague committed Jul 17, 2018
1 parent ae3d279 commit 2fbf490
Show file tree
Hide file tree
Showing 27 changed files with 316 additions and 51 deletions.
3 changes: 3 additions & 0 deletions hook-pyface.py
@@ -0,0 +1,3 @@
from PyInstaller.utils.hooks import copy_metadata
datas = copy_metadata('pyface') + copy_metadata('traitsui')

3 changes: 3 additions & 0 deletions hook-traitsui.py
@@ -0,0 +1,3 @@
from PyInstaller.utils.hooks import copy_metadata
datas = copy_metadata('traitsui') + copy_metadata('pyface')

Empty file added packaging/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion packaging/hook-matplotlib.backends.py
@@ -1,7 +1,7 @@
# This apes hook-matplotlib.backends.py, but REMOVES backends, all but
# the ones in the list below.

KEEP = ["Qt4Agg", "pdf", "svg", "agg"]
KEEP = ["Qt5Agg", "pdf", "svg", "agg"]

from PyInstaller.compat import is_darwin
from PyInstaller.utils.hooks import (
Expand Down
15 changes: 2 additions & 13 deletions packaging/hook-pyface.py
@@ -1,14 +1,3 @@
# from PyInstaller.compat import is_darwin
from PyInstaller.utils.hooks import (logger, collect_data_files,
collect_submodules)
import os

# get some missing datas and dynamically loaded submodules
datas = collect_data_files('pyface', 'images')
hiddenimports = collect_submodules("pyface")
#
# hiddenimports = collect_submodules("pyface", subdir = os.path.join("ui", "qt4"))
# hiddenimports.extend(collect_submodules("pyface", subdir = os.path.join("ui", "qt4", "action")))
# hiddenimports.extend(collect_submodules("pyface", subdir = os.path.join("ui", "qt4", "tasks")))

from PyInstaller.utils.hooks import copy_metadata
datas = copy_metadata('pyface')

3 changes: 3 additions & 0 deletions packaging/hook-traits.py
@@ -0,0 +1,3 @@
from PyInstaller.utils.hooks import copy_metadata
datas = copy_metadata('traits')

3 changes: 3 additions & 0 deletions packaging/hook-traitsui.py
@@ -0,0 +1,3 @@
from PyInstaller.utils.hooks import copy_metadata
datas = copy_metadata('traitsui')

40 changes: 28 additions & 12 deletions packaging/pyinstaller.spec
Expand Up @@ -11,31 +11,47 @@ a = Analysis(['../cytoflowgui/run.py'],
('../cytoflowgui/view_plugins/images', 'cytoflowgui/view_plugins/images'),
('../cytoflowgui/help', 'cytoflowgui/help')],
hiddenimports = [
'packaging.qt',
'matplotlib.backends.backend_qt4agg',
'packaging.qt', 'traitsui.qt4',
'pyface.ui', 'pyface.ui.qt4', 'pyface.ui.qt4.init',
'pyface.ui.qt4.action', 'pyface.ui.qt4.tasks',
'PyQt5.QtCore', 'PyQt5.QtGui', 'PyQt5.QtWidgets',
'PyQt5.QtWebKit', 'PyQt5.QtWebKitWidgets',
'PyQt5.QtWebEngine', 'PyQt5.QtWebEngineWidgets',
# 'PyQt5', 'PyQt5.QtCore', 'PyQt5.QtDBus',
# 'PyQt5.QtGui', 'PyQt5.QtNetwork', 'PyQt5.QtSensors',
# 'PyQt5.QtSerialPort', 'PyQt5.QtMultimedia',
# 'PyQt5.QtQml', 'PyQt5.QtWidgets', 'PyQt5.QtXml',
# 'PyQt5.QtXmlPatterns', 'PyQt5.QtDesigner',
# 'PyQt5.QtHelp', 'PyQt5.QtMultimediaWidgets',
# 'PyQt5.QtOpenGL', 'PyQt5.QtPrintSupport',
# 'PyQt5.QtQuick', 'PyQt5.QtSql', 'PyQt5.QtTest',
# 'PyQt5.QtBluetooth', 'PyQt5.QtPositioning',
# 'PyQt5.QtX11Extras', 'PyQt5.QtQuickWidgets',
# 'PyQt5.QtWebSockets', 'PyQt5.QtWebChannel',
# 'PyQt5.QtWebEngineCore', 'PyQt5.QtWebEngineWidgets',
# 'PyQt5.QtWebEngine', 'PyQt5.QtLocation', 'PyQt5.QtNfc',
# 'PyQt5.Qt',
'matplotlib.backends.backend_qt5agg',
'matplotlib_backend',
'sklearn.neighbors.ball_tree',
'sklearn.neighbors.kd_tree',
'sklearn.neighbors.dist_metrics',
'sklearn.neighbors.typedefs'
],
hookspath=['packaging'],
runtime_hooks=['packaging/rthook_pyqt4.py',
'packaging/rthook_qtapi.py',
runtime_hooks=['packaging/rthook_qtapi.py',
'packaging/rthook_override_pyface_qt.py',
'packaging/rthook_seaborn.py'],
'packaging/rthook_seaborn.py'
],
excludes=['gi.repository.Gio', 'gi.repository.GModule',
'gi.repository.GObject', 'gi.repository.Gtk',
'gi.repository.Gdk', 'gi.repository.Atk',
'gi.repository.cairo', 'gi.repository.GLib',
'gobject', 'Tkinter', 'FixTk', 'PyQt5',
'gobject', 'Tkinter', 'FixTk',
'PySide', 'PySide.QtCore', 'PySide.QtGui',
'PySide.QtNetwork', 'PySide.QtSvg',
'pyface.wx', 'traitsui.wx', 'OpenGL',
'OpenGL.GLUT', 'OpenGL.platform',
'IPython', 'PyQt4.QtAssistant',
'PyQt4.QtSql', 'PyQt4.QtTest',
'PyQt4.QtOpenGL', 'wx',
'pyface.wx', 'traitsui.wx',
'IPython','wx',
'gtk', 'gi', 'sphinx', 'twisted', 'zope',
'jinja2', 'httplib2', '_mysql',
'sqlalchemy'],
Expand Down Expand Up @@ -69,7 +85,7 @@ exe = EXE(pyz,
a.binaries,
a.zipfiles,
a.datas,
# [ ('v', None, 'OPTION') ], # enable for more verbosity on starup
[ ('v', None, 'OPTION') ], # enable for more verbosity on starup
name='cytoflow',
debug=False,
strip=False,
Expand Down
19 changes: 19 additions & 0 deletions packaging/qt.old/QtCore.py
@@ -0,0 +1,19 @@
from . import qt_api

if qt_api == 'pyqt':
from PyQt4.QtCore import *

from PyQt4.QtCore import pyqtProperty as Property
from PyQt4.QtCore import pyqtSignal as Signal
from PyQt4.QtCore import pyqtSlot as Slot
from PyQt4.QtCore import QCoreApplication

__version__ = QT_VERSION_STR
__version_info__ = tuple(map(int, QT_VERSION_STR.split('.')))

else:
try:
from PySide import __version__, __version_info__
except ImportError:
pass
from PySide.QtCore import *
7 changes: 7 additions & 0 deletions packaging/qt.old/QtGui.py
@@ -0,0 +1,7 @@
from . import qt_api

if qt_api == 'pyqt':
from PyQt4.QtGui import *

else:
from PySide.QtGui import *
7 changes: 7 additions & 0 deletions packaging/qt.old/QtNetwork.py
@@ -0,0 +1,7 @@
from . import qt_api

if qt_api == 'pyqt':
from PyQt4.QtNetwork import *

else:
from PySide.QtNetwork import *
7 changes: 7 additions & 0 deletions packaging/qt.old/QtOpenGL.py
@@ -0,0 +1,7 @@
from . import qt_api

if qt_api == 'pyqt':
from PyQt4.QtOpenGL import *

else:
from PySide.QtOpenGL import *
7 changes: 7 additions & 0 deletions packaging/qt.old/QtScript.py
@@ -0,0 +1,7 @@
from . import qt_api

if qt_api == 'pyqt':
from PyQt4.QtScript import *

else:
from PySide.QtScript import *
7 changes: 7 additions & 0 deletions packaging/qt.old/QtSvg.py
@@ -0,0 +1,7 @@
from . import qt_api

if qt_api == 'pyqt':
from PyQt4.QtSvg import *

else:
from PySide.QtSvg import *
7 changes: 7 additions & 0 deletions packaging/qt.old/QtTest.py
@@ -0,0 +1,7 @@
from . import qt_api

if qt_api == 'pyqt':
from PyQt4.QtTest import *

else:
from PySide.QtTest import *
7 changes: 7 additions & 0 deletions packaging/qt.old/QtWebKit.py
@@ -0,0 +1,7 @@
from . import qt_api

if qt_api == 'pyqt':
from PyQt4.QtWebKit import *

else:
from PySide.QtWebKit import *
39 changes: 39 additions & 0 deletions packaging/qt.old/__init__.py
@@ -0,0 +1,39 @@
#------------------------------------------------------------------------------
# Copyright (c) 2010, Enthought Inc
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.

#
# Author: Enthought Inc
# Description: Qt API selector. Can be used to switch between pyQt and PySide
#------------------------------------------------------------------------------

import os

def prepare_pyqt4():
# Set PySide compatible APIs.
import sip
sip.setapi('QString', 2)
sip.setapi('QVariant', 2)

qt_api = os.environ.get('QT_API')

if qt_api is None:
try:
import PySide
qt_api = 'pyside'
except ImportError:
try:
prepare_pyqt4()
import PyQt4
qt_api = 'pyqt'
except ImportError:
raise ImportError('Cannot import PySide or PyQt4')

elif qt_api == 'pyqt':
prepare_pyqt4()

elif qt_api != 'pyside':
raise RuntimeError("Invalid Qt API %r, valid values are: 'pyqt' or 'pyside'"
% qt_api)
20 changes: 19 additions & 1 deletion packaging/qt/QtCore.py
Expand Up @@ -6,11 +6,29 @@
from PyQt4.QtCore import pyqtProperty as Property
from PyQt4.QtCore import pyqtSignal as Signal
from PyQt4.QtCore import pyqtSlot as Slot
from PyQt4.QtCore import QCoreApplication
from PyQt4.Qt import QCoreApplication
from PyQt4.Qt import Qt

__version__ = QT_VERSION_STR
__version_info__ = tuple(map(int, QT_VERSION_STR.split('.')))

elif qt_api == 'pyqt5':
from PyQt5.QtCore import *

from PyQt5.QtCore import pyqtProperty as Property
from PyQt5.QtCore import pyqtSignal as Signal
from PyQt5.QtCore import pyqtSlot as Slot
from PyQt5.Qt import QCoreApplication
from PyQt5.Qt import Qt

__version__ = QT_VERSION_STR
__version_info__ = tuple(map(int, QT_VERSION_STR.split('.')))


elif qt_api == 'pyside2':
from PySide2.QtCore import *

from PySide2 import __version__, __version_info__
else:
try:
from PySide import __version__, __version_info__
Expand Down
21 changes: 20 additions & 1 deletion packaging/qt/QtGui.py
@@ -1,7 +1,26 @@
from . import qt_api

if qt_api == 'pyqt':
from PyQt4.Qt import QKeySequence, QTextCursor
from PyQt4.QtGui import *


elif qt_api == 'pyqt5':
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtPrintSupport import *
from PyQt5.QtCore import (
QAbstractProxyModel, QItemSelection, QItemSelectionModel,
QItemSelectionRange, QSortFilterProxyModel, QStringListModel
)

elif qt_api == 'pyside2':
from PySide2.QtGui import *
from PySide2.QtWidgets import *
from PySide2.QtPrintSupport import *
from PySide2.QtCore import (
QAbstractProxyModel, QItemSelection, QItemSelectionModel,
QItemSelectionRange, QSortFilterProxyModel
)

else:
from PySide.QtGui import *
8 changes: 7 additions & 1 deletion packaging/qt/QtNetwork.py
Expand Up @@ -2,6 +2,12 @@

if qt_api == 'pyqt':
from PyQt4.QtNetwork import *


elif qt_api == 'pyqt5':
from PyQt5.QtNetwork import *

elif qt_api == 'pyside2':
from PySide2.QtNetwork import *

else:
from PySide.QtNetwork import *
8 changes: 7 additions & 1 deletion packaging/qt/QtOpenGL.py
Expand Up @@ -2,6 +2,12 @@

if qt_api == 'pyqt':
from PyQt4.QtOpenGL import *


elif qt_api == 'pyqt5':
from PyQt5.QtOpenGL import *

elif qt_api == 'pyside2':
from PySide2.QtOpenGL import *

else:
from PySide.QtOpenGL import *
10 changes: 9 additions & 1 deletion packaging/qt/QtScript.py
Expand Up @@ -2,6 +2,14 @@

if qt_api == 'pyqt':
from PyQt4.QtScript import *


if qt_api == 'pyqt5':
import warnings
warnings.warn(DeprecationWarning("QtScript is not supported in PyQt5"))

if qt_api == 'pyside2':
import warnings
warnings.warn(DeprecationWarning("QtScript is not supported in PyQt5"))

else:
from PySide.QtScript import *
8 changes: 7 additions & 1 deletion packaging/qt/QtSvg.py
Expand Up @@ -2,6 +2,12 @@

if qt_api == 'pyqt':
from PyQt4.QtSvg import *


elif qt_api == 'pyqt5':
from PyQt5.QtSvg import *

elif qt_api == 'pyside2':
from PySide2.QtSvg import *

else:
from PySide.QtSvg import *
8 changes: 7 additions & 1 deletion packaging/qt/QtTest.py
Expand Up @@ -2,6 +2,12 @@

if qt_api == 'pyqt':
from PyQt4.QtTest import *


elif qt_api == 'pyqt5':
from PyQt5.QtTest import *

elif qt_api == 'pyside2':
from PySide2.QtTest import *

else:
from PySide.QtTest import *
27 changes: 26 additions & 1 deletion packaging/qt/QtWebKit.py
Expand Up @@ -2,6 +2,31 @@

if qt_api == 'pyqt':
from PyQt4.QtWebKit import *


elif qt_api == 'pyqt5':
#from PyQt5.QtWebKit import *
#from PyQt5.QtWebKitWidgets import *
from PyQt5.QtWidgets import *
from PyQt5.QtWebEngine import *
from PyQt5.QtWebEngineWidgets import (
QWebEngineHistory as QWebHistory,
QWebEngineHistoryItem as QWebHistoryItem,
QWebEnginePage as QWebPage,
QWebEngineView as QWebView,
)

elif qt_api == 'pyside2':
from PyQt5.QtWidgets import *
# WebKit is currently in flux in PySide2
try:
from PySide2.QtWebEngineWidgets import (
QWebEngineHistory as QWebHistory,
QWebEngineHistoryItem as QWebHistoryItem,
QWebEnginePage as QWebPage,
QWebEngineView as QWebView
)
except ImportError:
from PySide2.QtWebKitWidgets import *

else:
from PySide.QtWebKit import *

0 comments on commit 2fbf490

Please sign in to comment.