How to create an archive (ZIP or Tarball) using GNOME SDK

Hello,
I’m developing a Flatpak application in Python to save installed Flatpaks and their configurations.

For that I want to create a package file containing various files that the user want to backup (mainly located in ~/.var/app)

Since the amount of data is small, the archive don’t have to be compressed (even if it would be nice).
From what I searched, I’ve found these classes that may be interesting :

  • Gio.ZlibCompressor : from what I understand, it allows me to compress data but not create archive
  • GnomeAutoar.Compressor
  • AppStream.Bundle & AppStreamGLib.Bundle : I don’t understand the differences and how to use them
  • native Python’s shutil : seems really simple to use but is it a good idea to use it in Flatpak/GNOME environement ?

So, which classes should best suits my needs from the one I listed or others I missed ?

I would use the Python native solutions, shutil or directly using zipfile or tarfile. If you have gained read access to the data and write access to the archive destination using portals or Flatpak manifest filesystem permissions everything should be fine.

1 Like

Okay, thank you.
I will try this way then :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.