rpm/find-lang-python.patch
Stephan Kulow 1e0c9ffdb8 Accepting request 206471 from home:saschpe:branches:Base:System
Hi Micha, please provide some feedback on the following patch.

I would like to properly mark Python translations that are found in
%python_sitelib/sitearch. It's sort of common that Python modules
have their i18n/i10n files inside their module directory (and not in
/usr/share/locale).

- Add find-lang-python.patch: Support for finding translations in
  %python_sitelib/python_sitearch.

OBS-URL: https://build.opensuse.org/request/show/206471
OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=306
2013-11-20 11:31:44 +00:00

91 lines
3.0 KiB
Diff

Support for finding Python translation files in %python_sitelib
or %python_sitearch.
Sascha Peilicke <speilicke@suse.com>
--- scripts/find-lang.sh 2013-09-27 20:04:33.000000000 +0200
+++ scripts/find-lang.sh-new 2013-11-07 18:35:39.879014359 +0100
@@ -32,6 +32,7 @@
Additional options:
--without-gnome do not find GNOME help files
--without-kde do not find KDE help files
+ --with-python find Python translation files
--with-qt find Qt translation files
--with-man find localized man pages
--all-name match all package/domain names
@@ -56,6 +57,7 @@
GNOME=
KDE=
+PYTHON=#
QT=#
MAN=#
MO=
@@ -83,6 +85,10 @@
KDE=#
shift
;;
+ --with-python )
+ PYTHON=
+ shift
+ ;;
--with-qt )
QT=
shift
@@ -122,21 +128,25 @@
rm -f $MO_NAME_NEW
# remove languages we do not yet support - but give out statistics
-find "$TOP_DIR/usr/share/locale/" -maxdepth 1 -type d | sed 's:'"$TOP_DIR"/usr/share/locale/'::; /^$/d' | while read dir; do
- if ! rpm -ql filesystem | egrep -q "/usr/share/locale/$dir"$; then
- find $TOP_DIR/usr/share/locale/$dir -name *.mo | sed 's:'"$TOP_DIR"'::' | while read file; do
- echo -n "removing translation $file: "
- msgunfmt "$TOP_DIR/$file" | msgfmt --statistics -o /dev/null -
+if [ -d "$TOP_DIR/usr/share/locale/" ] ; then
+ find "$TOP_DIR/usr/share/locale/" -maxdepth 1 -type d | sed 's:'"$TOP_DIR"/usr/share/locale/'::; /^$/d' | while read dir; do
+ if ! rpm -ql filesystem | egrep -q "/usr/share/locale/$dir"$; then
+ find $TOP_DIR/usr/share/locale/$dir -name *.mo | sed 's:'"$TOP_DIR"'::' | while read file; do
+ echo -n "removing translation $file: "
+ msgunfmt "$TOP_DIR/$file" | msgfmt --statistics -o /dev/null -
+ done
+ rm -rf $TOP_DIR/usr/share/locale/$dir
+ fi
done
- rm -rf $TOP_DIR/usr/share/locale/$dir
- fi
-done
-find $TOP_DIR/usr/share/help/ -maxdepth 1 -type d | sed 's:'"$TOP_DIR"/usr/share/help/'::; /^$/d' | while read dir; do
- if ! rpm -ql filesystem | egrep -q "/usr/share/help/$dir"$; then
- echo "removing help translation /usr/share/help/$dir"
- rm -rf $TOP_DIR/usr/share/help/$dir
- fi
-done
+fi
+if [ -d "$TOP_DIR/usr/share/help/" ] ; then
+ find $TOP_DIR/usr/share/help/ -maxdepth 1 -type d | sed 's:'"$TOP_DIR"/usr/share/help/'::; /^$/d' | while read dir; do
+ if ! rpm -ql filesystem | egrep -q "/usr/share/help/$dir"$; then
+ echo "removing help translation /usr/share/help/$dir"
+ rm -rf $TOP_DIR/usr/share/help/$dir
+ fi
+ done
+fi
find "$TOP_DIR" -type f -o -type l|sed '
s:'"$TOP_DIR"'::
@@ -187,6 +197,16 @@
s:^[^%].*::
'"$ONLY_C"'/%lang(C)/!d
'"$NO_C"'/%lang(C)/d
+s:%lang(C) ::
+/^$/d' >> $MO_NAME_NEW
+
+find "$TOP_DIR" -type f -o -type l|sed '
+s:'"$TOP_DIR"'::
+'"$NO_ALL_NAME$PYTHON"'s:\(/usr/lib.*/python.*/site-packages/'"$NAME"'$\):%dir \1:
+'"$ALL_NAME$PYTHON"'s:\(/usr/lib.*/python.*/site-packages/[a-zA-Z0-9.\_\-]\+$\):%dir \1:
+s:^[^%].*::
+'"$ONLY_C"'/%lang(C)/!d
+'"$NO_C"'/%lang(C)/d
s:%lang(C) ::
/^$/d' >> $MO_NAME_NEW