On 2022/04/02 22:39, Mark Phippard wrote:
> The releases are posted for signing. The process all went well except
> for one part. When I ran the script to create the tag it fails with
> this error:
> 
> INFO:root:Creating tag for 1.14.2
> INFO:root:Bumping version numbers on the branch
> Traceback (most recent call last):
> File "/opt/trunk/tools/dist/release.py", line 1916, in <module>
> main()
> File "/opt/trunk/tools/dist/release.py", line 1912, in main
> args.func(args)
> File "/opt/trunk/tools/dist/release.py", line 1134, in
> create_tag_and_bump_versions
> bump_versions_on_branch(args)
> File "/opt/trunk/tools/dist/release.py", line 1106, in bump_versions_on_branch
> svn_version_h = file_object_for('subversion/include/svn_version.h')
> File "/opt/trunk/tools/dist/release.py", line 1099, in file_object_for
> fd = tempfile.NamedTemporaryFile(mode='w+', encoding='UTF-8')
> TypeError: NamedTemporaryFile() got an unexpected keyword argument 'encoding'
> 
> I believe what has not happened is the updating of the 1.10.x and
> 1.14.x branches to prepare for the next release. I will try to look
> through old commits to see what was supposed to happen and will do it
> manually.
> 
> If someone can fix the problem for the future that would be great.
> Kind of guessing it could be that the script has to run with Python 3
> now or something?

Yes, the function tempfile.NamedTemporaryFile() does not have keyword
argument 'encoding' in Python 2.7, and has in Python 3.  
So tools/dist/release.py in trunk no longer supports Python 2 since r1877953.

Here is a patch (not tested) to support Python 2.7, but I don't think
it has worth.
[[[
Index: tools/dist/release.py
===================================================================
--- tools/dist/release.py       (revision 1899209)
+++ tools/dist/release.py       (working copy)
@@ -35,6 +35,7 @@
 # but people.apache.org doesn't currently have them installed
 
 # Stuff we need
+from __future__ import print_function # Python 2.7 need it
 import os
 import re
 import sys
@@ -1096,7 +1097,12 @@
                                    universal_newlines=True).strip()
     HEAD = int(HEAD)
     def file_object_for(relpath):
-        fd = tempfile.NamedTemporaryFile(mode='w+', encoding='UTF-8')
+        if b'' == '':
+            # Python 2
+            fd = tempfile.NamedTemporaryFile(mode='w+')
+        else:
+            # Python 3
+            fd = tempfile.NamedTemporaryFile(mode='w+', encoding='UTF-8')
         url = branch_url + '/' + relpath
         fd.url = url
         subprocess.check_call(['svn', 'cat', '%s@%d' % (url, HEAD)],
]]]

Cheers,
-- 
Yasuhito FUTATSUKI <futat...@yf.bsclub.org>

Reply via email to