diff options
author | Bruno Haible <bruno@clisp.org> | 2022-07-30 11:45:36 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2022-07-31 07:07:32 +0200 |
commit | d2abfb903c5bd24fb6b39e39bb2af15ee4c6a14f (patch) | |
tree | 1db34d26a010db73104b680fcd766c3e37b880b0 /pygnulib/GLTestDir.py | |
parent | 5d39cdb46a0ab98506d1be1cbf6ec58950ff93e4 (diff) | |
download | gnulib-d2abfb903c5bd24fb6b39e39bb2af15ee4c6a14f.tar.gz |
gnulib-tool.py: Assume Python 3.
* gnulib-tool.py: Don't set PYTHON3, string. Use str instead of string.
* pygnulib/*.py: Likewise.
Diffstat (limited to 'pygnulib/GLTestDir.py')
-rw-r--r-- | pygnulib/GLTestDir.py | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/pygnulib/GLTestDir.py b/pygnulib/GLTestDir.py index 0a631ebdc3..b8a7df43ce 100644 --- a/pygnulib/GLTestDir.py +++ b/pygnulib/GLTestDir.py @@ -47,7 +47,6 @@ __copyright__ = constants.__copyright__ #=============================================================================== # Define global constants #=============================================================================== -PYTHON3 = constants.PYTHON3 NoneType = type(None) APP = constants.APP DIRS = constants.DIRS @@ -59,7 +58,6 @@ compiler = constants.compiler joinpath = constants.joinpath cleaner = constants.cleaner relpath = constants.relativize -string = constants.string isabs = os.path.isabs isdir = os.path.isdir isfile = os.path.isfile @@ -80,7 +78,7 @@ class GLTestDir(object): if type(config) is not GLConfig: raise TypeError('config must be a GLConfig, not %s' % type(config).__name__) - if type(testdir) is bytes or type(testdir) is string: + if type(testdir) is bytes or type(testdir) is str: if type(testdir) is bytes: testdir = testdir.decode(ENCS['default']) self.config = config @@ -123,7 +121,7 @@ class GLTestDir(object): for file in files ] # Finish to convert bytes to string for file in files: - if type(file) is not string: + if type(file) is not str: raise TypeError('each file must be a string instance') files = sorted(set(files)) auxdir = self.config['auxdir'] @@ -378,8 +376,7 @@ class GLTestDir(object): if not isdir(directory): os.mkdir(directory) destfile = joinpath(directory, 'Makefile.am') - emit = string() - emit += '## Process this file with automake to produce Makefile.in.\n\n' + emit = '## Process this file with automake to produce Makefile.in.\n\n' emit += 'EXTRA_DIST =\n' for file in filelist: if file.startswith('m4/'): @@ -419,11 +416,11 @@ class GLTestDir(object): with codecs.open(destfile, 'wb', 'UTF-8') as file: file.write(emit) # Viewed from the $testsbase subdirectory, $auxdir is different. - emit = string() + emit = '' saved_auxdir = self.config['auxdir'] testsbase = '%s/' % os.path.normpath(testsbase) counter = int() - auxdir = string() + auxdir = '' finish = (len(testsbase.split('/')) - 1) while counter < finish: auxdir += '../' @@ -531,8 +528,7 @@ class GLTestDir(object): testsbase_appened = True # Create Makefile.am. - emit = string() - emit += '## Process this file with automake to produce Makefile.in.\n\n' + emit = '## Process this file with automake to produce Makefile.in.\n\n' emit += 'AUTOMAKE_OPTIONS = 1.9.6 foreign\n\n' emit += 'SUBDIRS = %s\n\n' % ' '.join(subdirs) emit += 'ACLOCAL_AMFLAGS = -I %s\n' % m4base @@ -544,8 +540,7 @@ class GLTestDir(object): file.write(emit) # Create configure.ac - emit = string() - emit += '# Process this file with autoconf ' + emit = '# Process this file with autoconf ' emit += 'to produce a configure script.\n' emit += 'AC_INIT([dummy], [0])\n' if auxdir != '.': @@ -862,7 +857,7 @@ class GLMegaTestDir(object): if type(config) is not GLConfig: raise TypeError('config must be a GLConfig, not %s' % type(config).__name__) - if type(megatestdir) is bytes or type(megatestdir) is string: + if type(megatestdir) is bytes or type(megatestdir) is str: if type(megatestdir) is bytes: megatestdir = megatestdir.decode(ENCS['default']) self.config = config @@ -905,7 +900,7 @@ class GLMegaTestDir(object): megasubdirs += ['ALL'] # Create autobuild. - emit = string() + emit = '' repdict = dict() repdict['Jan'] = repdict['January'] = '01' repdict['Feb'] = repdict['February'] = '02' @@ -959,8 +954,7 @@ class GLMegaTestDir(object): file.write(emit) # Create Makefile.am. - emit = string() - emit += '## Process this file with automake to produce Makefile.in.\n\n' + emit = '## Process this file with automake to produce Makefile.in.\n\n' emit += 'AUTOMAKE_OPTIONS = 1.9.6 foreign\n\n' emit += 'SUBDIRS = %s\n\n' % ' '.join(megasubdirs) emit += 'EXTRA_DIST = do-autobuild\n' @@ -971,8 +965,7 @@ class GLMegaTestDir(object): with codecs.open(path, 'wb', 'UTF-8') as file: file.write(emit) - emit = string() - emit += '# Process this file with autoconf ' + emit = '# Process this file with autoconf ' emit += 'to produce a configure script.\n' emit += 'AC_INIT([dummy], [0])\n\n' if auxdir != '.': |