]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
gnulib-tool.py: Don't perform newline conversions.
authorCollin Funk <collin.funk1@gmail.com>
Sun, 14 Apr 2024 17:18:03 +0000 (10:18 -0700)
committerBruno Haible <bruno@clisp.org>
Sun, 14 Apr 2024 22:00:57 +0000 (00:00 +0200)
* pygnulib/constants.py (nlconvert): Remove function. Remove unused
platform import.
* pygnulib/GLImport.py (GLImport.gnulib_cache): Remove calls to
nlconvert().
* pygnulib/GLModuleSystem.py
(GLModule.getAutomakeSnippet_Unconditional): Likewise.
* pygnulib/GLTestDir.py (GLTestDir.execute, GLMegaTestDir.execute):
Likewise.

ChangeLog
pygnulib/GLImport.py
pygnulib/GLModuleSystem.py
pygnulib/GLTestDir.py
pygnulib/constants.py

index 8e9ef9623061d573ecadbfe9ba654069ea03752c..e4cc059cc760d10ceeaf4a21b0b05b89dfcfa82a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2024-04-14  Collin Funk  <collin.funk1@gmail.com>
+
+       gnulib-tool.py: Don't perform newline conversions.
+       * pygnulib/constants.py (nlconvert): Remove function. Remove unused
+       platform import.
+       * pygnulib/GLImport.py (GLImport.gnulib_cache): Remove calls to
+       nlconvert().
+       * pygnulib/GLModuleSystem.py
+       (GLModule.getAutomakeSnippet_Unconditional): Likewise.
+       * pygnulib/GLTestDir.py (GLTestDir.execute, GLMegaTestDir.execute):
+       Likewise.
+
 2024-04-14  Bruno Haible  <bruno@clisp.org>
 
        users.txt: Update some more entries.
index eadf45828d98c6093e3fba15911de61ca108d80e..eaff520fa43dfe754a4ac98c8ae7e9942eda5a0c 100644 (file)
@@ -598,7 +598,7 @@ class GLImport:
         if vc_files != None:
             # Convert Python bools to shell (True -> true).
             emit += 'gl_VC_FILES([%s])\n' % str(vc_files).lower()
-        return constants.nlconvert(emit)
+        return emit
 
     def gnulib_comp(self, filetable: dict[str, list[str]], gentests: bool) -> str:
         '''Emit the contents of generated $m4base/gnulib-comp.m4 file.
index 2551e316e13f8af2eb0ca1f7b12fb0a515b89be5..11cd6ef78a51f2ec0c306fd1aab25c7a75b726a0 100644 (file)
@@ -645,7 +645,6 @@ class GLModule:
                                        for filename in buildaux_files.split(constants.NL) ]
                     result += 'EXTRA_DIST += %s' % ' '.join(buildaux_files)
                     result += '\n\n'
-            result = constants.nlconvert(result)
             self.cache['makefile-unconditional'] = result
         return self.cache['makefile-unconditional']
 
index dc70e8d304915855b3638b62c6d204e895fc671d..a7709a1259a547cf21abf0c5e05287a183af9a6d 100644 (file)
@@ -404,7 +404,6 @@ class GLTestDir:
             if file.startswith('m4/'):
                 file = constants.substart('m4/', '', file)
                 emit += 'EXTRA_DIST += %s\n' % file
-        emit = constants.nlconvert(emit)
         with open(destfile, mode='w', newline='\n', encoding='utf-8') as file:
             file.write(emit)
 
@@ -522,7 +521,6 @@ class GLTestDir:
                 emit += 'AH_TOP([#include \"../config.h\"])\n\n'
                 emit += 'AC_CONFIG_FILES([Makefile])\n'
                 emit += 'AC_OUTPUT\n'
-                emit = constants.nlconvert(emit)
                 path = joinpath(self.testdir, testsbase, 'configure.ac')
                 with open(path, mode='w', newline='\n', encoding='utf-8') as file:
                     file.write(emit)
@@ -539,7 +537,6 @@ class GLTestDir:
         emit += 'AUTOMAKE_OPTIONS = 1.14 foreign\n\n'
         emit += 'SUBDIRS = %s\n\n' % ' '.join(subdirs)
         emit += 'ACLOCAL_AMFLAGS = -I %s\n' % m4base
-        emit = constants.nlconvert(emit)
         path = joinpath(self.testdir, 'Makefile.am')
         with open(path, mode='w', newline='\n', encoding='utf-8') as file:
             file.write(emit)
@@ -989,7 +986,6 @@ class GLMegaTestDir:
         emit += '  ) 2>&1 | { if test -n "$AUTOBUILD_SUBST"; then '
         emit += 'sed -e "$AUTOBUILD_SUBST"; else cat; fi; } > logs/$safemodule\n'
         emit += 'done\n'
-        emit = constants.nlconvert(emit)
         path = joinpath(self.megatestdir, 'do-autobuild')
         with open(path, mode='w', newline='\n', encoding='utf-8') as file:
             file.write(emit)
@@ -999,7 +995,6 @@ class GLMegaTestDir:
         emit += 'AUTOMAKE_OPTIONS = 1.14 foreign\n\n'
         emit += 'SUBDIRS = %s\n\n' % ' '.join(megasubdirs)
         emit += 'EXTRA_DIST = do-autobuild\n'
-        emit = constants.nlconvert(emit)
         path = joinpath(self.megatestdir, 'Makefile.am')
         with open(path, mode='w', newline='\n', encoding='utf-8') as file:
             file.write(emit)
@@ -1014,7 +1009,6 @@ class GLMegaTestDir:
         emit += 'AC_CONFIG_SUBDIRS([%s])\n' % ' '.join(megasubdirs)
         emit += 'AC_CONFIG_FILES([Makefile])\n'
         emit += 'AC_OUTPUT\n'
-        emit = constants.nlconvert(emit)
         path = joinpath(self.megatestdir, 'configure.ac')
         with open(path, mode='w', newline='\n', encoding='utf-8') as file:
             file.write(emit)
index 70381164bed13b761b78a9b828db0ff142589895..2eedad40eb2b3889b8112c02b85d445468f9f058 100644 (file)
@@ -25,7 +25,6 @@ import re
 import os
 import sys
 import stat
-import platform
 import shutil
 import tempfile
 import subprocess as sp
@@ -522,15 +521,6 @@ def subend(orig: str, repl: str, data: str) -> str:
     return result
 
 
-def nlconvert(text: str) -> str:
-    '''Convert line-endings to specific for this platform.'''
-    system = platform.system().lower()
-    text = text.replace('\r\n', '\n')
-    if system == 'windows':
-        text = text.replace('\n', '\r\n')
-    return text
-
-
 def remove_trailing_slashes(text: str) -> str:
     '''Remove trailing slashes from a file name, except when the file name
     consists only of slashes.'''