twrite also the lzma-compressed, and the uncompressed files - amprolla - devuan's apt repo merger
git clone git://parazyd.org/amprolla.git
Log
Files
Refs
README
LICENSE
---
commit a0f2b7d8f0ac26130755a018c8e62fbae15f89e9
parent ef80197f590010831da710648a80e0f1927d829c
Author: parazyd 
Date:   Thu,  1 Jun 2017 12:47:16 +0200

write also the lzma-compressed, and the uncompressed files

Diffstat:
  M lib/package.py                      |      17 +++++++++++++----

1 file changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/lib/package.py b/lib/package.py
t@@ -6,6 +6,7 @@ Package merging functions and helpers
 
 import os
 from gzip import open as gzip_open
+from lzma import open as lzma_open
 
 from lib.parse import (parse_packages, parse_dependencies)
 from lib.config import packages_keys
t@@ -17,7 +18,9 @@ def write_packages(packages, filename, sort=True):
     If sort=True, the packages are sorted by name.
     """
     os.makedirs(os.path.dirname(filename), exist_ok=True)
-    f = gzip_open(filename, 'w')
+    gzf = gzip_open(filename, 'w')
+    xzf = lzma_open(filename.replace('.gz', '.xz'), 'w')
+    f = open(filename.replace('.gz', ''), 'w')
 
     pkg_items = packages.items()
     if sort:
t@@ -27,9 +30,15 @@ def write_packages(packages, filename, sort=True):
         for key in packages_keys:
             if key in pkg_contents:
                 s = '%s: %s\n' % (key, pkg_contents[key])
-                f.write(s.encode('utf-8'))
-        f.write(b'\n')
-
+                gzf.write(s.encode('utf-8'))
+                xzf.write(s.encode('utf-8'))
+                f.write(s)
+        gzf.write(b'\n')
+        xzf.write(b'\n')
+        f.write('\n')
+
+    gzf.close()
+    xzf.close()
     f.close()