[python-wtforms] Move the wtforms locale files in /usr/share/locale and adjust wtforms to handle it
Pierre-YvesChibon
pingou at fedoraproject.org
Mon Dec 1 11:00:31 UTC 2014
commit e7d3224a759af5d61a3c43c411e61d51a16809f4
Author: Pierre-Yves Chibon <pingou at pingoured.fr>
Date: Mon Dec 1 11:59:42 2014 +0100
Move the wtforms locale files in /usr/share/locale and adjust wtforms to handle it
143.patch | 33 +++++++++++++++++++++++++++++++++
python-wtforms.spec | 44 ++++++++++++++++++++------------------------
2 files changed, 53 insertions(+), 24 deletions(-)
---
diff --git a/143.patch b/143.patch
new file mode 100644
index 0000000..dcbfa94
--- /dev/null
+++ b/143.patch
@@ -0,0 +1,33 @@
+From 312962b85e3f59117efbdb7d7faf7c1c4ff17f5d Mon Sep 17 00:00:00 2001
+From: Pierre-Yves Chibon <pingou at pingoured.fr>
+Date: Mon, 1 Dec 2014 11:19:45 +0100
+Subject: [PATCH] Adjust messages_path to support having the locale files in
+ /usr/share/locale
+
+Linux distribution normally centralize their locale files in /usr/share/locale
+as a central place.
+With this commit we check if the expected locale directory is present if so we
+use it, otherwise we use /usr/share/locale.
+
+This will allow packager of wtforms in Linux distribution to place the locale
+files in the expected location in their distro
+---
+ wtforms/i18n.py | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/wtforms/i18n.py b/wtforms/i18n.py
+index 3b45aa6..118e416 100644
+--- a/wtforms/i18n.py
++++ b/wtforms/i18n.py
+@@ -6,7 +6,10 @@ def messages_path():
+ Determine the path to the 'messages' directory as best possible.
+ """
+ module_path = os.path.abspath(__file__)
+- return os.path.join(os.path.dirname(module_path), 'locale')
++ locale_path = os.path.join(os.path.dirname(module_path), 'locale')
++ if not os.path.exists(locale_path):
++ locale_path = '/usr/share/locale'
++ return locale_path
+
+
+ def get_builtin_gnu_translations(languages=None):
diff --git a/python-wtforms.spec b/python-wtforms.spec
index eb4b90d..78d8841 100644
--- a/python-wtforms.spec
+++ b/python-wtforms.spec
@@ -5,7 +5,7 @@
Name: python-wtforms
Version: 2.0
-Release: 3%{?dist}
+Release: 4%{?dist}
Summary: Forms validation and rendering library for python
Group: Development/Libraries
@@ -13,6 +13,9 @@ License: BSD
URL: http://wtforms.simplecodes.com/
Source0: http://pypi.python.org/packages/source/W/%{mod_name}/%{mod_name}-%{version}.zip
+# Submitted upstream at https://github.com/wtforms/wtforms/pull/143
+Patch0: 143.patch
+
BuildArch: noarch
BuildRequires: python-devel
BuildRequires: python-setuptools
@@ -39,6 +42,7 @@ and keep those messy parameters out of your python code.
%prep
%setup -q -n %{mod_name}-%{version}
+%patch0 -p1
sed -i "s|\r||g" docs/html/_sources/index.txt
sed -i "s|\r||g" docs/conf.py
sed -i "s|\r||g" docs/Makefile
@@ -63,46 +67,38 @@ popd
%install
%{__python2} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
+mkdir -p %{buildroot}/%{_datadir}
+mv %{buildroot}/%{python_sitelib}/wtforms/locale %{buildroot}%{_datadir}
+find %{buildroot}%{_datadir}/locale -name '*.po*' -delete
+
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
+rm -rf $RPM_BUILD_ROOT/%{python3_sitelib}/wtforms/locale
popd
%endif
%find_lang wtforms
-grep -v %{python3_sitelib} wtforms.lang > python-wtforms.lang
-grep -v %{python_sitelib} wtforms.lang > python3-wtforms.lang
-
-find $RPM_BUILD_ROOT%{python3_sitelib}/wtforms/locale -name "*.po*" -delete
-find $RPM_BUILD_ROOT%{python_sitelib}/wtforms/locale -name "*.po*" -delete
-
-%files -f python-wtforms.lang
+%files -f wtforms.lang
%doc docs/ LICENSE.txt PKG-INFO
%{python_sitelib}/*.egg-info
-%dir %{python_sitelib}/wtforms/
-%{python_sitelib}/wtforms/*.py*
-%{python_sitelib}/wtforms/csrf/
-%{python_sitelib}/wtforms/ext/
-%{python_sitelib}/wtforms/fields/
-%{python_sitelib}/wtforms/widgets/
+%{python_sitelib}/wtforms/
%if 0%{?with_python3}
-%files -n python3-wtforms -f python3-wtforms.lang
+%files -n python3-wtforms -f wtforms.lang
%doc docs/ LICENSE.txt PKG-INFO
%{python3_sitelib}/*.egg-info/
-%dir %{python3_sitelib}/wtforms/
-%{python3_sitelib}/wtforms/*.py*
-%{python3_sitelib}/wtforms/csrf/
-%{python3_sitelib}/wtforms/ext/
-%{python3_sitelib}/wtforms/fields/
-%{python3_sitelib}/wtforms/widgets/
-%{python3_sitelib}/wtforms/__pycache__/
-
+%{python3_sitelib}/wtforms/
%endif
%changelog
-* Sun Jun 08 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.0-3
+* Mon Dec 01 2014 Pierre-Yves Chibon <pingou at pingoured.fr> - 2.0-4
+- Move the locale files into /usr/share/locale we will still have the same files
+ present in both the py2 and py3 but a) they are completely identical so no
+ conflicts from RPM and b) they are now in the proper place, system-wise
+
+* Sun Jun 08 2014 Fedora Release Engineering <rel-eng at lists.fdoraproject.org> - 2.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Wed May 28 2014 Kalev Lember <kalevlember at gmail.com> - 2.0-2
More information about the scm-commits
mailing list