[Libreoffice-commits] core.git: onlineupdate/source

Markus Mohrhard markus.mohrhard at googlemail.com
Mon Jul 31 22:02:07 UTC 2017


 onlineupdate/source/update/updater/gen_cert_header.py |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

New commits:
commit c210d7cc092616ecdd1072f1238ec3b619f7387b
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Jul 24 23:15:33 2017 +0200

    make it easier to debug the generation of certificate data
    
    Change-Id: I86e3c3254cef297c46a8ca377b5ceb36b348e2b3
    Reviewed-on: https://gerrit.libreoffice.org/40607
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/onlineupdate/source/update/updater/gen_cert_header.py b/onlineupdate/source/update/updater/gen_cert_header.py
index a75af1e295fb..3f3798cfb425 100755
--- a/onlineupdate/source/update/updater/gen_cert_header.py
+++ b/onlineupdate/source/update/updater/gen_cert_header.py
@@ -1,5 +1,7 @@
 #!/usr/bin/env python
 
+from __future__ import print_function
+import os
 import sys
 import binascii
 
@@ -13,6 +15,9 @@ def file_byte_generator(filename):
         block = f.read()
         return block
 
+def eprint(*args, **kwargs):
+    print(*args, file=sys.stderr, **kwargs)
+
 def create_header(array_name, in_filename):
     if sys.version_info >= (3,0):
         hexified = ["0x" + binascii.hexlify(bytes([inp])).decode('ascii') for inp in file_byte_generator(in_filename)]
@@ -25,8 +30,13 @@ def create_header(array_name, in_filename):
 
 if __name__ == '__main__':
     if len(sys.argv) < 3:
-        print('ERROR: usage: gen_cert_header.py array_name update_config_file')
-        sys.exit(1);
+        eprint('ERROR: usage: gen_cert_header.py array_name update_config_file')
+        sys.exit(1)
+
+    if not os.path.exists(sys.argv[2]):
+        eprint('The config file %s does not exist'%(sys.argv[2]))
+        sys.exit(1)
+
     config = ConfigParser()
     config.read(sys.argv[2])
     sys.exit(create_header(sys.argv[1], config.get('Updater', 'certificate-der')))


More information about the Libreoffice-commits mailing list