Collin Funk wrote:
> With open() using binary mode with encoding='utf-8' causes a failure:
>
> with open('test.txt', 'wb', encoding='utf-8') as file:
> file.write('abc')
>
> Traceback (most recent call last):
> File "", line 1, in
> ValueError: binary mode doesn't
On 3/27/24 6:55 PM, Collin Funk wrote:
> [1] https://docs.python.org/3/library/functions.html#open
This link was supposed to be:
https://docs.python.org/3/library/codecs.html#codecs.unregister
Can't type today I guess...
Collin
On 3/27/24 6:24 PM, Bruno Haible wrote:
> Thanks! Applied, with one tweak: Let's continue to use 'rb' and 'wb' as
> file open() modes, not 'r' and 'w'. If gnulib-tool ever gets used on
> Windows, we don't want the trouble caused by Windows CRLF newlines.
> We want all generated files to use Unix
I updated the gnulib-tool.py.TODO file again:
The other 'sed' invocation can stay, since it occurs only once per
gnulib-tool.py invocation).
Bruno
Hi Collin,
> Here is a fixed version, sorry.
Thanks! Applied, with one tweak: Let's continue to use 'rb' and 'wb' as
file open() modes, not 'r' and 'w'. If gnulib-tool ever gets used on
Windows, we don't want the trouble caused by Windows CRLF newlines.
We want all generated files to use Unix LF
_lib_file = sed_transform_lib_file
+sed_transform_testsrelated_lib_file = None
Here is a fixed version, sorry.
CollinFrom 83fe701bf90750f0743e0e6677489431b18d60b2 Mon Sep 17 00:00:00 2001
From: Collin Funk
Date: Wed, 27 Mar 2024 17:39:58 -0700
Subject: [PATCH] gnulib-tool.py: Inline 'sed' invocations used o
'sed' invocations used on library
files.
* pygnulib/GLFileSystem.py (GLFileAssistant.__init__): Update type hints
and docstrings to reflect changes necessary for using re.sub() instead
of 'sed'.
(GLFileAssistant.add_or_update): Use re.sub() instead of invoking 'sed'.
* pygnulib/GLImport.py