summaryrefslogtreecommitdiff
path: root/pygnulib
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2022-08-13 15:02:55 +0200
committerBruno Haible <bruno@clisp.org>2022-08-13 15:02:55 +0200
commitaa46eb2a5344ea32a973cdc2bb7b9d81d146543f (patch)
tree4ef77615109e412198f253068bb30547c4975fd5 /pygnulib
parent01cd78f9d682ff75cc5ab1c2d21b911bdd9215b8 (diff)
downloadgnulib-aa46eb2a5344ea32a973cdc2bb7b9d81d146543f.tar.gz
gnulib-tool.py: Fix some code generation details.
* pygnulib/GLEmiter.py: Don't produce Windows CR-LFs on Windows. (GLEmiter.po_Makevars): Emit a definition of top_builddir, not top_subdir. (GLEmiter.po_POTFILES_in): Fix result when sourcebase is 'tests' or something like that. (GLEmiter.initmacro_start): Add two more newlines (mistake from 2021-04-11).
Diffstat (limited to 'pygnulib')
-rw-r--r--pygnulib/GLEmiter.py64
1 files changed, 26 insertions, 38 deletions
diff --git a/pygnulib/GLEmiter.py b/pygnulib/GLEmiter.py
index 4c8f0d90f2..8c8b3ed8a7 100644
--- a/pygnulib/GLEmiter.py
+++ b/pygnulib/GLEmiter.py
@@ -94,7 +94,7 @@ class GLEmiter(object):
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.\n"""
- return constants.nlconvert(emit)
+ return emit
def autoconfSnippet(self, module, toplevel,
disable_libtool, disable_gettext, replace_auxdir, indentation):
@@ -388,10 +388,9 @@ class GLEmiter(object):
Emit the contents of po/ makefile parameterization.
GLConfig: pobase, podomain.'''
- emit = ''
pobase = self.config['pobase']
podomain = self.config['podomain']
- top_subdir = relinverse(pobase)
+ emit = ''
emit += "## DO NOT EDIT! GENERATED AUTOMATICALLY!\n"
emit += "%s\n" % self.copyright_notice()
emit += "# Usually the message domain is the same as the package name.\n"
@@ -399,7 +398,7 @@ class GLEmiter(object):
emit += "DOMAIN = %s-gnulib\n\n" % podomain
emit += "# These two variables depend on the location of this directory.\n"
emit += "subdir = %s\n" % pobase
- emit += "top_subdir = %s\n" % top_subdir
+ emit += "top_builddir = %s\n" % relinverse(pobase)
emit += """
# These options get passed to xgettext.
XGETTEXT_OPTIONS = \\
@@ -438,36 +437,32 @@ EXTRA_LOCALE_CATEGORIES =
# package uses functions taking also a message context, like pgettext(), or
# if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
USE_MSGCTXT = no\n"""
- return constants.nlconvert(emit)
+ return emit
def po_POTFILES_in(self, files):
'''GLEmiter.po_POTFILES_in(files) -> str
Emit the file list to be passed to xgettext.
GLConfig: sourcebase.'''
- emit = ''
sourcebase = self.config['sourcebase'] + os.path.sep
- files = [ constants.substart('lib/', sourcebase, file)
- for file in files ]
- files = [ file
- for file in files
- if file.startswith(sourcebase) ]
+ emit = ''
emit += "## DO NOT EDIT! GENERATED AUTOMATICALLY!\n"
emit += "%s\n" % self.copyright_notice()
emit += "# List of files which contain translatable strings.\n"
- emit += '\n'.join(files)
- emit += '\n'
- return constants.nlconvert(emit)
+ for file in files:
+ if file.startswith('lib/'):
+ emit += '%s\n' % constants.substart('lib/', sourcebase, file)
+ return emit
def initmacro_start(self, macro_prefix_arg):
'''GLEmiter.initmacro_start(macro_prefix_arg) -> str
Emit the first few statements of the gl_INIT macro.'''
- emit = ''
if type(macro_prefix_arg) is not str:
raise TypeError('macro_prefix_arg must be a string, not %s'
% type(macro_prefix_arg).__name__)
module_indicator_prefix = self.config.getModuleIndicatorPrefix()
+ emit = ''
# Overriding AC_LIBOBJ and AC_REPLACE_FUNCS has the effect of storing
# platform-dependent object files in ${macro_prefix_arg}_LIBOBJS instead
# of LIBOBJS. The purpose is to allow several gnulib instantiations under
@@ -475,45 +470,38 @@ USE_MSGCTXT = no\n"""
# flexibility).
# Furthermore it avoids an automake error like this when a Makefile.am
# that uses pieces of gnulib also uses $(LIBOBJ):
- # automatically discovered file `error.c' should not be explicitly
- # mentioned.
- emit += " m4_pushdef([AC_LIBOBJ],"
- emit += " m4_defn([%V1%_LIBOBJ]))\n"
- emit += " m4_pushdef([AC_REPLACE_FUNCS],"
- emit += " m4_defn([%V1%_REPLACE_FUNCS]))\n"
+ # automatically discovered file `error.c' should not be explicitly mentioned.
+ emit += " m4_pushdef([AC_LIBOBJ], m4_defn([%s_LIBOBJ]))\n" % macro_prefix_arg
+ emit += " m4_pushdef([AC_REPLACE_FUNCS], m4_defn([%s_REPLACE_FUNCS]))\n" % macro_prefix_arg
# Overriding AC_LIBSOURCES has the same purpose of avoiding the automake
# error when a Makefile.am that uses pieces of gnulib also uses $(LIBOBJ):
- # automatically discovered file `error.c' should not be explicitly
- # mentioned
+ # automatically discovered file `error.c' should not be explicitly mentioned
# We let automake know about the files to be distributed through the
# EXTRA_lib_SOURCES variable.
- emit += " m4_pushdef([AC_LIBSOURCES],"
- emit += " m4_defn([%V1%_LIBSOURCES]))\n"
+ emit += " m4_pushdef([AC_LIBSOURCES], m4_defn([%s_LIBSOURCES]))\n" % macro_prefix_arg
# Create data variables for checking the presence of files that are
# mentioned as AC_LIBSOURCES arguments. These are m4 variables, not shell
# variables, because we want the check to happen when the configure file is
# created, not when it is run. ${macro_prefix_arg}_LIBSOURCES_LIST is the
# list of files to check for. ${macro_prefix_arg}_LIBSOURCES_DIR is the
# subdirectory in which to expect them.
- emit += " m4_pushdef([%V1%_LIBSOURCES_LIST], [])\n"
- emit += " m4_pushdef([%V1%_LIBSOURCES_DIR], [])\n"
+ emit += " m4_pushdef([%s_LIBSOURCES_LIST], [])\n" % macro_prefix_arg
+ emit += " m4_pushdef([%s_LIBSOURCES_DIR], [])\n" % macro_prefix_arg
# Scope for m4 macros.
- emit += " m4_pushdef([GL_MACRO_PREFIX], [%V1%])"
+ emit += " m4_pushdef([GL_MACRO_PREFIX], [%s])\n" % macro_prefix_arg
# Scope the GNULIB_<modulename> variables.
- emit += " m4_pushdef([GL_MODULE_INDICATOR_PREFIX],"
- emit += " [" + module_indicator_prefix + "])"
+ emit += " m4_pushdef([GL_MODULE_INDICATOR_PREFIX], [%s])\n" % module_indicator_prefix
emit += " gl_COMMON\n"
- emit = emit.replace('%V1%', macro_prefix_arg)
- return constants.nlconvert(emit)
+ return emit
def initmacro_end(self, macro_prefix_arg):
'''GLEmiter.initmacro_end(macro_prefix_arg) -> str
Emit the last few statements of the gl_INIT macro.'''
- emit = ''
if type(macro_prefix_arg) is not str:
raise TypeError('macro_prefix_arg must be a string, not %s'
% type(macro_prefix_arg).__name__)
+ emit = ''
# Check the presence of files that are mentioned as AC_LIBSOURCES
# arguments. The check is performed only when autoconf is run from the
# directory where the configure.ac resides; if it is run from a different
@@ -552,20 +540,20 @@ USE_MSGCTXT = no\n"""
AC_SUBST([%V1%_LTLIBOBJS], [$%V1%_ltlibobjs])
])\n"""
emit = emit.replace('%V1%', macro_prefix_arg)
- return constants.nlconvert(emit)
+ return emit
def initmacro_done(self, macro_prefix_arg, sourcebase_arg):
'''GLEmiter.initmacro_done(macro_prefix_arg, sourcebase_arg) -> str
Emit a few statements after the gl_INIT macro.
GLConfig: sourcebase.'''
- emit = ''
if type(macro_prefix_arg) is not str:
raise TypeError('macro_prefix_arg must be a string, not %s'
% type(macro_prefix_arg).__name__)
if type(sourcebase_arg) is not str:
raise TypeError('sourcebase_arg must be a string, not %s'
% type(sourcebase_arg).__name__)
+ emit = ''
emit += """\
# Like AC_LIBOBJ, except that the module name goes
@@ -596,7 +584,7 @@ AC_DEFUN([%V1%_LIBSOURCES], [
])\n"""
emit = emit.replace('%V1%', macro_prefix_arg)
emit = emit.replace('%V2%', sourcebase_arg)
- return constants.nlconvert(emit)
+ return emit
def lib_Makefile_am(self, destfile, modules,
moduletable, makefiletable, actioncmd, for_test):
@@ -634,7 +622,6 @@ AC_DEFUN([%V1%_LIBSOURCES], [
if type(for_test) is not bool:
raise TypeError('for_test must be a bool, not %s'
% type(for_test).__name__)
- emit = ''
sourcebase = self.config['sourcebase']
libname = self.config['libname']
pobase = self.config['pobase']
@@ -649,6 +636,7 @@ AC_DEFUN([%V1%_LIBSOURCES], [
module_indicator_prefix = self.config.getModuleIndicatorPrefix()
ac_version = self.config['ac_version']
destfile = os.path.normpath(destfile)
+ emit = ''
# When creating an includable Makefile.am snippet, augment variables with
# += instead of assigning them.
@@ -900,7 +888,6 @@ AC_DEFUN([%V1%_LIBSOURCES], [
if type(for_test) is not bool:
raise TypeError('for_test must be a bool, not %s'
% type(for_test).__name__)
- emit = ''
auxdir = self.config['auxdir']
sourcebase = self.config['sourcebase']
libname = self.config['libname']
@@ -918,6 +905,7 @@ AC_DEFUN([%V1%_LIBSOURCES], [
ac_version = self.config['ac_version']
libtests = self.config['libtests']
single_configure = self.config['single_configure']
+ emit = ''
if libtool:
libext = 'la'