Mageia Bugzilla – Attachment 14590 Details for
Bug 33398
qhexedit2: add qt-designer plugin support and, maybe, swith to Qt6 build
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
[patch]
adds Qt6 backend support
qhexedit2_build.patch (text/plain), 5.67 KB, created by
Aurelian R
on 2024-07-13 21:47:28 CEST
(
hide
)
Description:
adds Qt6 backend support
Filename:
MIME Type:
Creator:
Aurelian R
Created:
2024-07-13 21:47:28 CEST
Size:
5.67 KB
patch
obsolete
>diff -Nurp qhexedit2-0.8.9/example/qhexedit.pro qhexedit2-0.8.9_qt6/example/qhexedit.pro >--- qhexedit2-0.8.9/example/qhexedit.pro 2020-07-03 18:02:04.000000000 +0300 >+++ qhexedit2-0.8.9_qt6/example/qhexedit.pro 2024-07-13 14:47:12.072405973 +0300 >@@ -3,9 +3,6 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += > HEADERS = \ > mainwindow.h \ > optionsdialog.h \ >- ../src/qhexedit.h \ >- ../src/chunks.h \ >- ../src/commands.h \ > searchdialog.h > > >@@ -13,11 +10,10 @@ SOURCES = \ > main.cpp \ > mainwindow.cpp \ > optionsdialog.cpp \ >- ../src/qhexedit.cpp \ >- ../src/chunks.cpp \ >- ../src/commands.cpp \ > searchdialog.cpp > >+LIBS = -L../build-lib-qt$$QT_MAJOR_VERSION -lqhexedit-qt$$QT_MAJOR_VERSION >+ > RESOURCES = \ > qhexedit.qrc > >diff -Nurp qhexedit2-0.8.9/setup.py qhexedit2-0.8.9_qt6/setup.py >--- qhexedit2-0.8.9/setup.py 2020-07-03 18:02:04.000000000 +0300 >+++ qhexedit2-0.8.9_qt6/setup.py 2024-07-13 14:58:00.171462212 +0300 >@@ -11,11 +11,16 @@ import sipconfig > cfg = sipconfig.Configuration() > pyqt_sip_dir = cfg.default_sip_dir > >-try: >- import PyQt5 >- PyQt_Version = 'PyQt5' >-except: >- PyQt_Version = 'PyQt4' >+if os.environ.get('USE_QT6'): >+ PyQt_Version = 'PyQt6' >+ libsuffix = "-qt6" >+else: >+ if os.environ.get('USE_QT5'): >+ PyQt_Version = 'PyQt5' >+ libsuffix = "-qt5" >+ else: >+ PyQt_Version = 'PyQt4' >+ libsuffix = "" > > > include_dirs = ['src'] >@@ -28,19 +33,28 @@ class build_pyqt_ext(sipdistutils.build_ > "required", > None, > "qhexedit is required (failure to build will raise an error)" >- )] >+ ), >+ ( >+ "sip-bin=", >+ None, >+ "Path to sip binary" >+ )] > > boolean_options = sipdistutils.build_ext.boolean_options + ["required"] > > def initialize_options(self): > sipdistutils.build_ext.initialize_options(self) > self.required = False >+ self.sip_bin = '/usr/bin/python3-sip' > > def finalize_options(self): >- if PyQt_Version == 'PyQt5': >- from PyQt5.QtCore import PYQT_CONFIGURATION >+ if PyQt_Version == 'PyQt6': >+ from PyQt6.QtCore import PYQT_CONFIGURATION > else: >- from PyQt4.QtCore import PYQT_CONFIGURATION >+ if PyQt_Version == 'PyQt5': >+ from PyQt5.QtCore import PYQT_CONFIGURATION >+ else: >+ from PyQt4.QtCore import PYQT_CONFIGURATION > sipdistutils.build_ext.finalize_options(self) > self.sip_opts = self.sip_opts + PYQT_CONFIGURATION['sip_flags'].split() > self.sip_opts.append('-I%s/%s' % (pyqt_sip_dir, PyQt_Version)) >@@ -84,9 +98,12 @@ class build_pyqt_ext(sipdistutils.build_ > def _sip_sipfiles_dir(self): > return pyqt_sip_dir > >+ def _find_sip(self): >+ """override _find_sip to allow for manually speficied sip path.""" >+ return self.sip_bin or sipdistutils.build_ext._find_sip(self) > > # Used Qt libs >-if PyQt_Version == 'PyQt5': >+if PyQt_Version == 'PyQt5' || PyQt_Version == 'PyQt6': > qt_libs = ["QtCore", "QtGui", "QtWidgets"] > else: > qt_libs = ["QtCore", "QtGui"] >@@ -97,32 +114,43 @@ if cfg.qt_framework: > include_dirs += [os.path.join(cfg.qt_lib_dir, > lib + ".framework", "Headers")] > else: >- if PyQt_Version == 'PyQt5': >- for qt_inc_dir in ('/usr/include/qt', '/usr/include/x86_64-linux-gnu/qt5'): >+ if PyQt_Version == 'PyQt6': >+ for qt_inc_dir in ('/usr/include/qt6',): > include_dirs.append(qt_inc_dir) > include_dirs += [os.path.join(qt_inc_dir, lib) for lib in qt_libs] >- libraries = ["Qt5" + lib[2:] for lib in qt_libs] >+ libraries = ["Qt6" + lib[2:] for lib in qt_libs] >+ library_dirs = ["build-lib-qt6"] >+ libraries.append("qhexedit-qt6") > else: >- for qt_inc_dir in ('/usr/include/qt', '/usr/include/qt4'): >- include_dirs.append(qt_inc_dir) >- include_dirs += [os.path.join(qt_inc_dir, lib) for lib in qt_libs] >- libraries = ["Qt" + lib[2:] for lib in qt_libs] >- >-libraries.append("qhexedit") >+ if PyQt_Version == 'PyQt5': >+ for qt_inc_dir in ('/usr/include/qt5',): >+ include_dirs.append(qt_inc_dir) >+ include_dirs += [os.path.join(qt_inc_dir, lib) for lib in qt_libs] >+ libraries = ["Qt5" + lib[2:] for lib in qt_libs] >+ library_dirs = ["build-lib-qt5"] >+ libraries.append("qhexedit-qt5") >+ else: >+ for qt_inc_dir in ('/usr/include/qt',): >+ include_dirs.append(qt_inc_dir) >+ include_dirs += [os.path.join(qt_inc_dir, lib) for lib in qt_libs] >+ libraries = ["Qt" + lib[2:] for lib in qt_libs] >+ library_dirs = ["build-lib-qt4"] >+ libraries.append("qhexedit") > > dirname = os.path.dirname(__file__) > > setup( >- name='QHexEdit', >+ name='QHexEdit' + libsuffix, > version='0.8.9', > ext_modules=[ > Extension( >- "qhexedit", >+ "qhexedit" + libsuffix, > sources=[ > os.path.join(dirname, "src/qhexedit.sip"), > ], > include_dirs=include_dirs, > libraries=libraries, >+ library_dirs=library_dirs, > ) > ], > cmdclass={"build_ext": build_pyqt_ext}, >diff -Nurp qhexedit2-0.8.9/src/qhexedit.pro qhexedit2-0.8.9_qt6/src/qhexedit.pro >--- qhexedit2-0.8.9/src/qhexedit.pro 2020-07-03 18:02:04.000000000 +0300 >+++ qhexedit2-0.8.9_qt6/src/qhexedit.pro 2024-07-13 14:50:54.345511922 +0300 >@@ -19,9 +19,4 @@ SOURCES = \ > chunks.cpp \ > commands.cpp > >-Release:TARGET = qhexedit >-Debug:TARGET = qhexeditd >- >- >-unix:DESTDIR = /usr/lib >-win32:DESTDIR = ../lib >+TARGET = qhexedit-qt$$QT_MAJOR_VERSION
diff -Nurp qhexedit2-0.8.9/example/qhexedit.pro qhexedit2-0.8.9_qt6/example/qhexedit.pro --- qhexedit2-0.8.9/example/qhexedit.pro 2020-07-03 18:02:04.000000000 +0300 +++ qhexedit2-0.8.9_qt6/example/qhexedit.pro 2024-07-13 14:47:12.072405973 +0300 @@ -3,9 +3,6 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += HEADERS = \ mainwindow.h \ optionsdialog.h \ - ../src/qhexedit.h \ - ../src/chunks.h \ - ../src/commands.h \ searchdialog.h @@ -13,11 +10,10 @@ SOURCES = \ main.cpp \ mainwindow.cpp \ optionsdialog.cpp \ - ../src/qhexedit.cpp \ - ../src/chunks.cpp \ - ../src/commands.cpp \ searchdialog.cpp +LIBS = -L../build-lib-qt$$QT_MAJOR_VERSION -lqhexedit-qt$$QT_MAJOR_VERSION + RESOURCES = \ qhexedit.qrc diff -Nurp qhexedit2-0.8.9/setup.py qhexedit2-0.8.9_qt6/setup.py --- qhexedit2-0.8.9/setup.py 2020-07-03 18:02:04.000000000 +0300 +++ qhexedit2-0.8.9_qt6/setup.py 2024-07-13 14:58:00.171462212 +0300 @@ -11,11 +11,16 @@ import sipconfig cfg = sipconfig.Configuration() pyqt_sip_dir = cfg.default_sip_dir -try: - import PyQt5 - PyQt_Version = 'PyQt5' -except: - PyQt_Version = 'PyQt4' +if os.environ.get('USE_QT6'): + PyQt_Version = 'PyQt6' + libsuffix = "-qt6" +else: + if os.environ.get('USE_QT5'): + PyQt_Version = 'PyQt5' + libsuffix = "-qt5" + else: + PyQt_Version = 'PyQt4' + libsuffix = "" include_dirs = ['src'] @@ -28,19 +33,28 @@ class build_pyqt_ext(sipdistutils.build_ "required", None, "qhexedit is required (failure to build will raise an error)" - )] + ), + ( + "sip-bin=", + None, + "Path to sip binary" + )] boolean_options = sipdistutils.build_ext.boolean_options + ["required"] def initialize_options(self): sipdistutils.build_ext.initialize_options(self) self.required = False + self.sip_bin = '/usr/bin/python3-sip' def finalize_options(self): - if PyQt_Version == 'PyQt5': - from PyQt5.QtCore import PYQT_CONFIGURATION + if PyQt_Version == 'PyQt6': + from PyQt6.QtCore import PYQT_CONFIGURATION else: - from PyQt4.QtCore import PYQT_CONFIGURATION + if PyQt_Version == 'PyQt5': + from PyQt5.QtCore import PYQT_CONFIGURATION + else: + from PyQt4.QtCore import PYQT_CONFIGURATION sipdistutils.build_ext.finalize_options(self) self.sip_opts = self.sip_opts + PYQT_CONFIGURATION['sip_flags'].split() self.sip_opts.append('-I%s/%s' % (pyqt_sip_dir, PyQt_Version)) @@ -84,9 +98,12 @@ class build_pyqt_ext(sipdistutils.build_ def _sip_sipfiles_dir(self): return pyqt_sip_dir + def _find_sip(self): + """override _find_sip to allow for manually speficied sip path.""" + return self.sip_bin or sipdistutils.build_ext._find_sip(self) # Used Qt libs -if PyQt_Version == 'PyQt5': +if PyQt_Version == 'PyQt5' || PyQt_Version == 'PyQt6': qt_libs = ["QtCore", "QtGui", "QtWidgets"] else: qt_libs = ["QtCore", "QtGui"] @@ -97,32 +114,43 @@ if cfg.qt_framework: include_dirs += [os.path.join(cfg.qt_lib_dir, lib + ".framework", "Headers")] else: - if PyQt_Version == 'PyQt5': - for qt_inc_dir in ('/usr/include/qt', '/usr/include/x86_64-linux-gnu/qt5'): + if PyQt_Version == 'PyQt6': + for qt_inc_dir in ('/usr/include/qt6',): include_dirs.append(qt_inc_dir) include_dirs += [os.path.join(qt_inc_dir, lib) for lib in qt_libs] - libraries = ["Qt5" + lib[2:] for lib in qt_libs] + libraries = ["Qt6" + lib[2:] for lib in qt_libs] + library_dirs = ["build-lib-qt6"] + libraries.append("qhexedit-qt6") else: - for qt_inc_dir in ('/usr/include/qt', '/usr/include/qt4'): - include_dirs.append(qt_inc_dir) - include_dirs += [os.path.join(qt_inc_dir, lib) for lib in qt_libs] - libraries = ["Qt" + lib[2:] for lib in qt_libs] - -libraries.append("qhexedit") + if PyQt_Version == 'PyQt5': + for qt_inc_dir in ('/usr/include/qt5',): + include_dirs.append(qt_inc_dir) + include_dirs += [os.path.join(qt_inc_dir, lib) for lib in qt_libs] + libraries = ["Qt5" + lib[2:] for lib in qt_libs] + library_dirs = ["build-lib-qt5"] + libraries.append("qhexedit-qt5") + else: + for qt_inc_dir in ('/usr/include/qt',): + include_dirs.append(qt_inc_dir) + include_dirs += [os.path.join(qt_inc_dir, lib) for lib in qt_libs] + libraries = ["Qt" + lib[2:] for lib in qt_libs] + library_dirs = ["build-lib-qt4"] + libraries.append("qhexedit") dirname = os.path.dirname(__file__) setup( - name='QHexEdit', + name='QHexEdit' + libsuffix, version='0.8.9', ext_modules=[ Extension( - "qhexedit", + "qhexedit" + libsuffix, sources=[ os.path.join(dirname, "src/qhexedit.sip"), ], include_dirs=include_dirs, libraries=libraries, + library_dirs=library_dirs, ) ], cmdclass={"build_ext": build_pyqt_ext}, diff -Nurp qhexedit2-0.8.9/src/qhexedit.pro qhexedit2-0.8.9_qt6/src/qhexedit.pro --- qhexedit2-0.8.9/src/qhexedit.pro 2020-07-03 18:02:04.000000000 +0300 +++ qhexedit2-0.8.9_qt6/src/qhexedit.pro 2024-07-13 14:50:54.345511922 +0300 @@ -19,9 +19,4 @@ SOURCES = \ chunks.cpp \ commands.cpp -Release:TARGET = qhexedit -Debug:TARGET = qhexeditd - - -unix:DESTDIR = /usr/lib -win32:DESTDIR = ../lib +TARGET = qhexedit-qt$$QT_MAJOR_VERSION
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 33398
:
14589
| 14590