solenv/bin/image-sort.py |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

New commits:
commit afdae63511ab44cd48505082e922e077200af6b3
Author:     Stephan Bergmann <[email protected]>
AuthorDate: Mon Sep 22 16:02:43 2025 +0200
Commit:     Michael Stahl <[email protected]>
CommitDate: Tue Sep 23 12:06:07 2025 +0200

    Fix Python argparse.FileType deprecation warning
    
    ...seen at least with --with-system-python against
    python3-3.14.0~rc3-1.fc43.x86_64, causing
    
    > [PRL] CustomTarget/postprocess/images/sorted.lst
    > Traceback (most recent call last):
    >   File "/home/sberg/lo-plain/core/solenv/bin/image-sort.py", line 130, in 
<module>
    >     parser.add_argument('output', metavar='output file', 
type=argparse.FileType('w'),
    >                                                               
~~~~~~~~~~~~~~~~~^^^^^
    >   File "/usr/lib64/python3.14/argparse.py", line 1356, in __init__
    >     warnings.warn(
    >     ~~~~~~~~~~~~~^
    >         "FileType is deprecated. Simply open files after parsing 
arguments.",
    >         
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    >         category=PendingDeprecationWarning,
    >         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    >         stacklevel=2
    >         ^^^^^^^^^^^^
    >     )
    >     ^
    > PendingDeprecationWarning: FileType is deprecated. Simply open files 
after parsing arguments.
    > make[1]: *** 
[/home/sberg/lo-plain/core/postprocess/CustomTarget_images.mk:124: 
/home/sberg/lo-plain/core/workdir/CustomTarget/postprocess/images/sorted.lst] 
Error 1
    
    to fail
    
    Change-Id: I1dbebabb494f90698436dada6cd8e16ba98c1ea1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191354
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <[email protected]>
    (cherry picked from commit 6ebe4cb27a4c0c428429f9c3217876afda46f8d1)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191361
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Michael Stahl <[email protected]>

diff --git a/solenv/bin/image-sort.py b/solenv/bin/image-sort.py
index 43a26dc5468d..b0d6c145dafa 100644
--- a/solenv/bin/image-sort.py
+++ b/solenv/bin/image-sort.py
@@ -127,7 +127,7 @@ parser.add_argument('control_file', 
metavar='image-sort.lst',
 # where the uiconfigs live
 parser.add_argument('base_path', metavar='directory',
                     help='path to the UIConfigs directory')
-parser.add_argument('output', metavar='output file', 
type=argparse.FileType('w'),
+parser.add_argument('output', metavar='output file',
                     nargs='?', default=None, help='optionally write to this 
output file')
 parser.add_argument("-q", "--quiet", action="store_true",
                     help="don't print status messages to stdout")
@@ -135,9 +135,10 @@ parser.add_argument("-q", "--quiet", action="store_true",
 args = parser.parse_args()
 
 if args.output is not None:
+    output = open(args.output, mode = 'w')
     close_output = True
 else:
-    args.output = sys.stdout
+    output = sys.stdout
     close_output = False
 
 with open(args.control_file) as cf:
@@ -145,13 +146,13 @@ with open(args.control_file) as cf:
 
 for icon in global_list:
     if not icon.startswith('sc_'):
-        args.output.write(icon + "
")
+        output.write(icon + "
")
 
 for icon in global_list:
     if icon.startswith('sc_'):
-        args.output.write(icon + "
")
+        output.write(icon + "
")
 
 if close_output:
-    args.output.close()
+    output.close()
 
 # dnl vim:set shiftwidth=4 softtabstop=4 expandtab:

Reply via email to