Author: hartmannathan
Date: Fri Dec  8 20:17:45 2023
New Revision: 1914474

URL: http://svn.apache.org/viewvc?rev=1914474&view=rev
Log:
Fix release.py roll-tarballs leaving empty __pycache__ dirs in archives

Without this, we were rolling Unix tarballs containing these empty dirs:

build/__pycache__
build/generator/__pycache__
build/generator/swig/__pycache__

These are in our 1.14.0 and 1.14.1 tarballs. Somehow, we avoided it in the
1.14.2 release.

See also: r1903267 and the 3 Apr 2022 dev@ mail thread:
"Should tarballs contain __pycache__ dirs?" archived:
https://lists.apache.org/thread/xpx02mdstzn648k0vq82q49lf6zyozzh

* tools/dist/release.py
  (roll_tarballs::clean_pycache): New nested function.
  (roll_tarballs): Call clean_pycache() before creating archives for Unix and
   Windows.

Modified:
    subversion/trunk/tools/dist/release.py

Modified: subversion/trunk/tools/dist/release.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/tools/dist/release.py?rev=1914474&r1=1914473&r2=1914474&view=diff
==============================================================================
--- subversion/trunk/tools/dist/release.py (original)
+++ subversion/trunk/tools/dist/release.py Fri Dec  8 20:17:45 2023
@@ -896,6 +896,12 @@ def roll_tarballs(args):
                 if dname.startswith('autom4te') and dname.endswith('.cache'):
                     shutil.rmtree(os.path.join(root, dname))
 
+    def clean_pycache():
+        for root, dirs, files in os.walk(exportdir):
+            for dname in dirs:
+                if dname == '__pycache__':
+                    shutil.rmtree(os.path.join(root, dname))
+
     logging.info('Building Windows tarballs')
     export(windows=True)
     os.chdir(exportdir)
@@ -904,6 +910,7 @@ def roll_tarballs(args):
     # line endings and won't run, so use the one in the working copy.
     run_script(args.verbose,
                '%s/tools/po/po-update.sh pot' % get_workdir(args.base_dir))
+    clean_pycache()  # as with clean_autom4te, is this pointless on Windows?
     os.chdir(cwd)
     clean_autom4te() # dist.sh does it but pointless on Windows?
     os.chdir(get_tempdir(args.base_dir))
@@ -919,6 +926,7 @@ def roll_tarballs(args):
                '''tools/po/po-update.sh pot
                   ./autogen.sh --release''',
                hide_stderr=True) # SWIG is noisy
+    clean_pycache()  # without this, tarballs contain empty __pycache__ dirs
     os.chdir(cwd)
     clean_autom4te() # dist.sh does it but probably pointless
 


Reply via email to