From 192a3de2ad61b565bc1076a5a733d30a42808f53 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sat, 12 Mar 2011 01:41:44 +0200 Subject: [PATCH 1/3] Moved the translation files to their proper place on Linux/BSD/*nix. --- openlp/core/utils/__init__.py | 9 ++++++++- openlp/core/utils/languagemanager.py | 2 ++ resources/debian/Makefile | 10 +++++++--- resources/debian/debian/rules | 24 ++++++++++++------------ 4 files changed, 29 insertions(+), 16 deletions(-) diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index f3dacee88..381712977 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -35,6 +35,7 @@ import urllib2 from datetime import datetime from PyQt4 import QtGui, QtCore + if sys.platform != u'win32' and sys.platform != u'darwin': try: from xdg import BaseDirectory @@ -134,7 +135,7 @@ class AppLocation(object): elif dir_type == AppLocation.LanguageDir: app_path = _get_frozen_path( os.path.abspath(os.path.split(sys.argv[0])[0]), - os.path.split(openlp.__file__)[0]) + _get_os_dir_path(dir_type)) return os.path.join(app_path, u'i18n') else: return _get_os_dir_path(dir_type) @@ -169,15 +170,21 @@ def _get_os_dir_path(dir_type): if dir_type == AppLocation.DataDir: return os.path.join(unicode(os.getenv(u'APPDATA'), encoding), u'openlp', u'data') + elif dir_type == AppLocation.LanguageDir: + return os.path.split(openlp.__file__)[0] return os.path.join(unicode(os.getenv(u'APPDATA'), encoding), u'openlp') elif sys.platform == u'darwin': if dir_type == AppLocation.DataDir: return os.path.join(unicode(os.getenv(u'HOME'), encoding), u'Library', u'Application Support', u'openlp', u'Data') + elif dir_type == AppLocation.LanguageDir: + return os.path.split(openlp.__file__)[0] return os.path.join(unicode(os.getenv(u'HOME'), encoding), u'Library', u'Application Support', u'openlp') else: + if dir_type == AppLocation.LanguageDir: + return os.path.join(u'/usr', u'share', u'openlp') if XDG_BASE_AVAILABLE: if dir_type == AppLocation.ConfigDir: return os.path.join(unicode(BaseDirectory.xdg_config_home, diff --git a/openlp/core/utils/languagemanager.py b/openlp/core/utils/languagemanager.py index 28a8b06f8..8e5ab1f54 100644 --- a/openlp/core/utils/languagemanager.py +++ b/openlp/core/utils/languagemanager.py @@ -63,6 +63,8 @@ class LanguageManager(object): """ Find all available language files in this OpenLP install """ + log.debug(u'Translation files: %s', AppLocation.get_directory( + AppLocation.LanguageDir)) trans_dir = QtCore.QDir(AppLocation.get_directory( AppLocation.LanguageDir)) file_names = trans_dir.entryList(QtCore.QStringList(u'*.qm'), diff --git a/resources/debian/Makefile b/resources/debian/Makefile index fd19cffb7..94e6e2499 100644 --- a/resources/debian/Makefile +++ b/resources/debian/Makefile @@ -2,12 +2,16 @@ # -*- makefile -*- build: - mkdir -p openlp/i18n + mkdir -p resources/i18n/qm for TSFILE in resources/i18n/*.ts; do\ - lrelease-qt4 $$TSFILE -qm openlp/i18n/`basename $$TSFILE .ts`.qm;\ + lrelease-qt4 $$TSFILE -qm resources/i18n/qm/`basename $$TSFILE .ts`.qm;\ done install: + mkdir -p $(DESTDIR)/usr/share/openlp/i18n + cd resources/i18n/qm && for QMFILE in*.qm; do\ + mv $QMFILE $(DESTDIR)/usr/share/openlp/i18n;\ + done clean: - + rm -fR resources/i18n/qm diff --git a/resources/debian/debian/rules b/resources/debian/debian/rules index 18a593660..a9f7a5711 100755 --- a/resources/debian/debian/rules +++ b/resources/debian/debian/rules @@ -1,21 +1,21 @@ #!/usr/bin/make -f - + DEB_PYTHON_SYSTEM := pysupport DEB_MAKE_BUILD_TARGET := build -DEB_MAKE_INSTALL_TARGET := -DEB_MAKE_CLEAN_TARGET := +DEB_MAKE_INSTALL_TARGET := install +DEB_MAKE_CLEAN_TARGET := clean include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/class/python-distutils.mk include /usr/share/cdbs/1/class/makefile.mk binary-post-install/openlp:: - for SIZE in 16x16 32x32 48x48 64x64 128x128 256x256; do \ - mkdir -p debian/openlp/usr/share/icons/hicolor/$$SIZE/apps && \ - cp resources/images/openlp-logo-$$SIZE.png debian/openlp/usr/share/icons/hicolor/$$SIZE/apps/openlp.png; \ - done - - mkdir -p debian/openlp/usr/share/icons/hicolor/scalable/apps && \ - cp resources/images/openlp-logo.svg debian/openlp/usr/share/icons/hicolor/scalable/apps/openlp.svg - - cd debian/openlp/usr/bin/ && mv openlp.pyw openlp + for SIZE in 16x16 32x32 48x48 64x64 128x128 256x256; do \ + mkdir -p debian/openlp/usr/share/icons/hicolor/$$SIZE/apps && \ + cp resources/images/openlp-logo-$$SIZE.png debian/openlp/usr/share/icons/hicolor/$$SIZE/apps/openlp.png; \ + done + + mkdir -p debian/openlp/usr/share/icons/hicolor/scalable/apps && \ + cp resources/images/openlp-logo.svg debian/openlp/usr/share/icons/hicolor/scalable/apps/openlp.svg + + cd debian/openlp/usr/bin/ && mv openlp.pyw openlp From d9d12f0daf1af91b664384c97ee6d7df197ebdb1 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sat, 12 Mar 2011 22:28:37 +0200 Subject: [PATCH 2/3] Updated manifest file. --- MANIFEST.in | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 992685bcf..b51cd4c06 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -4,13 +4,10 @@ recursive-include openlp *.csv recursive-include openlp *.html recursive-include openlp *.js recursive-include openlp *.css -recursive-include openlp *.qm recursive-include documentation * -recursive-include resources/forms * -recursive-include resources/i18n * -recursive-include resources/images * -recursive-include scripts *.py -include resources/*.desktop +recursive-include resources * +recursive-include scripts * include copyright.txt include LICENSE +include README.txt include openlp/.version From d89b7543003d887f2e3e3a2cdeb16449274ca02e Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sat, 12 Mar 2011 22:36:33 +0200 Subject: [PATCH 3/3] Fixed up some spaces->tabs that went awry. --- resources/debian/Makefile | 10 +++++----- resources/debian/debian/rules | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/resources/debian/Makefile b/resources/debian/Makefile index 94e6e2499..1fe02b479 100644 --- a/resources/debian/Makefile +++ b/resources/debian/Makefile @@ -4,14 +4,14 @@ build: mkdir -p resources/i18n/qm for TSFILE in resources/i18n/*.ts; do\ - lrelease-qt4 $$TSFILE -qm resources/i18n/qm/`basename $$TSFILE .ts`.qm;\ + lrelease-qt4 $$TSFILE -qm resources/i18n/qm/`basename $$TSFILE .ts`.qm;\ done install: - mkdir -p $(DESTDIR)/usr/share/openlp/i18n - cd resources/i18n/qm && for QMFILE in*.qm; do\ - mv $QMFILE $(DESTDIR)/usr/share/openlp/i18n;\ - done + mkdir -p $(DESTDIR)/usr/share/openlp/i18n + cd resources/i18n/qm && for QMFILE in*.qm; do\ + mv $QMFILE $(DESTDIR)/usr/share/openlp/i18n;\ + done clean: rm -fR resources/i18n/qm diff --git a/resources/debian/debian/rules b/resources/debian/debian/rules index a9f7a5711..c8fe91ecc 100755 --- a/resources/debian/debian/rules +++ b/resources/debian/debian/rules @@ -10,12 +10,12 @@ include /usr/share/cdbs/1/class/python-distutils.mk include /usr/share/cdbs/1/class/makefile.mk binary-post-install/openlp:: - for SIZE in 16x16 32x32 48x48 64x64 128x128 256x256; do \ - mkdir -p debian/openlp/usr/share/icons/hicolor/$$SIZE/apps && \ - cp resources/images/openlp-logo-$$SIZE.png debian/openlp/usr/share/icons/hicolor/$$SIZE/apps/openlp.png; \ - done + for SIZE in 16x16 32x32 48x48 64x64 128x128 256x256; do \ + mkdir -p debian/openlp/usr/share/icons/hicolor/$$SIZE/apps && \ + cp resources/images/openlp-logo-$$SIZE.png debian/openlp/usr/share/icons/hicolor/$$SIZE/apps/openlp.png; \ + done - mkdir -p debian/openlp/usr/share/icons/hicolor/scalable/apps && \ - cp resources/images/openlp-logo.svg debian/openlp/usr/share/icons/hicolor/scalable/apps/openlp.svg + mkdir -p debian/openlp/usr/share/icons/hicolor/scalable/apps && \ + cp resources/images/openlp-logo.svg debian/openlp/usr/share/icons/hicolor/scalable/apps/openlp.svg - cd debian/openlp/usr/bin/ && mv openlp.pyw openlp + cd debian/openlp/usr/bin/ && mv openlp.pyw openlp