[Python-apps-commits] r3273 - in packages/vitables/trunk/debian/patches (6 files)
xnox-guest at users.alioth.debian.org
xnox-guest at users.alioth.debian.org
Tue Jul 14 20:24:04 UTC 2009
Date: Tuesday, July 14, 2009 @ 20:23:58
Author: xnox-guest
Revision: 3273
Eliminated usage of QT resources, loading UI's directly and still building
documentation from sources.
Added:
packages/vitables/trunk/debian/patches/do-not-use-resources.patch
packages/vitables/trunk/debian/patches/loading-ui-files.patch
packages/vitables/trunk/debian/patches/setup.py.patch
Modified:
packages/vitables/trunk/debian/patches/series
Deleted:
packages/vitables/trunk/debian/patches/remove_help_from_resources.patch
packages/vitables/trunk/debian/patches/use_distutils_for_docs.patch
Added: packages/vitables/trunk/debian/patches/do-not-use-resources.patch
===================================================================
--- packages/vitables/trunk/debian/patches/do-not-use-resources.patch (rev 0)
+++ packages/vitables/trunk/debian/patches/do-not-use-resources.patch 2009-07-14 20:23:58 UTC (rev 3273)
@@ -0,0 +1,63 @@
+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 @@
+ 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.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)
+ icon.addPixmap(pixmap, QIcon.Normal, QIcon.On)
+ icons_dict[name] = icon
+
+@@ -116,7 +116,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')
+ 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
+@@ -100,7 +100,7 @@
+ self.config = vtconfig.Config()
+
+ # Show a splash screen
+- logo = QPixmap(":/icons/vitables_logo.png")
++ logo = QPixmap("vitables/icons/vitables_logo.png")
+ splash = vitables.vtsplash.VTSplash(logo)
+ splash.show()
+ 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
+@@ -67,7 +67,7 @@
+ from PyQt4.QtGui import *
+
+ import vitables.utils
+-import vitables.qrc_resources
++
+ from vitables.docBrowser import bookmarksDlg
+ from vitables.docBrowser import browserGUI
+
+@@ -171,7 +171,7 @@
+
+ src = QDir().fromNativeSeparators(src) # src can be a QString
+ basename = os.path.basename(unicode(src))
+- url = QUrl("qrc:/doc/html/%s" % basename)
++ url = QUrl("vitables/docBrowser/html/%s" % basename)
+ self.gui.text_browser.setSource(url)
+
+
Added: packages/vitables/trunk/debian/patches/loading-ui-files.patch
===================================================================
--- packages/vitables/trunk/debian/patches/loading-ui-files.patch (rev 0)
+++ packages/vitables/trunk/debian/patches/loading-ui-files.patch 2009-07-14 20:23:58 UTC (rev 3273)
@@ -0,0 +1,60 @@
+Loading UI files directly instead of binary encoding them.
+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 19:49:11.000000000 +0300
+@@ -0,0 +1,24 @@
++# -*- coding: utf-8 -*-
++
++
++# Copyright (C) 2009 Dmitrijs Ledkovs. All rights reserved
++#
++# This program is free software: you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation, either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program. If not, see <http://www.gnu.org/licenses/>.
++#
++# Author: Vicent Mas - vmas at vitables.org
++
++
++from PyQt4.uic import loadUiType
++
++Ui_SettingsDialog=loadUiType('vitables/preferences/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-13 19:51:03.000000000 +0300
+@@ -0,0 +1,25 @@
++# -*- coding: utf-8 -*-
++
++
++# Copyright (C) 2009 Dmitrijs Ledkovs. All rights reserved
++#
++# This program is free software: you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation, either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program. If not, see <http://www.gnu.org/licenses/>.
++#
++# Author: Vicent Mas - vmas at vitables.org
++
++
++from PyQt4.uic import loadUiType
++
++Ui_QueryDialog=loadUiType('vitables/queries/query_dlg.ui')[0]
++
Deleted: packages/vitables/trunk/debian/patches/remove_help_from_resources.patch
===================================================================
--- packages/vitables/trunk/debian/patches/remove_help_from_resources.patch 2009-07-14 20:23:49 UTC (rev 3272)
+++ packages/vitables/trunk/debian/patches/remove_help_from_resources.patch 2009-07-14 20:23:58 UTC (rev 3273)
@@ -1,53 +0,0 @@
-Removing html docs from qtresources and instead pointing to the installed html
-files.
-Index: vitables-2.0+hg96+dfsg/resources.qrc
-===================================================================
---- vitables-2.0+hg96+dfsg.orig/resources.qrc 2009-05-11 04:46:53.000000000 +0100
-+++ vitables-2.0+hg96+dfsg/resources.qrc 2009-05-11 04:47:13.000000000 +0100
-@@ -67,33 +67,6 @@
- <file>icons/small_icons/vlarray.png</file>
- <file>icons/small_icons/vlstring.png</file>
- <file>icons/small_icons/zoom.png</file>
--<file>doc/html/apa.html</file>
--<file>doc/html/apb.html</file>
--<file>doc/html/ch01.html</file>
--<file>doc/html/ch02.html</file>
--<file>doc/html/ch03.html</file>
--<file>doc/html/ch04.html</file>
--<file>doc/html/index.html</file>
--<file>doc/html/usersguide_style.css</file>
--<file>doc/html/images/browseDataset.png</file>
--<file>doc/html/images/editingUserAttrs.png</file>
--<file>doc/html/images/extraInfo.png</file>
--<file>doc/html/images/fileManager.png</file>
--<file>doc/html/images/fileMenu.png</file>
--<file>doc/html/images/groupCreation.png</file>
--<file>doc/html/images/helpBrowser.png</file>
--<file>doc/html/images/helpMenu.png</file>
--<file>doc/html/images/logger.png</file>
--<file>doc/html/images/mainWindow.png</file>
--<file>doc/html/images/newFilteredTable.png</file>
--<file>doc/html/images/nodeMenu.png</file>
--<file>doc/html/images/objectTree.png</file>
--<file>doc/html/images/propertiesDlg.png</file>
--<file>doc/html/images/queryMenu.png</file>
--<file>doc/html/images/toolsMenu.png</file>
--<file>doc/html/images/treeSymbols.png</file>
--<file>doc/html/images/windowsMenu.png</file>
--<file>doc/html/images/workspace.png</file>
- <file>LICENSE.html</file>
- </qresource>
- </RCC>
-Index: vitables-2.0+hg96+dfsg/vitables/docBrowser/helpBrowser.py
-===================================================================
---- vitables-2.0+hg96+dfsg.orig/vitables/docBrowser/helpBrowser.py 2009-05-11 04:47:31.000000000 +0100
-+++ vitables-2.0+hg96+dfsg/vitables/docBrowser/helpBrowser.py 2009-05-11 04:47:53.000000000 +0100
-@@ -171,7 +170,7 @@
-
- src = QDir().fromNativeSeparators(src) # src can be a QString
- basename = os.path.basename(unicode(src))
-- url = QUrl("qrc:/doc/html/%s" % basename)
-+ url = QUrl("/usr/share/doc/vitables/doc/html/%s" % basename)
- self.gui.text_browser.setSource(url)
-
-
Modified: packages/vitables/trunk/debian/patches/series
===================================================================
--- packages/vitables/trunk/debian/patches/series 2009-07-14 20:23:49 UTC (rev 3272)
+++ packages/vitables/trunk/debian/patches/series 2009-07-14 20:23:58 UTC (rev 3273)
@@ -1,3 +1,4 @@
desktop-file.patch
-use_distutils_for_docs.patch
-remove_help_from_resources.patch
+do-not-use-resources.patch
+setup.py.patch
+loading-ui-files.patch
Added: packages/vitables/trunk/debian/patches/setup.py.patch
===================================================================
--- packages/vitables/trunk/debian/patches/setup.py.patch (rev 0)
+++ packages/vitables/trunk/debian/patches/setup.py.patch 2009-07-14 20:23:58 UTC (rev 3273)
@@ -0,0 +1,311 @@
+Patching up setup.py to build documentation and ship icons and *.ui files as
+package data.
+Index: vitables-2.0/setup.py
+===================================================================
+--- vitables-2.0.orig/setup.py 2009-07-13 19:45:02.000000000 +0300
++++ vitables-2.0/setup.py 2009-07-13 19:46:06.000000000 +0300
+@@ -25,8 +25,77 @@
+ import os
+ import glob
+
+-from distutils.core import setup
++from distutils.core import setup, Command
++from distutils.command.build import build
++from distutils.command.install import install
+ from distutils.command.install_data import install_data
++from distutils.command.clean import clean
++from distutils.dist import Distribution
++from distutils.spawn import find_executable, spawn
++from distutils.dir_util import copy_tree
++
++class DocbookDistribution(Distribution):
++ def __init__(self, attrs=None):
++ self.docbooks = None
++ Distribution.__init__(self, attrs)
++
++class BuildDocbook(Command):
++ description = "Build Docbook documentation"
++
++ user_options = [('xsltproc-path=', None, "Path to the XSLT processor"),
++ ('fop-path=', None, "Path to FOP"),
++ ('xsl-style=', None, "Catalogue URI to the XSL style sheet"),
++ ('fop-style=', None, "Catalogue URI for the FOP style sheet")]
++
++ def initialize_options(self):
++ self.xsltproc_path = None
++ self.fop_path = None
++ self.xsl_style = None
++ self.fop_style = None
++
++ def finalize_options(self):
++ if self.xsltproc_path is None:
++ self.xsltproc_path = find_executable("xsltproc")
++ if self.xsltproc_path is None:
++ raise SystemExit, "Unable to find 'xsltproc', needed to generate Docbook documentation."
++
++ if self.fop_path is None:
++ self.fop_path = find_executable("fop")
++ if self.fop_path is None:
++ raise SystemExit, "Unable to find 'fop', needed to generate Docbook HTML documentation."
++
++ if self.xsl_style is None:
++ self.xsl_style = "http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl"
++
++ 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 "###############################################################"
+- sys.exit(1)
+
+ 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 "###############################################################"
+- 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 "###############################################################"
+- sys.exit(1)
+
+ # =================================================================
+
+@@ -126,119 +191,9 @@
+
+ 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
+-# (http://standards.freedesktop.org/basedir-spec) and version 0.11 of
+-# the icon theme specs
+-# (http://www.freedesktop.org/wiki/Standards/icon-theme-spec). If you
+-# find quirks or have suggestions on it, please, report them back.
+-# F. Altet 2006-02-22
+-def unix_icon_dir_lookup():
+-
+- data_dirs_list = []
+- data_dirs = ''
+- if os.getuid() == 0: # Running as root!
+- # Check for a XDG_DATA_DIRS environment variable, just in case the
+- # WM is installed in a non-standard place.
+- if 'XDG_DATA_DIRS' in os.environ:
+- data_dirs = os.environ['XDG_DATA_DIRS']
+- else:
+- # Check whether we should install data in /usr/local or /usr
+- for data_dir in ['/usr/local/share', '/usr/share']:
+- if (os.path.isdir(os.path.join(data_dir, 'icons/hicolor')) and
+- os.path.isdir(os.path.join(data_dir, 'applications'))):
+- data_dirs_list.append(data_dir)
+- data_dirs = ":".join(data_dirs_list)
+- else: # The user is installing as a non-privilegied uid
+- # Check if the user can write in any of the XDG_DATA_DIRS
+- if 'XDG_DATA_DIRS' in os.environ:
+- for data_dir in os.environ['XDG_DATA_DIRS'].split(':'):
+- if os.access(data_dir, os.W_OK):
+- data_dirs_list.append(data_dir)
+- if data_dirs_list != []:
+- # He can write. Choose this as the installation place.
+- data_dirs = ":".join(data_dirs_list)
+-# It is not clear to me whether this is a standard or not. I'll disable
+-# this until I can collect more info about this issue.
+-# else:
+-# # He cannot write there or there are no XDG_DATA_DIRS.
+-# # Try to save icons in the $HOME/.local/share
+-# local_dir = os.path.join(os.environ['HOME'], ".local")
+-# if not os.path.exists(local_dir):
+-# os.mkdir(local_dir)
+-# share_dir = os.path.join(local_dir, "share")
+-# if not os.path.exists(share_dir):
+-# os.mkdir(share_dir)
+-# if os.path.isdir(share_dir):
+-# data_dirs = share_dir
+-
+- return data_dirs
+-
+-# Main function to add icons in UNIX platforms
+-def add_unix_icons():
+-
+- data_dirs = unix_icon_dir_lookup()
+- if data_dirs != "":
+- # Great!, we have found something appropriate to write
+- # Select the first directory found
+- data_dir = data_dirs.split(':')[0]
+- # Copy there the icons
+- # First, the bitmap ones
+- # The bitmap icons doesn't seems to be necessary, as both KDE and Gnome
+- # seems to support scalable icons
+-# for size in ["16x16", "22x22", "32x32", "48x48", "64x64", "128x128"]:
+-# fname = "unixapp/vitables_%s.png" % (size)
+-# dname = os.path.join(data_dir, "icons/hicolor/%s/apps" % (size))
+-# if os.path.isdir(dname):
+-# destname = os.path.join(dname, "vitables.png")
+-# print "@copying cp %s -> %s" % (fname, destname)
+-# os.system("cp %s %s" % (fname, destname))
+- # Then, the scalable icon
+- dname = os.path.join(data_dir, "icons/hicolor/scalable/apps")
+- if os.path.isdir(dname):
+- print "@copying %s -> %s" % ("unixapp/vitables.svgz", dname)
+- os.system("cp %s %s" % ("unixapp/vitables.svgz", dname))
+- # Finally, the .desktop file
+- dname = os.path.join(data_dir, "applications")
+- if os.path.isdir(dname):
+- print "@copying %s -> %s" % ("unixapp/vitables.desktop", dname)
+- os.system("cp %s %s" % ("unixapp/vitables.desktop", dname))
+- 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.
+-
+-"""
+-# End of the code to add the application icons in Unix systems.
+-# =================================================================
+-
+-
+-helpAsked = False
+-for item in ['-h', '--help', '--help-commands', '--help-formats',
+- '--help-compiler']:
+- if item in sys.argv:
+- helpAsked = True
+- break
+-
+-# if not helpAsked:
+-# if not helpAsked:
+-# checkVersions()
+-# checkVersions()
+
+ # Proceed if required libraries are OK
+
+-# Get the version number
+-f = open('VERSION', 'r')
+-vt_version = f.readline()[:-1]
+-f.close()
+-
+ setup_args = {}
+ if use_py2app:
+ setup_args['app'] = ['macosxapp/vitables-app.py']
+@@ -269,8 +224,14 @@
+ ``macosxapp/make.sh`` script.)
+ """
+
+-setup(name = 'vitables', # The name of the distribution
+- version = "%s" % vt_version,
++# Get the version number
++f = open('VERSION', 'r')
++vt_version = f.readline()[:-1]
++f.close()
++
++setup(name = 'ViTables', # The name of the distribution
++ version = "%s" % vt_version,
++ distclass=DocbookDistribution,
+ description = 'A viewer for pytables package',
+ long_description = \
+ """
+@@ -297,7 +258,18 @@
+ 'vitables.preferences', 'vitables.plugins',
+ 'vitables.vtTables', 'vitables.vtWidgets'],
+ scripts = ['scripts/vitables'],
+- cmdclass = {"install_data":smart_install_data},
++ package_data = {
++ 'vitables':['icons/*.*','icons/*/*.*'],
++ 'vitables.preferences':['*.ui'],
++ 'vitables.queries':['*.ui'],
++ 'vitables.docBrowser':['html/*.*','html/*/*.*']
++ },
++ cmdclass = {
++ "install_data":smart_install_data,
++ 'build': Build,
++ 'build_doc': BuildDocbook,
++ },
++ docbooks=['doc/usersguide.xml'],
+ data_files = [
+ ('examples', glob.glob('examples/*.h5')),
+ ('examples/arrays', glob.glob('examples/arrays/*.h5')),
+@@ -307,10 +279,12 @@
+ ('examples/tests', glob.glob('examples/tests/*.h5')),
+ ('examples/timeseries', glob.glob('examples/timeseries/*.h5')),
+ ('doc', ['doc/usersguide.xml']),
+- ('doc', glob.glob('doc/*.pdf')),
+- ('doc/images', glob.glob('doc/images/*.png')),
++ ('doc', ['doc/usersguide.pdf']),
++ # see http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html#install_icons
++ ('share/icons/hicolor/scalable/apps', ['unixapp/vitables.svg']),
++ # see http://library.gnome.org/devel/menu-spec/#third-party-howto
++ ('share/applications', ['unixapp/vitables.desktop']),
+ ('', ['LICENSE.txt', 'LICENSE.html']),
+- ('', ['VERSION'])
+ ],
+
+ **setup_args
+@@ -323,15 +297,20 @@
+ # $ python setup.py build --help
+ # $ python setup.py build --help-compiler
+
++helpAsked = False
++for item in ['-h', '--help', '--help-commands', '--help-formats',
++ '--help-compiler']:
++ if item in sys.argv:
++ helpAsked = True
++ break
++
+ if len(sys.argv) > 1 and not helpAsked:
+ if sys.argv[1] == 'build' :
+ print "\nBuild process completed.\n"
+ elif sys.argv[1] == 'sdist' :
+ print "\nSources package done.\n"
+ elif sys.argv[1] == 'install' :
+- # 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."""
Deleted: packages/vitables/trunk/debian/patches/use_distutils_for_docs.patch
===================================================================
--- packages/vitables/trunk/debian/patches/use_distutils_for_docs.patch 2009-07-14 20:23:49 UTC (rev 3272)
+++ packages/vitables/trunk/debian/patches/use_distutils_for_docs.patch 2009-07-14 20:23:58 UTC (rev 3273)
@@ -1,132 +0,0 @@
-Adding funtions to distutils to build html and pdf documentation simply by using
-setup.py.
-Index: vitables-2.0+hg96+dfsg/setup.py
-===================================================================
---- vitables-2.0+hg96+dfsg.orig/setup.py 2009-05-28 20:04:10.000000000 +0100
-+++ vitables-2.0+hg96+dfsg/setup.py 2009-05-28 21:01:26.000000000 +0100
-@@ -24,9 +24,83 @@
- import sys
- import os
- import glob
-+import shutil
-
--from distutils.core import setup
-+from distutils.core import setup, Command
-+from distutils.command.build import build
-+from distutils.command.install import install
- from distutils.command.install_data import install_data
-+from distutils.command.clean import clean
-+from distutils.dist import Distribution
-+from distutils.spawn import find_executable, spawn
-+from distutils import dir_util
-+
-+class DocbookDistribution(Distribution):
-+ def __init__(self, attrs=None):
-+ self.docbooks = None
-+ Distribution.__init__(self, attrs)
-+
-+class BuildDocbook(Command):
-+ description = "Build Docbook documentation"
-+
-+ user_options = [('xsltproc-path=', None, "Path to the XSLT processor"),
-+ ('fop-path=', None, "Path to FOP"),
-+ ('xsl-style=', None, "Catalogue URI to the XSL style sheet"),
-+ ('fop-style=', None, "Catalogue URI for the FOP style sheet")]
-+
-+ def initialize_options(self):
-+ self.xsltproc_path = None
-+ self.fop_path = None
-+ self.xsl_style = None
-+ self.fop_style = None
-+
-+ def finalize_options(self):
-+ if self.xsltproc_path is None:
-+ self.xsltproc_path = find_executable("xsltproc")
-+ if self.xsltproc_path is None:
-+ raise SystemExit, "Unable to find 'xsltproc', needed to generate Docbook documentation."
-+
-+ if self.fop_path is None:
-+ self.fop_path = find_executable("fop")
-+ if self.fop_path is None:
-+ raise SystemExit, "Unable to find 'fop', needed to generate Docbook HTML documentation."
-+
-+ if self.xsl_style is None:
-+ self.xsl_style = "http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl"
-+
-+ 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(os.path.split(input_file)[1])[0]
-+ input_dir =os.path.dirname(input_file)
-+ remember_location = os.path.abspath(os.path.curdir)
-+
-+ if not os.path.exists(os.path.join(input_dir,"html")):
-+ os.chdir(input_dir)
-+ spawn([self.xsltproc_path, "-o", os.path.join("html", ""), self.xsl_style, input_file_name+".xml"])
-+ spawn([self.xsltproc_path, "-o", input_file_name+".fo", self.fop_style, input_file_name+".xml"])
-+ spawn([self.fop_path, "-q", "-c", "fop_conf.xml", input_file_name+".fo", input_file_name+".pdf"])
-+ shutil.copytree("images",os.path.join("html","images"))
-+ os.chdir(remember_location)
-+
-+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.append(('build_doc', has_docbook))
-
- use_py2app = False
- if sys.platform == 'darwin' and 'py2app' in sys.argv:
-@@ -269,7 +343,9 @@
- ``macosxapp/make.sh`` script.)
- """
-
--setup(name = 'vitables', # The name of the distribution
-+setup(
-+ distclass=DocbookDistribution,
-+ name='vitables', # The name of the distribution
- version = "%s" % vt_version,
- description = 'A viewer for pytables package',
- long_description = \
-@@ -297,8 +373,18 @@
- 'vitables.preferences', 'vitables.plugins',
- 'vitables.vtTables', 'vitables.vtWidgets'],
- scripts = ['scripts/vitables'],
-- cmdclass = {"install_data":smart_install_data},
-+ cmdclass = {
-+ "install_data":smart_install_data,
-+ 'build': Build,
-+ 'build_doc': BuildDocbook,
-+ },
-+ docbooks=[
-+ 'doc/usersguide.xml'
-+ ],
- data_files = [
-+ ('doc', glob.glob('doc/*.pdf')),
-+ ('doc/html', glob.glob('doc/html/*.html')),
-+ ('doc/html/images', glob.glob('doc/html/images/*.png')),
- ('examples', glob.glob('examples/*.h5')),
- ('examples/arrays', glob.glob('examples/arrays/*.h5')),
- ('examples/misc', glob.glob('examples/misc/*.h5')),
-@@ -306,9 +392,6 @@
- ('examples/tables', glob.glob('examples/tables/*.h5')),
- ('examples/tests', glob.glob('examples/tests/*.h5')),
- ('examples/timeseries', glob.glob('examples/timeseries/*.h5')),
-- ('doc', ['doc/usersguide.xml']),
-- ('doc', glob.glob('doc/*.pdf')),
-- ('doc/images', glob.glob('doc/images/*.png')),
- ('', ['LICENSE.txt', 'LICENSE.html']),
- ('', ['VERSION'])
- ],
More information about the Python-apps-commits
mailing list