[Python-apps-commits] r3280 - in packages/vitables/trunk/debian/patches (5 files)
xnox-guest at users.alioth.debian.org
xnox-guest at users.alioth.debian.org
Tue Jul 14 20:25:38 UTC 2009
Date: Tuesday, July 14, 2009 @ 20:25:31
Author: xnox-guest
Revision: 3280
Using relative to python module paths for icons and UI
Added:
packages/vitables/trunk/debian/patches/fix-vtsite.patch
Modified:
packages/vitables/trunk/debian/patches/do-not-use-resources.patch
packages/vitables/trunk/debian/patches/loading-ui-files.patch
packages/vitables/trunk/debian/patches/series
packages/vitables/trunk/debian/patches/setup.py.patch
Modified: packages/vitables/trunk/debian/patches/do-not-use-resources.patch
===================================================================
--- packages/vitables/trunk/debian/patches/do-not-use-resources.patch 2009-07-14 20:25:16 UTC (rev 3279)
+++ packages/vitables/trunk/debian/patches/do-not-use-resources.patch 2009-07-14 20:25:31 UTC (rev 3280)
@@ -1,35 +1,41 @@
Changing URLs to point to package-data files instead of QT resources.
Index: vitables-2.0/vitables/utils.py
===================================================================
---- vitables-2.0.orig/vitables/utils.py 2009-07-13 19:45:02.000000000 +0300
-+++ vitables-2.0/vitables/utils.py 2009-07-13 19:45:23.000000000 +0300
-@@ -104,11 +104,11 @@
+--- vitables-2.0.orig/vitables/utils.py 2009-07-14 01:36:40.000000000 +0300
++++ vitables-2.0/vitables/utils.py 2009-07-14 01:40:21.000000000 +0300
+@@ -99,16 +99,17 @@
+ - `icons_dict`: the icons dictionary to be updated
+ """
+
++ icondir = os.path.join(os.path.dirname(__file__),'icons')
+ all_icons = large_icons.union(small_icons)
+
for name in all_icons:
icon = QIcon()
if name in large_icons:
- pixmap = QPixmap(':/icons/big_icons/%s.png' % name)
-+ pixmap = QPixmap('vitables/icons/big_icons/%s.png' % name)
++ pixmap = QPixmap(os.path.join(icondir,'big_icons','%s.png') % name)
pixmap.scaled(QSize(22, 22), Qt.KeepAspectRatio)
icon.addPixmap(pixmap, QIcon.Normal, QIcon.On)
if name in small_icons:
- pixmap = QPixmap(':/icons/small_icons/%s.png' % name)
-+ pixmap = QPixmap('vitables/icons/small_icons/%s.png' % name)
++ pixmap = QPixmap(os.path.join(icondir,'small_icons','%s.png') % name)
icon.addPixmap(pixmap, QIcon.Normal, QIcon.On)
icons_dict[name] = icon
-@@ -116,7 +116,7 @@
+@@ -116,7 +117,7 @@
icons_dict[''] = QIcon()
# Application icon
- icons_dict['vitables_wm'] = QIcon(':/icons/vitables_wm.png')
-+ icons_dict['vitables_wm'] = QIcon('vitables/icons/vitables_wm.png')
++ icons_dict['vitables_wm'] = QIcon(os.path.join(icondir,'vitables_wm.png'))
def getIcons():
"""Return the icons dictionary to be used by the main window."""
Index: vitables-2.0/vitables/vtapp.py
===================================================================
---- vitables-2.0.orig/vitables/vtapp.py 2009-07-13 19:45:02.000000000 +0300
-+++ vitables-2.0/vitables/vtapp.py 2009-07-13 19:45:23.000000000 +0300
+--- vitables-2.0.orig/vitables/vtapp.py 2009-07-14 01:36:40.000000000 +0300
++++ vitables-2.0/vitables/vtapp.py 2009-07-14 01:36:43.000000000 +0300
@@ -100,7 +100,7 @@
self.config = vtconfig.Config()
@@ -41,8 +47,8 @@
t_i = time.time()
Index: vitables-2.0/vitables/docBrowser/helpBrowser.py
===================================================================
---- vitables-2.0.orig/vitables/docBrowser/helpBrowser.py 2009-07-13 19:45:02.000000000 +0300
-+++ vitables-2.0/vitables/docBrowser/helpBrowser.py 2009-07-13 19:45:23.000000000 +0300
+--- vitables-2.0.orig/vitables/docBrowser/helpBrowser.py 2009-07-14 01:36:40.000000000 +0300
++++ vitables-2.0/vitables/docBrowser/helpBrowser.py 2009-07-14 01:36:43.000000000 +0300
@@ -67,7 +67,7 @@
from PyQt4.QtGui import *
Added: packages/vitables/trunk/debian/patches/fix-vtsite.patch
===================================================================
--- packages/vitables/trunk/debian/patches/fix-vtsite.patch (rev 0)
+++ packages/vitables/trunk/debian/patches/fix-vtsite.patch 2009-07-14 20:25:31 UTC (rev 3280)
@@ -0,0 +1,32 @@
+Making vtSite "self-aware" instead of build-time configured.
+Index: vitables-2.0/vitables/vtSite.py
+===================================================================
+--- vitables-2.0.orig/vitables/vtSite.py 2009-07-14 01:43:04.000000000 +0300
++++ vitables-2.0/vitables/vtSite.py 2009-07-14 01:48:06.000000000 +0300
+@@ -23,22 +23,21 @@
+ """
+ Site configuration module.
+
+-This module allows for testing ViTables IN the source tree.
+-In Linux and Windows boxes the module is rewritten at installing time.
++This module indicates the full install path to vitables top level module
+ Mac OS X boxes use the module as is.
+
+ Misc variables:
+
+ * __docformat__
+ * INSTALLDIR
+-* DATADIR
+-* VERSION
+
+ """
+
++import os.path
++
+ __docformat__ = 'restructuredtext'
+
+-INSTALLDIR = '.'
++INSTALLDIR = os.path.dirname(__file__)
+
+ import sys as _sys
+ if (_sys.platform == 'darwin'
Modified: packages/vitables/trunk/debian/patches/loading-ui-files.patch
===================================================================
--- packages/vitables/trunk/debian/patches/loading-ui-files.patch 2009-07-14 20:25:16 UTC (rev 3279)
+++ packages/vitables/trunk/debian/patches/loading-ui-files.patch 2009-07-14 20:25:31 UTC (rev 3280)
@@ -2,7 +2,7 @@
Index: vitables-2.0/vitables/preferences/settingsUI.py
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ vitables-2.0/vitables/preferences/settingsUI.py 2009-07-13 23:59:44.000000000 +0300
++++ vitables-2.0/vitables/preferences/settingsUI.py 2009-07-14 01:34:42.000000000 +0300
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+
@@ -24,15 +24,15 @@
+#
+# Author: Vicent Mas - vmas at vitables.org
+
-+
++import os.path
+from PyQt4.uic import loadUiType
+
-+Ui_SettingsDialog=loadUiType('settings_dlg.ui')[0]
++Ui_SettingsDialog=loadUiType(os.path.join(os.path.dirname(__file__),'settings_dlg.ui'))[0]
Index: vitables-2.0/vitables/queries/queryUI.py
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ vitables-2.0/vitables/queries/queryUI.py 2009-07-14 00:00:08.000000000 +0300
-@@ -0,0 +1,25 @@
++++ vitables-2.0/vitables/queries/queryUI.py 2009-07-14 01:35:23.000000000 +0300
+@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+
+
@@ -53,8 +53,9 @@
+#
+# Author: Vicent Mas - vmas at vitables.org
+
-+
++from vitables import vtSite
++import os.path
+from PyQt4.uic import loadUiType
+
-+Ui_QueryDialog=loadUiType('query_dlg.ui')[0]
++Ui_QueryDialog=loadUiType(os.path.join(os.path.dirname(__file__),'query_dlg.ui'))[0]
+
Modified: packages/vitables/trunk/debian/patches/series
===================================================================
--- packages/vitables/trunk/debian/patches/series 2009-07-14 20:25:16 UTC (rev 3279)
+++ packages/vitables/trunk/debian/patches/series 2009-07-14 20:25:31 UTC (rev 3280)
@@ -1,4 +1,5 @@
-desktop-file.patch
+fix-vtsite.patch
+setup.py.patch
do-not-use-resources.patch
-setup.py.patch
loading-ui-files.patch
+desktop-file.patch
Modified: packages/vitables/trunk/debian/patches/setup.py.patch
===================================================================
--- packages/vitables/trunk/debian/patches/setup.py.patch 2009-07-14 20:25:16 UTC (rev 3279)
+++ packages/vitables/trunk/debian/patches/setup.py.patch 2009-07-14 20:25:31 UTC (rev 3280)
@@ -2,9 +2,9 @@
package data.
Index: vitables-2.0/setup.py
===================================================================
---- vitables-2.0.orig/setup.py 2009-07-13 20:19:17.000000000 +0300
-+++ vitables-2.0/setup.py 2009-07-13 21:17:03.000000000 +0300
-@@ -25,8 +25,77 @@
+--- vitables-2.0.orig/setup.py 2009-07-14 01:41:14.000000000 +0300
++++ vitables-2.0/setup.py 2009-07-14 01:42:55.000000000 +0300
+@@ -25,219 +25,82 @@
import os
import glob
@@ -50,75 +50,110 @@
+
+ if self.xsl_style is None:
+ self.xsl_style = "http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl"
-+
+
+-use_py2app = False
+-if sys.platform == 'darwin' and 'py2app' in sys.argv:
+- import py2app
+- use_py2app = True
+-
+-def checkVersions():
+- """Check libraries availability.
+ if self.fop_style is None:
+ self.fop_style = "http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"
-+
-+
-+ def get_command_name(self):
-+ return 'build_doc'
-+
-+ def run(self):
-+ for input_file in self.distribution.docbooks:
-+ self.announce("Building Docbook documentation from %s." % input_file)
-+
-+ if not os.path.exists(input_file):
-+ raise SystemExit, "File %s is missing." % input_file
-+
-+ input_file_name = os.path.splitext(input_file)[0]
-+ output_dir = os.path.join("vitables","docBrowser","html","")
-+
-+ spawn([self.xsltproc_path, "--nonet", "-o", output_dir, self.xsl_style, input_file])
-+ spawn([self.xsltproc_path, "--nonet", "-o", input_file_name+".fo", self.fop_style, input_file])
-+ spawn([self.fop_path, "-q", input_file_name+".fo", input_file_name+".pdf"])
-+ copy_tree(os.path.join(os.path.dirname(input_file),"images"),os.path.join(output_dir,"images"))
-+
-+def has_docbook(build):
-+ return (build.distribution.docbooks is not None and
-+ build.distribution.docbooks != [])
-+
-+class Build(build):
-+ sub_commands = build.sub_commands[:]
-+ sub_commands.insert(0,('build_doc', has_docbook))
- use_py2app = False
- if sys.platform == 'darwin' and 'py2app' in sys.argv:
-@@ -54,28 +123,24 @@
- print "###############################################################"
- print "You need Python 2.5 or greater to run ViTables!. Exiting..."
- print "###############################################################"
+- If a required library is not installed or it is too old then the setup
+- process is aborted.
+- """
+-
+- # Check if PyTables and PyQt are installed
+- try:
+- from tables import __version__
+- from PyQt4.QtCore import qVersion, PYQT_VERSION_STR
+- except ImportError, e:
+- print e
+- sys.exit()
+-
+- # Check versions
+- pyVersion = sys.version_info
+- if pyVersion < (2, 5) :
+- print "###############################################################"
+- print "You need Python 2.5 or greater to run ViTables!. Exiting..."
+- print "###############################################################"
- sys.exit(1)
-
- tablesVersion = __version__
- if tablesVersion < '2.0' :
- print "###############################################################"
- print "You need PyTables 2.0 or greater to run ViTables!. Exiting..."
- print "###############################################################"
+-
+- tablesVersion = __version__
+- if tablesVersion < '2.0' :
+- print "###############################################################"
+- print "You need PyTables 2.0 or greater to run ViTables!. Exiting..."
+- print "###############################################################"
- sys.exit(1)
-
- qtVersion = qVersion()
- if qtVersion < '4.4' :
- print "###############################################################"
- print "You need Qt v4.4 or greater to run ViTables!. Exiting..."
- print "###############################################################"
+-
+- qtVersion = qVersion()
+- if qtVersion < '4.4' :
+- print "###############################################################"
+- print "You need Qt v4.4 or greater to run ViTables!. Exiting..."
+- print "###############################################################"
- sys.exit(1)
-
- pyqtVersion = PYQT_VERSION_STR
- if pyqtVersion < '4.4' :
- print "###############################################################"
- print "You need PyQt v4.4 or greater to run ViTables!. Exiting..."
- print "###############################################################"
+-
+- pyqtVersion = PYQT_VERSION_STR
+- if pyqtVersion < '4.4' :
+- print "###############################################################"
+- print "You need PyQt v4.4 or greater to run ViTables!. Exiting..."
+- print "###############################################################"
- sys.exit(1)
-
- # =================================================================
-
-@@ -126,119 +191,9 @@
-
- return install_data.run(self)
-
+-
-# =================================================================
-
+-# Customized install_data command. It creates a vitables module with
+-# two attributes that will be used for configuring the application at
+-# runtime. This class is not used by py2app, which is OK, since the
+-# vtSite.py included in sources is intelligent enough for the
+-# packaged Mac OS X app.
+-class smart_install_data(install_data):
+- def run(self):
+- install_cmd = self.get_finalized_command('install')
+-
+- # The project installation directory can be set via --install-purelib
+- # and some other options
+- install_lib_dir = getattr(install_cmd, 'install_lib')
+- tmp = install_lib_dir.replace(chr(92),'/')
+-
+- install_options = install_cmd.distribution.command_options["install"]
+- # If data directory is not specified (via configuration file
+- # or command line argument)...
+- if not install_options.has_key('install_data'):
+- # Data will not be located in the $base directory (default
+- # behavior) but in the project directory
+- install_data_dir = os.path.join(install_lib_dir, 'vitables')
+- setattr(self, 'install_dir', install_data_dir)
+- else:
+- # Data directory is specified via configuration file or
+- # or command line argument
+- install_data_dir = getattr(install_cmd, 'install_data')
+-
+- # Create the module vtSite.py.
+- # The module has the attribute INSTALLDIR
+- # When installing this module will overwrite that included
+- # in the source package and will be used at runtime
+- vtpaths_module = open(os.path.join(install_lib_dir,
+- 'vitables', 'vtSite.py'), 'w')
+- # If we are not installing ViTables but packaging it using a
+- # chrooted environment then the path to the chrooted environment
+- # shouldn't be included in the module attributes because this
+- # path will not exist in the installation target directory
+- if self.root != None:
+- tmp = tmp[len(self.root):]
+- install_data_dir = install_data_dir[len(self.root):]
+- installdir = os.path.join(os.path.normpath(tmp),
+- 'vitables').replace(chr(92),'/')
+- vtpaths_module.write('INSTALLDIR = "%s"\n' % installdir)
+- vtpaths_module.close()
+-
+- return install_data.run(self)
+-
-# =================================================================
+-
+-# =================================================================
-# Helper function to add icons in UNIX platforms that support the
-# FreeDesktop guidelines (http://standards.freedesktop.org). In
-# particular, it is based on the 0.6 version of the basedir specs
@@ -200,7 +235,7 @@
- else:
- print >> sys.stderr, """\
-.. NOTE::
--
+
- The installer was unable to find sensible places to put the desktop icon
- for ViTables. If you want to create a desktop link to ViTables you can find
- the needed files (.desktop and icon) in the icons/ directory.
@@ -208,31 +243,55 @@
-"""
-# End of the code to add the application icons in Unix systems.
-# =================================================================
--
--
++ def get_command_name(self):
++ return 'build_doc'
+
++ def run(self):
++ for input_file in self.distribution.docbooks:
++ self.announce("Building Docbook documentation from %s." % input_file)
+
-helpAsked = False
-for item in ['-h', '--help', '--help-commands', '--help-formats',
- '--help-compiler']:
- if item in sys.argv:
- helpAsked = True
- break
--
++ if not os.path.exists(input_file):
++ raise SystemExit, "File %s is missing." % input_file
+
-# if not helpAsked:
-# if not helpAsked:
-# checkVersions()
-# checkVersions()
++ input_file_name = os.path.splitext(input_file)[0]
++ output_dir = os.path.join("vitables","docBrowser","html","")
- # Proceed if required libraries are OK
+-# Proceed if required libraries are OK
++ spawn([self.xsltproc_path, "--nonet", "-o", output_dir, self.xsl_style, input_file])
++ spawn([self.xsltproc_path, "--nonet", "-o", input_file_name+".fo", self.fop_style, input_file])
++ spawn([self.fop_path, "-q", input_file_name+".fo", input_file_name+".pdf"])
++ copy_tree(os.path.join(os.path.dirname(input_file),"images"),os.path.join(output_dir,"images"))
++
++def has_docbook(build):
++ return (build.distribution.docbooks is not None and
++ build.distribution.docbooks != [])
++
++class Build(build):
++ sub_commands = build.sub_commands[:]
++ sub_commands.insert(0,('build_doc', has_docbook))
-# Get the version number
-f = open('VERSION', 'r')
-vt_version = f.readline()[:-1]
-f.close()
--
++use_py2app = False
++if sys.platform == 'darwin' and 'py2app' in sys.argv:
++ import py2app
++ use_py2app = True
+
setup_args = {}
if use_py2app:
- setup_args['app'] = ['macosxapp/vitables-app.py']
-@@ -269,8 +224,14 @@
+@@ -269,8 +132,14 @@
``macosxapp/make.sh`` script.)
"""
@@ -249,7 +308,7 @@
description = 'A viewer for pytables package',
long_description = \
"""
-@@ -297,7 +258,18 @@
+@@ -297,7 +166,17 @@
'vitables.preferences', 'vitables.plugins',
'vitables.vtTables', 'vitables.vtWidgets'],
scripts = ['scripts/vitables'],
@@ -261,7 +320,6 @@
+ 'vitables.docBrowser':['html/*.*','html/*/*.*']
+ },
+ cmdclass = {
-+ "install_data":smart_install_data,
+ 'build': Build,
+ 'build_doc': BuildDocbook,
+ },
@@ -269,7 +327,7 @@
data_files = [
('examples', glob.glob('examples/*.h5')),
('examples/arrays', glob.glob('examples/arrays/*.h5')),
-@@ -307,10 +279,8 @@
+@@ -307,10 +186,8 @@
('examples/tests', glob.glob('examples/tests/*.h5')),
('examples/timeseries', glob.glob('examples/timeseries/*.h5')),
('doc', ['doc/usersguide.xml']),
@@ -281,7 +339,7 @@
],
**setup_args
-@@ -323,15 +293,20 @@
+@@ -323,15 +200,19 @@
# $ python setup.py build --help
# $ python setup.py build --help-compiler
@@ -301,7 +359,6 @@
- # Finally, copy the icons if we are on Unix systems, except MacOSX.
- if os.name == "posix" and sys.platform != 'darwin':
- add_unix_icons()
-+ checkVersions()
print """\n
Installation completed successfully!
Enjoy Data with ViTables, the troll of the PyTables family."""
More information about the Python-apps-commits
mailing list