Compare commits

...

7 Commits

Author SHA1 Message Date
Ilja Honkonen dcbc9ab0ef Revert "Allow Python 3."
This reverts commit 7c66577671.
2021-03-25 15:01:09 +02:00
Ilja Honkonen c54865eef4 One more keyword workaround. 2021-03-23 16:07:02 +02:00
Ilja Honkonen d5d3f7423f Handle missing keyword in python2 configparser. 2021-03-23 16:04:55 +02:00
Ilja Honkonen a692c19faa Update calls to configparser to python3. 2021-03-23 15:59:20 +02:00
Ilja Honkonen 39b952af53 Fix imports of ConfigParser for python3. 2021-03-22 16:35:22 +02:00
Ilja Honkonen 557c16a6b9 Decode openssl_cflags bytes to utf8. 2021-03-22 15:37:14 +02:00
Ilja Honkonen 7c66577671 Allow Python 3. 2021-03-21 16:05:27 +02:00
5 changed files with 40 additions and 12 deletions

View File

@ -58,7 +58,11 @@ For further examples please reference `.tests.test_api`.
"""
import base64
import ConfigParser
try:
import ConfigParser
except ModuleNotFoundError:
import configparser as ConfigParser
ConfigParser.SafeConfigParser = ConfigParser.ConfigParser
import errno
import hashlib
import httplib

View File

@ -10,7 +10,11 @@ Bitmessage commandline interface
# * python2-pythondialog
# * dialog
import ConfigParser
try:
import ConfigParser
except ModuleNotFoundError:
import configparser as ConfigParser
ConfigParser.SafeConfigParser = ConfigParser.ConfigParser
import curses
import os
import sys

View File

@ -2,7 +2,11 @@
BMConfigParser class definition and default configuration settings
"""
import ConfigParser
try:
import ConfigParser
except ModuleNotFoundError:
import configparser as ConfigParser
ConfigParser.SafeConfigParser = ConfigParser.ConfigParser
import os
import shutil
from datetime import datetime
@ -60,21 +64,33 @@ class BMConfigParser(ConfigParser.SafeConfigParser):
raise ValueError("Invalid value %s" % value)
return ConfigParser.ConfigParser.set(self, section, option, value)
def get(self, section, option, raw=False, variables=None):
def get(self, section, option, raw=False, vars=None, fallback=None):
# pylint: disable=arguments-differ
try:
if section == "bitmessagesettings" and option == "timeformat":
try:
return ConfigParser.ConfigParser.get(
self, section, option, raw, variables)
self, section, option, raw=raw, vars=vars, fallback=fallback)
except TypeError:
return ConfigParser.ConfigParser.get(
self, section, option, raw=raw, vars=vars)
try:
return self._temp[section][option]
except KeyError:
pass
try:
return ConfigParser.ConfigParser.get(
self, section, option, True, variables)
self, section, option, raw=True, vars=vars, fallback=fallback)
except TypeError:
return ConfigParser.ConfigParser.get(
self, section, option, raw=True, vars=vars)
except ConfigParser.InterpolationError:
try:
return ConfigParser.ConfigParser.get(
self, section, option, True, variables)
self, section, option, raw=True, vars=vars, fallback=fallback)
except TypeError:
return ConfigParser.ConfigParser.get(
self, section, option, raw=True, vars=vars)
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError) as e:
try:
return BMConfigDefaults[section][option]

View File

@ -35,7 +35,11 @@ Logging is thread-safe so you don't have to worry about locks,
just import and log.
"""
import ConfigParser
try:
import ConfigParser
except ModuleNotFoundError:
import configparser as ConfigParser
ConfigParser.SafeConfigParser = ConfigParser.ConfigParser
import logging
import logging.config
import os

View File

@ -301,7 +301,7 @@ def check_openssl():
' OpenSSL 0.9.8b or later with AES, Elliptic Curves (EC),'
' ECDH, and ECDSA enabled.')
return False
matches = cflags_regex.findall(openssl_cflags)
matches = cflags_regex.findall(openssl_cflags.decode())
if matches:
logger.error(
'This OpenSSL library is missing the following required'