configure.ac              |    2 +-
 loleaflet/Makefile.am     |   33 +++++++++++++++------------------
 loleaflet/util/po2json.py |    8 ++++++++
 3 files changed, 24 insertions(+), 19 deletions(-)

New commits:
commit 21192c4306d8b6c5e2bc0db04c2f0a3b18f8de06
Author: Jan Holesovsky <ke...@collabora.com>
Date:   Fri May 5 11:18:26 2017 +0200

    Generate the l10n json files only when the appropriate po's change.
    
    Change-Id: I17c0f022775ec631e6493ba81fa41752f6841188

diff --git a/configure.ac b/configure.ac
index 391f23ea..4da3f4e9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6,7 +6,7 @@ AC_PREREQ([2.69])
 AC_INIT([loolwsd], [master], [libreoffice@lists.freedesktop.org])
 LT_INIT([shared, disable-static, dlopen])
 
-AM_INIT_AUTOMAKE([1.11 silent-rules subdir-objects tar-pax])
+AM_INIT_AUTOMAKE([1.11 silent-rules subdir-objects tar-pax -Wno-portability])
 
 AC_CONFIG_MACRO_DIR([m4])
 
diff --git a/loleaflet/Makefile.am b/loleaflet/Makefile.am
index cb458d68..87c39079 100644
--- a/loleaflet/Makefile.am
+++ b/loleaflet/Makefile.am
@@ -8,42 +8,39 @@ DRAW_VERSION=0.2.4
 
 MINIFY=false
 
+L10N_PO = $(wildcard po/*.po)
+L10N_JSON = $(patsubst po/%.po,dist/l10n/%.json,$(L10N_PO))
+
+L10N_STYLES_PO = $(wildcard po/styles/*.po)
+L10N_STYLES_JSON = $(patsubst 
po/styles/%.po,dist/l10n/styles/%.json,$(L10N_STYLES_PO))
+
 EXTRA_DIST = $(shell git ls-files)
 
-all-local: node_modules build-l10n
+all-local: node_modules $(L10N_JSON) $(L10N_STYLES_JSON)
        rm -rf dist/plugins/draw-$(DRAW_VERSION) && mkdir -p 
dist/plugins/draw-$(DRAW_VERSION)
        cd plugins/draw-$(DRAW_VERSION) && jake build && cp -ar dist 
../../dist/plugins/draw-$(DRAW_VERSION)
        jake build debug=$(ENABLE_DEBUG) minify=$(MINIFY)
 
-       mkdir -p dist/l10n/styles
-       mv po/*.json dist/l10n/
-       mv po/styles/*.json dist/l10n/styles/
-
 node_modules: npm-shrinkwrap.json
        npm install
        touch node_modules
 
-.PHONY: build-l10n
-build-l10n:
-       util/po2json.py --quiet po/*.po
-       util/po2json.py --quiet po/styles/*.po
+dist/l10n/%.json: po/%.po
+       @util/po2json.py $< -o $@
 
-.PHONY: move-l10n-to-dist
-move-l10n-to-dist:
-       mv po/*.json dist/l10n/
-       mv po/styles/*.json dist/l10n/styles/
+dist/l10n/styles:
+       @mkdir -p $@
+
+dist/l10n/styles/%.json: po/styles/%.po dist/l10n/styles
+       @util/po2json.py $< -o $@
 
 install-data-hook:
        mkdir -p $(DESTDIR)$(pkgdatadir)/loleaflet; \
        cp -ar dist/ $(DESTDIR)$(pkgdatadir)/loleaflet/;
 
-dist-hook: build-l10n
+dist-hook:
        chmod u+w $(distdir)/dist
 
-       mkdir -p $(distdir)/dist/l10n/styles
-       mv po/*.json $(distdir)/dist/l10n/
-       mv po/styles/*.json $(distdir)/dist/l10n/styles/
-
        mkdir -p 
$(distdir)/dist/node_modules/jquery-ui/themes/ui-lightness/images/
        cp -a 
"node_modules/jquery-ui/themes/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png"
 $(distdir)/dist/node_modules/jquery-ui/themes/ui-lightness/images/
 
diff --git a/loleaflet/util/po2json.py b/loleaflet/util/po2json.py
index 168d0975..3769b7be 100755
--- a/loleaflet/util/po2json.py
+++ b/loleaflet/util/po2json.py
@@ -13,6 +13,7 @@ import sys
 
 parser = optparse.OptionParser(usage="usage: %prog [options] pofile...")
 parser.add_option("--quiet", action="store_false", default=True, 
dest="verbose", help="don't print status messages to stdout")
+parser.add_option("-o", type="string", default="", dest="destfile", 
help="output file name (if there is exactly one input file)")
 
 (options, args) = parser.parse_args()
 
@@ -20,11 +21,18 @@ if args == None or len(args) == 0:
        print("ERROR: you must specify at least one po file to translate");
        sys.exit(1)
 
+if options.destfile != '' and len(args) != 1:
+       print("ERROR: when -o is provided, there has to be exactly 1 input 
file")
+       sys.exit(1)
+
 paramFix = re.compile("(\\(([0-9])\\))")
 
 for srcfile in args:
 
        destfile = os.path.splitext(srcfile)[0] + ".json"
+       if options.destfile != '':
+               destfile = options.destfile
+
        if options.verbose:
                print("INFO: converting %s to %s" % (srcfile, destfile))
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to