more python3 fixes

This commit is contained in:
j 2014-10-31 18:47:48 +01:00
parent c8a4f6922c
commit 17406a3929
2 changed files with 10 additions and 10 deletions

View file

@ -32,12 +32,12 @@ def generate_ssl():
ca.set_issuer(ca.get_subject())
ca.set_pubkey(key)
ca.add_extensions([
OpenSSL.crypto.X509Extension("basicConstraints", True, "CA:TRUE, pathlen:0"),
OpenSSL.crypto.X509Extension("nsCertType", True, "sslCA"),
OpenSSL.crypto.X509Extension("extendedKeyUsage", True,
"serverAuth,clientAuth,emailProtection,timeStamping,msCodeInd,msCodeCom,msCTLSign,msSGC,msEFS,nsSGC"),
OpenSSL.crypto.X509Extension("keyUsage", False, "keyCertSign, cRLSign"),
OpenSSL.crypto.X509Extension("subjectKeyIdentifier", False, "hash", subject=ca),
OpenSSL.crypto.X509Extension(b"basicConstraints", True, b"CA:TRUE, pathlen:0"),
OpenSSL.crypto.X509Extension(b"nsCertType", True, b"sslCA"),
OpenSSL.crypto.X509Extension(b"extendedKeyUsage", True,
b"serverAuth,clientAuth,emailProtection,timeStamping,msCodeInd,msCodeCom,msCTLSign,msSGC,msEFS,nsSGC"),
OpenSSL.crypto.X509Extension(b"keyUsage", False, b"keyCertSign, cRLSign"),
OpenSSL.crypto.X509Extension(b"subjectKeyIdentifier", False, b"hash", subject=ca),
])
ca.sign(key, "sha1")
with open(settings.ssl_cert_path, 'wb') as fd:

View file

@ -45,7 +45,7 @@ def get(url, filename=None):
dirname = os.path.dirname(filename)
if dirname and not os.path.exists(dirname):
os.makedirs(dirname)
with open(filename, 'w') as fd:
with open(filename, 'wb') as fd:
data = u.read(4096)
while data:
fd.write(data)
@ -54,7 +54,7 @@ def get(url, filename=None):
def check():
if settings.release:
release_data = get(RELEASE_URL)
release = json.loads(release_data)
release = json.loads(release_data.decode('utf-8'))
old = settings.release['modules']['openmedialibrary']['version']
new = release['modules']['openmedialibrary']['version']
return verify(release) and old < new
@ -64,7 +64,7 @@ def download():
if not os.path.exists(os.path.join(settings.config_path, 'release.json')):
return True
release_data = get(RELEASE_URL)
release = json.loads(release_data)
release = json.loads(release_data.decode('utf-8'))
if verify(release):
ox.makedirs(settings.updates_path)
os.chdir(os.path.dirname(settings.base_dir))
@ -80,7 +80,7 @@ def download():
os.unlink(module_tar)
return False
current_files.add(os.path.basename(module_tar))
with open(os.path.join(settings.updates_path, 'release.json'), 'w') as fd:
with open(os.path.join(settings.updates_path, 'release.json'), 'wb') as fd:
fd.write(release_data)
for f in set(os.walk(settings.updates_path).next()[2])-current_files:
os.unlink(os.path.join(settings.updates_path, f))