Fix warnings related to po (issue 551830043 by jonas.hahnfeld@gmail.com)

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Fix warnings related to po (issue 551830043 by jonas.hahnfeld@gmail.com)

Dev mailing list
LGTM, thanks a lot!


https://codereview.appspot.com/551830043/diff/573740043/po/GNUmakefile
File po/GNUmakefile (right):

https://codereview.appspot.com/551830043/diff/573740043/po/GNUmakefile#newcode14
po/GNUmakefile:14: sed-makestuff = -e 's/[a-zA-Z_/]*make\[[0-9]*\].*//'
shouldn't this be rather '[0-9]\+'?

https://codereview.appspot.com/551830043/diff/573740043/po/GNUmakefile#newcode15
po/GNUmakefile:15: sed-edstuff = -e 's/[ \.,adic0-9]*//' -e 's/---//' |
sort -u
I think that within '[...]' you don't have to escape '.'.

And again I would use '\+' instead of '*'.

https://codereview.appspot.com/551830043/

Reply | Threaded
Open this post in threaded view
|

Re: Fix warnings related to po (issue 551830043 by jonas.hahnfeld@gmail.com)

jonas.hahnfeld
Reviewers: lemzwerg,

Message:
On 2020/04/24 18:25:33, lemzwerg wrote:
> LGTM, thanks a lot!
>
> https://codereview.appspot.com/551830043/diff/573740043/po/GNUmakefile
> File po/GNUmakefile (right):
>
>
https://codereview.appspot.com/551830043/diff/573740043/po/GNUmakefile#newcode14
> po/GNUmakefile:14: sed-makestuff = -e
's/[a-zA-Z_/]*make\[[0-9]*\].*//'
> shouldn't this be rather '[0-9]\+'?
>
>
https://codereview.appspot.com/551830043/diff/573740043/po/GNUmakefile#newcode15
> po/GNUmakefile:15: sed-edstuff = -e 's/[ \.,adic0-9]*//' -e 's/---//'
| sort -u
> I think that within '[...]' you don't have to escape '.'.
>
> And again I would use '\+' instead of '*'.

To be honest, I have no clue what all of this is doing: I copied it from
stepmake/stepmake/podir-targets.make.

Description:
Fix warnings related to po

Individual commits:
1) Build lilypond-doc in Documentation/po

This avoids warning messages from langdefs.py which tries to load
that locale domain and is also imported during a 'normal' build
while producing the .texi and .info files in Documentation/.

2) Inline po-* targets into po/

Documentation/po/ has a custom po-update.

Please review this at https://codereview.appspot.com/551830043/

Affected files (+35, -57 lines):
  M Documentation/po/GNUmakefile
  M GNUmakefile.in
  M make/lilypond-vars.make
  M po/GNUmakefile
  M stepmake/stepmake/generic-targets.make
  M stepmake/stepmake/podir-targets.make
  M stepmake/stepmake/podir-vars.make


Index: Documentation/po/GNUmakefile
diff --git a/Documentation/po/GNUmakefile b/Documentation/po/GNUmakefile
index 24dbf6d0580acf952034f2ac9ef0206db664becc..dfdade4e3779b613d5ce107324d6e548b74f220d 100644
--- a/Documentation/po/GNUmakefile
+++ b/Documentation/po/GNUmakefile
@@ -7,7 +7,6 @@ include $(depth)/make/stepmake.make
 
 doc-localedir=$(outdir)
 LANGS = $(shell $(PYTHON) $(top-src-dir)/python/langdefs.py)
-DOMAIN=lilypond-doc
 DOC_PO_SOURCES = python/auxiliar/postprocess_html.py \
  scripts/auxiliar/tely-gettext.py scripts/auxiliar/translations-status.py
 TELY_FILES = $(shell ls $(depth)/Documentation/*.tely)
@@ -22,7 +21,7 @@ $(outdir)/messages: $(MO_FILES)
  for i in $(CATALOGS); do \
   rm -rf $(doc-localedir)/$$i/LC_MESSAGES; \
   mkdir -p $(doc-localedir)/$$i/LC_MESSAGES; \
-  $(LN) $(outdir)/$$i.mo $(doc-localedir)/$$i/LC_MESSAGES/$(DOMAIN).mo; \
+  $(LN) $(outdir)/$$i.mo $(doc-localedir)/$$i/LC_MESSAGES/lilypond-doc.mo; \
  done
  touch $@
 
@@ -32,10 +31,6 @@ po-update:
  cd $(outdir) && xgettext --keyword=_doc -cjn -L Python -o buildscripts.pot $(foreach i, $(DOC_PO_SOURCES), $(notdir $(i)))
  msgcat -o $(outdir)/doc.pot $(outdir)/buildscripts.pot $(outdir)/texi.pot
  msgmerge -U lilypond-doc.pot $(outdir)/doc.pot
- for i in $(CATALOGS); do \
-  msgmerge -U $$i.po lilypond-doc.pot; \
+ for i in $(PO_FILES); do \
+  msgmerge -U $$i lilypond-doc.pot; \
  done
-
-ifeq ($(out),www)
-local-WWW-1: messages
-endif
Index: GNUmakefile.in
diff --git a/GNUmakefile.in b/GNUmakefile.in
index 7e40c62db34d7b26e510c5633ef81ef82cf3d42d..67ea83d1979754e98c3ed86b28754ea70430b205 100644
--- a/GNUmakefile.in
+++ b/GNUmakefile.in
@@ -184,14 +184,10 @@ src-ext = c cc yy ll hh icc py scm tex ps texi itexi tely itely sh
 
 doc-clean: snippets-clean $(tree-share-prefix)/lilypond-force
 
-default: $(config_h) build-dir-setup
+default: $(config_h) build-dir-setup doc-messages
 
 build-dir-setup: $(tree-share-prefix)/lilypond-force
 
-PO_FILES = $(call src-wildcard,$(src-depth)/po/*.po)
-HELP_CATALOGS = $(PO_FILES:po/%.po=%)
-CATALOGS = $(HELP_CATALOGS:lilypond=)
-
 # Preparing LilyPond tree for build-dir exec
 link-tree: $(tree-share-prefix)/lilypond-force
 
@@ -230,10 +226,6 @@ $(tree-share-prefix)/lilypond-force: GNUmakefile $(outdir)/VERSION
  -cd $(tree-share-prefix)/elisp && \
  ln -sf ../../../../../elisp/$(outconfbase)/lilypond-words.el . && \
  ln -s $(top-src-dir)/elisp/*.el .
- $(foreach i,$(CATALOGS), \
- (mkdir -p $(tree-share)/locale/$i/LC_MESSAGES && \
- cd $(tree-share)/locale/$i/LC_MESSAGES && \
- ln -sf ../../../../../po/$(outconfbase)/$i.mo lilypond.mo) &&) true
  touch $(tree-share-prefix)/lilypond-force
 
 link-mf-tree: $(tree-share-prefix)/mf-link-tree
Index: make/lilypond-vars.make
diff --git a/make/lilypond-vars.make b/make/lilypond-vars.make
index 23d882f7f10034c3c536c5dd4aac4d40b8e82ff1..3ae7ed3db54a3663f9d29c2874800f323b00bfe3 100644
--- a/make/lilypond-vars.make
+++ b/make/lilypond-vars.make
@@ -81,7 +81,7 @@ export TEXINPUTS
 TEXFONTMAPS=$(top-build-dir)/tex/$(outdir)::
 export TEXFONTMAPS
 
-export LYDOC_LOCALEDIR:= $(top-build-dir)/Documentation/po/out-www
+export LYDOC_LOCALEDIR:= $(top-build-dir)/Documentation/po/out
 
 #texi-html for www only:
 LILYPOND_BOOK_FORMAT=$(if $(subst out-www,,$(notdir $(outdir))),texi,texi-html)
Index: po/GNUmakefile
diff --git a/po/GNUmakefile b/po/GNUmakefile
index 85eee9ccfde012b9ada66da13359d5e452fb8552..6183c3f46bd55bee0bc319001cf0078266cc2400 100644
--- a/po/GNUmakefile
+++ b/po/GNUmakefile
@@ -3,9 +3,6 @@
 
 depth = ..
 
-NAME = lilypond
-MODULE_NAME = po
-DOMAIN = $(NAME)
 EXTRA_DIST_FILES = TODO README
 STEPMAKE_TEMPLATES=podir
 
@@ -13,16 +10,39 @@ include $(depth)/make/stepmake.make
 
 default: $(MO_FILES)
 
+sed-pofile = -e 's/^\#: .*//'
+sed-makestuff = -e 's/[a-zA-Z_/]*make\[[0-9]*\].*//'
+sed-edstuff = -e 's/[ \.,adic0-9]*//' -e 's/---//' | sort -u
+
+po-update:
+ $(foreach i,$(PO_FILES), \
+  rm -f $(po-outdir)/$(i); \
+  msgmerge $(po-srcdir)/$(i) $(po-outdir)/lilypond.po \
+    -o $(po-outdir)/$(i) && ) true
+ @$(foreach i,$(CATALOGS), \
+  changes=`$(MAKE) --silent -C $(po-outdir)/.. LANGUAGE=$i po-changes $(ERROR_LOG) | sed $(sed-makestuff)`; \
+  if test "$$changes" != "" ; then \
+    echo "*** Changes for language $i; check $(po-outdir)/$i.po ***"; \
+    echo -e "changes: \`$$changes'";\
+  fi && ) true
+
+po-changes:
+ diff -e $(po-outdir)/$(LANGUAGE).po $(po-srcdir)/$(LANGUAGE).po \
+  | sed $(sed-pofile) $(sed-edstuff)
+
+po-replace: po-update
+ mv $(outdir)/lilypond.po lilypond.pot
+
 local-install: $(MO_FILES)
  for i in $(CATALOGS); do \
   $(INSTALL) -d $(DESTDIR)$(localedir)/$$i/LC_MESSAGES; \
   $(INSTALL) -m 644 $(outdir)/$$i.mo \
-       $(DESTDIR)$(localedir)/$$i/LC_MESSAGES/$(NAME).mo; \
+       $(DESTDIR)$(localedir)/$$i/LC_MESSAGES/lilypond.mo; \
  done
 
 local-uninstall:
  for i in $(CATALOGS); do \
-  rm -f $(DESTDIR)$(localedir)/$$i/LC_MESSAGES/$(NAME).mo; \
+  rm -f $(DESTDIR)$(localedir)/$$i/LC_MESSAGES/lilypond.mo; \
   rmdir $(DESTDIR)$(localedir)/$$i/LC_MESSAGES || true; \
  done
 
Index: stepmake/stepmake/generic-targets.make
diff --git a/stepmake/stepmake/generic-targets.make b/stepmake/stepmake/generic-targets.make
index b1fe583cbf8eace3161e33c8ee6ebc0d7bb786e6..1adb96c821c5a775c953af8a1fb2bfe464b460f6 100644
--- a/stepmake/stepmake/generic-targets.make
+++ b/stepmake/stepmake/generic-targets.make
@@ -173,8 +173,10 @@ local-doc:
  $(MAKE) out=www local-WWW-2
  $(MAKE) out=www WWW-post
 
-doc-stage-1:
- $(MAKE) -C $(top-build-dir)/Documentation/po out=www messages
+doc-messages:
+ $(MAKE) -C $(top-build-dir)/Documentation/po messages
+
+doc-stage-1: doc-messages
  $(MAKE) out=www WWW-1
 
 doc-clean:
Index: stepmake/stepmake/podir-targets.make
diff --git a/stepmake/stepmake/podir-targets.make b/stepmake/stepmake/podir-targets.make
index fd66e55809d79d6c30532090fa8b1d01dc9eb9aa..e1e367a4aa5b365683f48f4ee7ba48df227a047d 100644
--- a/stepmake/stepmake/podir-targets.make
+++ b/stepmake/stepmake/podir-targets.make
@@ -1,31 +1,4 @@
-
 .SUFFIXES: .po .pot .mo
 
 $(outdir)/%.mo: %.po
  $(MSGFMT) -o $@ $<
-
-# sed-pofile = sed 's/^. \#: .*//'
-sed-pofile = -e 's/^\#: .*//'
-sed-makestuff = -e 's/[a-zA-Z_/]*make\[[0-9]*\].*//'
-sed-edstuff = -e 's/[ \.,adic0-9]*//' -e 's/---//' | sort -u
-
-
-po-update:
- $(foreach i,$(CATALOGS), \
-  rm -f $(po-outdir)/$(i).po; \
-  msgmerge $(po-srcdir)/$(i).po $(po-outdir)/$(package).po \
-    -o $(po-outdir)/$(i).po && ) true
- @$(foreach i,$(CATALOGS), \
-  changes=`$(MAKE) --silent -C $(po-outdir)/.. LANGUAGE=$i po-changes $(ERROR_LOG) | sed $(sed-makestuff)`; \
-  if test "$$changes" != "" ; then \
-    echo "*** Changes for language $i; check $(po-outdir)/$i.po ***"; \
-    echo -e "changes: \`$$changes'";\
-  fi && ) true
-
-
-po-changes:
- diff -e $(po-outdir)/$(LANGUAGE).po $(po-srcdir)/$(LANGUAGE).po \
-  | sed $(sed-pofile) $(sed-edstuff)
-
-po-replace: po-update
- mv $(outdir)/$(package).po $(package).pot
Index: stepmake/stepmake/podir-vars.make
diff --git a/stepmake/stepmake/podir-vars.make b/stepmake/stepmake/podir-vars.make
index cdb95a45e8942c3a3f590c12124827e877f9adc5..9d03b447ed33d9e6eb4c68d1238412ddab5fd751 100644
--- a/stepmake/stepmake/podir-vars.make
+++ b/stepmake/stepmake/podir-vars.make
@@ -1,8 +1,4 @@
-# empty
-
-POT_FILES = $(call src-wildcard,*.pot)
 PO_FILES = $(call src-wildcard,*.po)
 MO_FILES = $(addprefix $(outdir)/, $(PO_FILES:.po=.mo))
 
-HELP_CATALOGS = $(PO_FILES:%.po=%)
-CATALOGS = $(HELP_CATALOGS:$(DOMAIN)=)
+CATALOGS = $(PO_FILES:%.po=%)



Reply | Threaded
Open this post in threaded view
|

Re: Fix warnings related to po (issue 551830043 by jonas.hahnfeld@gmail.com)

jonas.hahnfeld
In reply to this post by Dev mailing list
On 2020/04/24 20:14:36, hahnjo wrote:
> On 2020/04/24 18:25:33, lemzwerg wrote:
> > LGTM, thanks a lot!
> >
> >
https://codereview.appspot.com/551830043/diff/573740043/po/GNUmakefile
> > File po/GNUmakefile (right):
> >
> >
>
https://codereview.appspot.com/551830043/diff/573740043/po/GNUmakefile#newcode14
> > po/GNUmakefile:14: sed-makestuff = -e
's/[a-zA-Z_/]*make\[[0-9]*\].*//'
> > shouldn't this be rather '[0-9]\+'?
> >
> >
>
https://codereview.appspot.com/551830043/diff/573740043/po/GNUmakefile#newcode15
> > po/GNUmakefile:15: sed-edstuff = -e 's/[ \.,adic0-9]*//' -e
's/---//' | sort
> -u
> > I think that within '[...]' you don't have to escape '.'.
> >
> > And again I would use '\+' instead of '*'.
>
> To be honest, I have no clue what all of this is doing: I copied it
from
> stepmake/stepmake/podir-targets.make.

After looking through the code once more, this sed magic is only used
for po-changes. This spams the output when running po-update which is
pointless IMO because the one updating lilypond.pot is not going to
update all languages at the same time. Thus, I'm dropping it in the
updated patch set.

https://codereview.appspot.com/551830043/

Reply | Threaded
Open this post in threaded view
|

Re: Fix warnings related to po (issue 551830043 by jonas.hahnfeld@gmail.com)

David Kastrup
In reply to this post by Dev mailing list
On 2020/04/25 08:36:02, hahnjo wrote:
> On 2020/04/24 20:14:36, hahnjo wrote:
> > On 2020/04/24 18:25:33, lemzwerg wrote:
> > > LGTM, thanks a lot!
> > >
> > >
https://codereview.appspot.com/551830043/diff/573740043/po/GNUmakefile
> > > File po/GNUmakefile (right):
> > >
> > >
> >
>
https://codereview.appspot.com/551830043/diff/573740043/po/GNUmakefile#newcode14
> > > po/GNUmakefile:14: sed-makestuff = -e
's/[a-zA-Z_/]*make\[[0-9]*\].*//'
> > > shouldn't this be rather '[0-9]\+'?
> > >
> > >
> >
>
https://codereview.appspot.com/551830043/diff/573740043/po/GNUmakefile#newcode15
> > > po/GNUmakefile:15: sed-edstuff = -e 's/[ \.,adic0-9]*//' -e
's/---//' | sort
> > -u
> > > I think that within '[...]' you don't have to escape '.'.
> > >
> > > And again I would use '\+' instead of '*'.
> >
> > To be honest, I have no clue what all of this is doing: I copied it
from
> > stepmake/stepmake/podir-targets.make.
>
> After looking through the code once more, this sed magic is only used
for
> po-changes. This spams the output when running po-update which is
pointless IMO
> because the one updating lilypond.pot is not going to update all
languages at
> the same time. Thus, I'm dropping it in the updated patch set.

At any rate, I don't think the backslash is intended to escape the
period rather than just be literally enclosed in the character list.
Some people tend to do this in the form of the redundant \\ in order to
not confuse human readers and almost but not quite syntax-aware editors,
but with regard to the actual interpretation, it is not doing anything.
Not even escaping the backslash itself: something like [A-\\-~] is still
two ranges rather than a single range followed by two isolated
characters, the interpretation that would result from "proper" backslash
escaping.

https://codereview.appspot.com/551830043/