summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-12-23 01:56:08 +0100
committerChristian Grothoff <christian@grothoff.org>2019-12-23 01:56:08 +0100
commit6a51c97bddcffef78e0c3b39a0eddd69876b6907 (patch)
treedbd169b954cee0e1469173f606ecd9bd3e3bb7a7
parenteb6a5c5d225a785f2510c466b7410fc5851fa030 (diff)
downloadwww_shared-default.tar.gz
www_shared-default.zip
add mybabel wrapperdefault
-rw-r--r--mybabel.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/mybabel.py b/mybabel.py
new file mode 100644
index 0000000..50fa0c4
--- /dev/null
+++ b/mybabel.py
@@ -0,0 +1,25 @@
1#! /usr/bin/python3
2#
3# This code is in the public domain.
4#
5# This is a wrapper around 'pybabel' that sets our include path
6# to find the 'i18nfix' module. It takes the name of the
7# pybabel program as the first argument (must be a Python script!)
8# and passes the other arguments to pybabel after setting our
9# sys.path.
10#
11import shutil
12import sys
13
14# First, extend the search path as needed (without setting PYTHONPATH!)
15sys.path.insert(0, ".")
16
17# Now, find the actual pybabel program in the $PATH
18pb=shutil.which(sys.argv[1])
19
20# Remove 'pybabel' from argv[] so that pybabel doesn't confuse
21# itself for the first command-line argument ;-)
22sys.argv.remove(sys.argv[1])
23
24# Now we can run pybabel. Yeah!
25exec(compile(source=open(pb).read(), filename=pb, mode='exec'))