python-sphinx/python-sphinx-0.6.5_move_locale_files_outside_sitelib.patch
Toshio くらとみ e361c26ece - Few minor tweaks to Gareth's spec file update
Mon May 10 2010 Gareth Armstrong <gareth.armstrong@hp.com> - 0.6.5-1.hp
- Update to 0.6.5
- Initial import of python-sphinx from Fedora Rawhide for use in HP CMS
- Enforce that Sphinx requires Python 2.4 or later via an explicit BR
- Minor tweaks to spec file
- Move language files to %%{_datadir}, idea borrowed from Debian's sphinx
    package
- Deliver man pages for sphinx-build & sphinx-quickstart
- Deliver rst documentation files to reST directory in doc sub-package
- Add %%check section for Python2 and add BR on python-nose
2010-05-22 01:08:12 +00:00

57 lines
2.3 KiB
Diff

# HG changeset patch
# Parent 552e51b26229a9a918c76a401f2f487bf81f2ee6
Index: Sphinx-0.6.5/sphinx/builders/html.py
===================================================================
--- Sphinx-0.6.5.orig/sphinx/builders/html.py
+++ Sphinx-0.6.5/sphinx/builders/html.py
@@ -10,6 +10,7 @@
"""
import os
+import sys
import codecs
import posixpath
import cPickle as pickle
@@ -91,10 +92,15 @@ class StandaloneHTMLBuilder(Builder):
self.link_suffix = self.out_suffix
if self.config.language is not None:
- jsfile = path.join(package_dir, 'locale', self.config.language,
- 'LC_MESSAGES', 'sphinx.js')
- if path.isfile(jsfile):
- self.script_files.append('_static/translations.js')
+ jsfile_list = [path.join(package_dir, 'locale',
+ self.config.language, 'LC_MESSAGES', 'sphinx.js'),
+ path.join(sys.prefix, 'share/sphinx/locale',
+ self.config.language, 'sphinx.js')]
+
+ for jsfile in jsfile_list:
+ if path.isfile(jsfile):
+ self.script_files.append('_static/translations.js')
+ break
def init_templates(self):
Theme.init_themes(self)
@@ -528,11 +534,15 @@ class StandaloneHTMLBuilder(Builder):
f.close()
# then, copy translations JavaScript file
if self.config.language is not None:
- jsfile = path.join(package_dir, 'locale', self.config.language,
- 'LC_MESSAGES', 'sphinx.js')
- if path.isfile(jsfile):
- copyfile(jsfile, path.join(self.outdir, '_static',
- 'translations.js'))
+ jsfile_list = [path.join(package_dir, 'locale',
+ self.config.language, 'LC_MESSAGES', 'sphinx.js'),
+ path.join(sys.prefix, 'share/sphinx/locale',
+ self.config.language, 'sphinx.js')]
+ for jsfile in jsfile_list:
+ if path.isfile(jsfile):
+ copyfile(jsfile, path.join(self.outdir, '_static',
+ 'translations.js'))
+ break
# then, copy over all user-supplied static files
if self.theme:
staticdirnames = [path.join(themepath, 'static')