Skip to content

cerbero: Fix shutil.rmtree hack to passthrough unknown kwargs

Nirbheek Chauhan requested to merge nirbheek/cerbero:fix-rmtree into main

Android tarball creation was broken for a while on Fedora because a new kwarg was added in Python 3.12

Traceback (most recent call last):
  File "<string>", line 24, in <module>
  File "/home/nirbheek/projects/repos/cerbero.git/cerbero/main.py", line 224, in main
    Main(sys.argv[1:])
  File "/home/nirbheek/projects/repos/cerbero.git/cerbero/main.py", line 52, in __init__
    self.run_command()
  File "/home/nirbheek/projects/repos/cerbero.git/cerbero/main.py", line 192, in run_command
    res = commands.run(command, self.config, self.args)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nirbheek/projects/repos/cerbero.git/cerbero/commands/__init__.py", line 79, in run
    return _commands[command].run(config, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nirbheek/projects/repos/cerbero.git/cerbero/commands/package.py", line 156, in run
    paths = pkg.pack(
            ^^^^^^^^^
  File "/home/nirbheek/projects/repos/cerbero.git/cerbero/packages/disttarball.py", line 73, in pack
    runtime = self._create_tarball(output_dir, PackageType.RUNTIME, dist_files, force, package_prefix)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nirbheek/projects/repos/cerbero.git/cerbero/packages/android.py", line 32, in _create_tarball
    return super()._create_tarball(output_dir, package_type, files, force, package_prefix)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nirbheek/projects/repos/cerbero.git/cerbero/packages/disttarball.py", line 152, in _create_tarball
    self._write_tar(filename, package_prefix, files)
  File "/home/nirbheek/projects/repos/cerbero.git/cerbero/packages/disttarball.py", line 213, in _write_tar
    with tempfile.TemporaryDirectory() as d:
  File "/usr/lib64/python3.12/tempfile.py", line 946, in __exit__
    self.cleanup()
  File "/usr/lib64/python3.12/tempfile.py", line 950, in cleanup
    self._rmtree(self.name, ignore_errors=self._ignore_cleanup_errors)
  File "/usr/lib64/python3.12/tempfile.py", line 930, in _rmtree
    _shutil.rmtree(name, onexc=onexc)
TypeError: rmtree() got an unexpected keyword argument 'onexc'
Edited by Nirbheek Chauhan

Merge request reports

Loading