rpm/find-lang-python.patch

91 lines
3.1 KiB
Diff
Raw Normal View History

Support for finding Python translation files in %python_sitelib
or %python_sitearch.
Sascha Peilicke <speilicke@suse.com>
--- ./scripts/find-lang.sh.orig 2017-01-19 13:07:41.062796290 +0000
+++ ./scripts/find-lang.sh 2017-01-19 13:07:48.561774470 +0000
@@ -35,6 +35,7 @@ Additional options:
--without-gnome do not find GNOME help files
--with-mate find MATE help files
--without-kde do not find KDE help files
+ --with-python find Python translation files
--with-qt find Qt translation files
--with-html find HTML files
--with-man find localized man pages
@@ -61,6 +62,7 @@ shift
GNOME=
MATE=#
KDE=
+PYTHON=#
QT=#
MAN=#
HTML=#
@@ -93,6 +95,10 @@ while test $# -gt 0 ; do
KDE=#
shift
;;
+ --with-python )
+ PYTHON=
+ shift
+ ;;
--with-qt )
QT=
shift
@@ -136,21 +142,25 @@ MO_NAME_NEW=$MO_NAME.tmp.$$
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"'::
@@ -201,6 +211,16 @@ s:'"$TOP_DIR"'::
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