From 250a496a78f8b71d52d14a865d4612678e87d05e Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Tue, 17 Aug 2010 07:26:46 -0700 Subject: [PATCH] Fixed debian packaging for SE under Python 3. --- debian_se/compat | 1 + debian_se/control | 2 +- debian_se/rules | 6 +++--- package.py | 9 +++++++++ qt/se/start.py | 11 ++++++++--- 5 files changed, 22 insertions(+), 7 deletions(-) create mode 100644 debian_se/compat diff --git a/debian_se/compat b/debian_se/compat new file mode 100644 index 00000000..7f8f011e --- /dev/null +++ b/debian_se/compat @@ -0,0 +1 @@ +7 diff --git a/debian_se/control b/debian_se/control index e7235229..5ac34062 100644 --- a/debian_se/control +++ b/debian_se/control @@ -8,5 +8,5 @@ Homepage: http://www.hardcoded.net Package: dupeguru-se Architecture: any -Depends: python (>= 2.6), python-qt4 (>= 4.6) +Depends: python3 (>= 3.1) Description: dupeGuru diff --git a/debian_se/rules b/debian_se/rules index 747d011b..af886a30 100755 --- a/debian_se/rules +++ b/debian_se/rules @@ -42,9 +42,9 @@ install: build dh_installdirs chmod +x src/start.py - cp -R src/ $(CURDIR)/debian/tmp/usr/local/share/dupeguru_se - cp $(CURDIR)/debian/dupeguru_se.desktop $(CURDIR)/debian/tmp/usr/share/applications - ln -s /usr/local/share/dupeguru_se/start.py $(CURDIR)/debian/tmp/usr/local/bin/dupeguru_se + cp -R src/ $(CURDIR)/debian/dupeguru-se/usr/local/share/dupeguru_se + cp $(CURDIR)/debian/dupeguru_se.desktop $(CURDIR)/debian/dupeguru-se/usr/share/applications + ln -s /usr/local/share/dupeguru_se/start.py $(CURDIR)/debian/dupeguru-se/usr/local/bin/dupeguru_se # Build architecture-independent files here. diff --git a/package.py b/package.py index aa68c4a1..624c54f8 100644 --- a/package.py +++ b/package.py @@ -74,6 +74,7 @@ def package_windows(edition, dev): def package_debian(edition): add_to_pythonpath('qt') + add_to_pythonpath(op.join('qt', 'base')) add_to_pythonpath(op.join('qt', edition)) from app import DupeGuru @@ -89,6 +90,14 @@ def package_debian(edition): if edition == 'me': packages.append('hsaudiotag') copy_packages(packages, srcpath) + import PyQt4 + qtsrcpath = op.dirname(PyQt4.__file__) + qtdestpath = op.join(srcpath, 'PyQt4') + os.makedirs(qtdestpath) + shutil.copy(op.join(qtsrcpath, '__init__.py'), qtdestpath) + shutil.copy(op.join(qtsrcpath, 'Qt.so'), qtdestpath) + shutil.copy(op.join(qtsrcpath, 'QtCore.so'), qtdestpath) + shutil.copy(op.join(qtsrcpath, 'QtGui.so'), qtdestpath) shutil.copytree(ed('debian_{0}'), op.join(destpath, 'debian')) yaml_path = op.join(help_src, 'changelog.yaml') changelog_dest = op.join(destpath, 'debian', 'changelog') diff --git a/qt/se/start.py b/qt/se/start.py index 33c3a06b..77cf92ca 100644 --- a/qt/se/start.py +++ b/qt/se/start.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2010 Hardcoded Software (http://www.hardcoded.net) # # This software is licensed under the "HS" License as described in the "LICENSE" file, @@ -6,6 +6,7 @@ # http://www.hardcoded.net/licenses/hs_license import sys +import os.path import sip sip.setapi('QVariant', 1) @@ -14,12 +15,16 @@ from PyQt4.QtGui import QApplication, QIcon, QPixmap import base.dg_rc +if sys.platform == 'linux2': + # Under Python3, we have to add 'base' to pythonpath because UI files don't use + # relative imports. + sys.path.append(os.path.dirname(base.dg_rc.__file__)) + from app import DupeGuru if sys.platform == 'win32': import base.cxfreeze_fix - if __name__ == "__main__": app = QApplication(sys.argv) app.setWindowIcon(QIcon(QPixmap(":/logo_se"))) @@ -27,4 +32,4 @@ if __name__ == "__main__": QCoreApplication.setApplicationName(DupeGuru.NAME) QCoreApplication.setApplicationVersion(DupeGuru.VERSION) dgapp = DupeGuru() - sys.exit(app.exec_()) \ No newline at end of file + sys.exit(app.exec_())