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

Markus Mohrhard markus.mohrhard at googlemail.com
Sat Jun 17 18:57:26 UTC 2017


 bin/update/config.py                                  |    3 ++-
 bin/update/upload_build_config.py                     |    2 +-
 onlineupdate/source/update/updater/gen_cert_header.py |   17 ++++++++++++-----
 3 files changed, 15 insertions(+), 7 deletions(-)

New commits:
commit b6d3fa93befafdc139473290c2143145af55cc05
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Jun 17 20:55:47 2017 +0200

    updater: expand ~ to $HOME in config path of uploader script
    
    Change-Id: I8c5ce1a2c256fbaf046fbe73e5574d48cd3f3a7a

diff --git a/bin/update/config.py b/bin/update/config.py
index 0279a172d258..0bc60a07f53b 100644
--- a/bin/update/config.py
+++ b/bin/update/config.py
@@ -1,5 +1,6 @@
 
 import configparser
+import os
 
 class Config(object):
 
@@ -13,7 +14,7 @@ class Config(object):
 
 def parse_config(config_file):
     config = configparser.ConfigParser()
-    config.read(config_file)
+    config.read(os.path.expanduser(config_file))
 
     data = Config()
     updater_data = config['Updater']
diff --git a/bin/update/upload_build_config.py b/bin/update/upload_build_config.py
index 3267f021b8e3..9a87661eee73 100755
--- a/bin/update/upload_build_config.py
+++ b/bin/update/upload_build_config.py
@@ -12,7 +12,7 @@ def main(argv):
     updater_config = sys.argv[2]
 
     config = configparser.ConfigParser()
-    config.read(updater_config)
+    config.read(os.path.expanduser(updater_config))
 
     user = config["Updater"]["User"]
     password = config["Updater"]["Password"]
commit d04ab636235d86be3571b8ffbee16183a5e30fb8
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Jun 17 18:43:07 2017 +0200

    updater: get the certificate code working on python2 and 3
    
    Change-Id: Id1b4a443629c95fdbda59153c6f688629f6b1862

diff --git a/onlineupdate/source/update/updater/gen_cert_header.py b/onlineupdate/source/update/updater/gen_cert_header.py
index 8fedcd9bcf62..a75af1e295fb 100755
--- a/onlineupdate/source/update/updater/gen_cert_header.py
+++ b/onlineupdate/source/update/updater/gen_cert_header.py
@@ -1,8 +1,12 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python
 
 import sys
 import binascii
-import configparser
+
+try:
+    from configparser import ConfigParser
+except ImportError:
+    from ConfigParser import SafeConfigParser as ConfigParser
 
 def file_byte_generator(filename):
     with open(filename, "rb") as f:
@@ -10,7 +14,10 @@ def file_byte_generator(filename):
         return block
 
 def create_header(array_name, in_filename):
-    hexified = ["0x" + binascii.hexlify(bytes([inp])).decode('ascii') for inp in file_byte_generator(in_filename)]
+    if sys.version_info >= (3,0):
+        hexified = ["0x" + binascii.hexlify(bytes([inp])).decode('ascii') for inp in file_byte_generator(in_filename)]
+    else:
+        hexified = ["0x" + binascii.hexlify(inp).decode('ascii') for inp in file_byte_generator(in_filename)]
     print("const uint8_t " + array_name + "[] = {")
     print(", ".join(hexified))
     print("};")
@@ -20,6 +27,6 @@ if __name__ == '__main__':
     if len(sys.argv) < 3:
         print('ERROR: usage: gen_cert_header.py array_name update_config_file')
         sys.exit(1);
-    config = configparser.ConfigParser()
+    config = ConfigParser()
     config.read(sys.argv[2])
-    sys.exit(create_header(sys.argv[1], config['Updater']['certificate-der']))
+    sys.exit(create_header(sys.argv[1], config.get('Updater', 'certificate-der')))


More information about the Libreoffice-commits mailing list