From 1a5fd04499827b37b216c5569b105e7c5e272bad Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 19 Dec 2020 01:59:36 +0100 Subject: [PATCH] pzip: use Python zlib module to perform pzip step This is more useful when cross-compiling, not requiring a functional pzip binary on the host. --- makepanda/makepanda.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 00436d9d05..3aa69e8daf 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -30,6 +30,11 @@ import time import os import sys +try: + import zlib +except: + zlib = None + ######################################################################## ## ## PARSING THE COMMAND LINE OPTIONS @@ -1904,7 +1909,11 @@ def CompileEgg(eggfile, src, opts): oscmd(flt2egg + ' -ps keep -o ' + BracketNameWithQuotes(eggfile) + ' ' + BracketNameWithQuotes(src)) if pz: - oscmd(pzip + ' ' + BracketNameWithQuotes(eggfile)) + if zlib: + WriteBinaryFile(eggfile + '.pz', zlib.compress(ReadBinaryFile(eggfile))) + os.remove(eggfile) + else: + oscmd(pzip + ' ' + BracketNameWithQuotes(eggfile)) ########################################################################################## #