summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Epler <jepler@unpythonic.net>2012-03-10 12:02:47 -0600
committerJeff Epler <jepler@unpythonic.net>2012-03-10 12:10:33 -0600
commit1490362e58f5fbc24463bdb57a831a97859737c2 (patch)
treed4c53830365e763ad16acdb3e043270c28f74929
parent5c4ad82d0a26f8d5c82ad749fe077aa9c0c6c002 (diff)
downloadlinuxcnc-1490362e58f5fbc24463bdb57a831a97859737c2.tar.gz
linuxcnc-1490362e58f5fbc24463bdb57a831a97859737c2.zip
i18n: make paths in linuxcnc.pot relative to top dir
-rw-r--r--src/po/Submakefile3
-rwxr-xr-xsrc/po/fixpaths.py19
2 files changed, 21 insertions, 1 deletions
diff --git a/src/po/Submakefile b/src/po/Submakefile
index 4e995e9ac..9ed5a3a2e 100644
--- a/src/po/Submakefile
+++ b/src/po/Submakefile
@@ -41,7 +41,8 @@ TCLSRCS := \
po/linuxcnc.pot:
$(ECHO) Localizing linuxcnc.pot
- $(Q)$(XGETTEXT) -k_ -o $@ $^ && touch $@
+ (cd ..; $(XGETTEXT) -k_ -o src/$@ `src/po/fixpaths.py -j src $^`)
+ touch $@
TARGETS += po/linuxcnc.pot
po/linuxcnc.pot: emc/task/emctaskmain.cc $(LIBRS274SRCS) emc/rs274ngc/rs274ngc_return.hh
diff --git a/src/po/fixpaths.py b/src/po/fixpaths.py
new file mode 100755
index 000000000..d17e76373
--- /dev/null
+++ b/src/po/fixpaths.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+import getopt
+import os
+import string
+import sys
+
+join = ''
+opts, args = getopt.getopt(sys.argv[1:], 'j:')
+for k, v in opts:
+ if k == '-j': join = v
+
+whitelist = string.lowercase+string.uppercase+string.digits+"_+-=@%^/.,:{}"
+def quote(n):
+ if not n.strip(whitelist): return n
+ return "'%s'" % n.replace("'", "'\\''")
+
+for fn in args:
+ if join: fn = os.path.join(join, fn)
+ print quote(os.path.normpath(fn))