Initial commit of WesCamp importer.

This commit is contained in:
Eric S. Raymond 2007-04-30 14:56:15 +00:00
parent 42c8858f0d
commit 20ce375243

120
utils/wescamp_import Executable file
View file

@ -0,0 +1,120 @@
#!/usr/bin/env python
#
# wescamp_import -- generate a shellscript to import a campaign from WesCamp
#
# Pipe the output of this comman to sh to actually perform the opetation
#
import sys, os, getopt, shutil
if __name__ == "__main__":
def help():
sys.stderr.write("""\
Usage: macroscope {-h | wescamp-path campaign-name textdomain}
Options may be any of these:
-h, --help Emit this help message and quit
Requires as first argument a path to a WesCamp checkout
Requires as second argument a campaign name.
Call from the top level directory of mainline.
""")
# Template campaign to copy boilerplate files from
template_campaign = "Heir_To_The_Throne"
# Process options
(options, arguments) = getopt.getopt(sys.argv[1:], "h", ['help',])
for (switch, val) in options:
if switch in ('-h', '--help'):
help()
sys.exit(0)
if len(arguments) == 0:
sys.stderr.write("wescamp_import: a path to a local WesCamp checkout is required.\n")
sys.exit(1)
else:
wescamp_path = arguments[0]
if len(arguments) == 1:
sys.stderr.write("wescamp_import: a campaign name is required.\n")
sys.exit(1)
else:
campaign = arguments[1]
if len(arguments) == 2:
sys.stderr.write("wescamp_import: a text domain name is required.\n")
sys.exit(1)
else:
textdomain = arguments[2]
print """\
# Generated script to do an import of %(textdomain)s from a WesCamp checkout
#
cp %(wescamp_path)s/%(campaign)s/po/.po po/%(textdomain)s
echo >po/%(textdomain)s/FINDCFG <<'EOF'
find data/campaigns/%(campaign)s -name '*.cfg' -print
echo data/campaigns/%(campaign)s.cfg'
EOF
cp po/%(template_campaign)s/remove-potcdate.sin po/%(textdomain)s/
echo >po/%(textdomain)s/Makevars <<'EOF'
# Makefile variables for PO directory in any package using GNU gettext.
# Usually the message domain is the same as the package name.
DOMAIN = %(textdomain)s
# These two variables depend on the location of this directory.
subdir = po/%(textdomain)s
top_builddir = ../..
# These options get passed to xgettext.
XGETTEXT_OPTIONS = --from-code=UTF-8 --sort-by-file --keyword=sgettext --keyword
=vgettext --keyword=_n:1,2 --keyword=sngettext:1,2 --keyword=vngettext:1,2
# This is the copyright holder that gets inserted into the header of the
# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
# package. (Note that the msgstr strings, extracted from the package's
# sources, belong to the copyright holder of the package.) Translators are
# expected to transfer the copyright for their translations to this person
# or entity, or to disclaim their copyright. The empty string stands for
# the public domain; in this case the translators are expected to disclaim
# their copyright.
COPYRIGHT_HOLDER = Wesnoth development team
# This is the email address or URL to which the translators shall report
# bugs in the untranslated strings:
# - Strings which are not entire sentences, see the maintainer guidelines
# in the GNU gettext documentation, section 'Preparing Strings'.
# - Strings which use unclear terms or require additional context to be
# understood.
# - Strings which make invalid assumptions about notation of date, time or
# money.
# - Pluralisation problems.
# - Incorrect English spelling.
# - Incorrect formatting.
# It can be your email address, or a mailing list address where translators
# can write to without being subscribed, or the URL of a web page through
# which the translators can contact you.
MSGID_BUGS_ADDRESS =http://bugs.wesnoth.org/
# This is the list of locale categories, beyond LC_MESSAGES, for which the
# message catalogs shall be used. It is usually empty.
EXTRA_LOCALE_CATEGORIES =
'EOF'
cp po/%(template_campaign)s/POTFILES po/%(textdomain)s/
ed po/Makefile.am <<'EOF'
/^SUBDIRS/s/$/ %(textdomain)s/
wq
EOF
# Warning: this depends on m4/Makefile being in ther list of generated files
ed po/configure.ac <<'EOF'
/m4\/Makefile/-1a
po/%(textdomain)s/Makefile.in
.
wq
EOF
svn add po/%(textdomain)s
svn commit -m 'Wescamp import' configure.ac po/Makefile.am po/%(textdomain)s
""" % locals()