rpms/python-formencode/EL-5 formencode-translations-system.patch, NONE, 1.1 python-formencode.spec, 1.17, 1.18 python-formencode-0.7-badurl.patch, 1.1, NONE

Toshio くらとみ toshio at fedoraproject.org
Fri Aug 29 01:10:56 UTC 2008


Author: toshio

Update of /cvs/pkgs/rpms/python-formencode/EL-5
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv2604/EL-5

Modified Files:
	python-formencode.spec 
Added Files:
	formencode-translations-system.patch 
Removed Files:
	python-formencode-0.7-badurl.patch 
Log Message:

* Thu Aug 28 2008 Toshio Kuratomi <toshio at fedoraproject.org> 1.0.1-2
- Clean up license tag
- Fix executable in %doc
- Move translations to the proper directory


formencode-translations-system.patch:

--- NEW FILE formencode-translations-system.patch ---
Index: FormEncode-1.0.1/formencode/api.py
===================================================================
--- FormEncode-1.0.1.orig/formencode/api.py
+++ FormEncode-1.0.1/formencode/api.py
@@ -17,17 +17,36 @@ __all__ = ['NoDefault', 'Invalid', 'Vali
 import gettext
 
 def get_localedir():
+    """
+    Retrieve the location of locales.
+
+    If we're built as an egg, we need to find the resource within the egg.
+    Otherwise, we need to look for the locales on the filesystem or in the
+    system message catalog.
+    """
+    locale_dir = ''
+    # Check the egg first
     if resource_filename is not None:
         try:
-            return resource_filename(__name__, "/i18n")
+            locale_dir = resource_filename(__name__, "/i18n")
         except NotImplementedError:
             # resource_filename doesn't work with non-egg zip files
             pass
-    return os.path.join(os.path.dirname(__file__), 'i18n')
+    if os.access(locale_dir, os.R_OK | os.X_OK):
+        # If the resource is present in the egg, use it
+        return locale_dir
+
+    # Otherwise, search the filesystem
+    locale_dir = os.path.join(os.path.dirname(__file__), 'i18n')
+    if not os.access(locale_dir, os.R_OK | os.X_OK):
+        # Fallback on the system catalog
+        locale_dir = os.path.normpath('/usr/share/locale')
+
+    return locale_dir
 
 def set_stdtranslation(domain="FormEncode", languages=None, \
                        localedir = get_localedir()):
-    
+
     t = gettext.translation(domain=domain, \
                             languages=languages, \
                             localedir=localedir, fallback=True)


Index: python-formencode.spec
===================================================================
RCS file: /cvs/pkgs/rpms/python-formencode/EL-5/python-formencode.spec,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- python-formencode.spec	28 Aug 2008 17:37:54 -0000	1.17
+++ python-formencode.spec	29 Aug 2008 01:10:26 -0000	1.18
@@ -1,21 +1,26 @@
 %{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
 %{!?pyver: %define pyver %(%{__python} -c "import sys ; print sys.version[:3]")}
 
+%define srcname FormEncode
+
 Name:           python-formencode
 Version:        1.0.1
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        HTML form validation, generation, and convertion package  
 
 Group:          Development/Libraries
-License:        PSF
+License:        Python
 URL:            http://formencode.org/
-Source0:        http://cheeseshop.python.org/packages/source/F/FormEncode/FormEncode-%{version}.tar.gz
+Source0:        http://cheeseshop.python.org/packages/source/F/%{srcname}/%{srcname}-%{version}.tar.gz
+Patch0:         formencode-translations-system.patch
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root
 BuildArch:      noarch
 
 Requires: python-setuptools
-BuildRequires: python-devel python-setuptools-devel
+BuildRequires: python-devel
+BuildRequires: python-setuptools-devel
+BuildRequires: python-docutils
 
 
 %description
@@ -24,7 +29,8 @@
 for filling and generating forms.
 
 %prep
-%setup -q -n FormEncode-%{version}
+%setup -q -n %{srcname}-%{version}
+%patch0 -p1 -b .locale
 
 %build
 %{__python} setup.py build
@@ -34,18 +40,44 @@
 rm -rf $RPM_BUILD_ROOT
 %{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT
 
+# Build the docs then throw out the script
+pushd docs
+sed -i 's/rst2html.py/rst2html/' build
+./build
+rm -rf build
+popd
+
+# bah.  setuptools resource badness
+# Luckily ian bicking wrote the lookup for this to correctly fallback on the
+# system catalog
+for file in $RPM_BUILD_ROOT%{python_sitelib}/formencode/i18n/* ; do
+    if [ -d $file ] ; then
+        if [ -e $file/LC_MESSAGES/%{srcname}.mo ] ; then
+            mkdir -p $RPM_BUILD_ROOT%{_datadir}/locale/`basename $file`/LC_MESSAGES/
+            mv $file/LC_MESSAGES/%{srcname}.mo $RPM_BUILD_ROOT%{_datadir}/locale/`basename $file`/LC_MESSAGES/
+        fi
+    fi
+done
+rm -rf $RPM_BUILD_ROOT%{python_sitelib}/formencode/i18n
+
+%find_lang %{srcname}
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 
-%files
+%files -f %{srcname}.lang
 %defattr(-,root,root,-)
 %doc PKG-INFO docs
 %{python_sitelib}/formencode
-%{python_sitelib}/FormEncode-%{version}-py%{pyver}.egg-info
+%{python_sitelib}/%{srcname}-%{version}-py%{pyver}.egg-info
 
 %changelog
+* Thu Aug 28 2008 Toshio Kuratomi <toshio at fedoraproject.org> 1.0.1-2
+- Clean up license tag
+- Fix executable in %%doc
+- Move translations to the proper directory
+
 * Fri Jul 11 2008 Toshio Kuratomi <toshio at fedoraproject.org> 1.0.1-1
 - Update to 1.0.1
 - Fixes issue where chained_validators were silently ignored.  (bz#454988)


--- python-formencode-0.7-badurl.patch DELETED ---




More information about the fedora-extras-commits mailing list