fixed rsa bugs, fixed show_msg crash, added post-install script for crutch_lib

Py3
idziubenko 3 years ago
parent 46cbe645e1
commit fe04a136c9

@ -1 +0,0 @@
These are placeholder python3 libs for console-gui. These were migrated to py3 in a very shallow way, any functionality not used by console-gui probablys wasn't tested.

@ -274,16 +274,17 @@ class DisplayMethod(qt.QWidget):
if type(view) == Exception:
if hasattr (view, 'message'):
view = view.message
if type(view.message) == tuple:
if view.message[0] == 403:
msg = _('Permission denied')
else:
msg = ' '.join(map(lambda x: str(x), view.message))
else:
msg = view.message.__str__()
# if hasattr (view, 'message'):
# view = view.message
# if type(view) == tuple:
# if view.message[0] == 403:
# msg = _('Permission denied')
# else:
# msg = ' '.join(map(lambda x: str(x), view.message))
# else:
# msg = view.message.__str__()
msg = str(view)
show_msg(msg)
return 1

@ -238,16 +238,17 @@ class LeftMenu(qt.QScrollArea):
def onActivated_after(self, view):
if type(view) == Exception:
if hasattr (view.message, 'message'):
view = view.message
if type(view.message) == tuple:
if view.message[0] == 403:
msg = _('Permission denied')
else:
msg = ' '.join(map(lambda x: str(x), view.message))
else:
msg = view.message.__str__()
# if hasattr (view.message, 'message'):
# view = view.message
# if type(view.message) == tuple:
# if view.message[0] == 403:
# msg = _('Permission denied')
# else:
# msg = ' '.join(map(lambda x: str(x), view.message))
# else:
# msg = view.message.__str__()
msg = str(view)
show_msg(msg)
return 1

@ -691,7 +691,7 @@ class HTTPSClientCertTransport(HttpTransport):
else:
import M2Crypto
bio = M2Crypto.BIO.openfile(key)
rsa = M2Crypto.m2.rsa_read_key(bio._ptr(),lambda *unused: None)
rsa = M2Crypto.m2.rsa_read_key(bio._ptr(),lambda *unused: b"")
if not rsa:
raise OpenSSL.crypto.Error
with open(key) as key_file:

@ -329,7 +329,7 @@ class FrameConnection(qt.QWidget):
bio = M2Crypto.BIO.openfile(CERT_KEY)
rsa = M2Crypto.m2.rsa_read_key(bio._ptr(), lambda *unused: b"")
if re_passwd != False:
self.str_passwd = re_passwd, "UTF-8"
self.str_passwd = re_passwd#, "UTF-8"
if not rsa and not self.str_passwd and auto:
self.passwd_wgt = LocalhostPasswd(self)
passwd = self.passwd_wgt.text()

@ -149,12 +149,12 @@ class RequestCreate (qt.QWidget):
private_key_passwd = self.passwd_lineedit.text()
rsa = generateRSAKey()
rsa.save_key(self.key + '_pub', cipher = None,
callback = lambda *unused: "")
callback = lambda *unused: b"")
pkey = makePKey(rsa)
if not passphrase_callback(private_key_passwd):
pkey.save_key(self.key, cipher = None,
callback = lambda *unused: "")
callback = lambda *unused: b"")
else:
pkey.save_key(self.key,\
callback= lambda *unused: bytes(private_key_passwd, "UTF-8"))

@ -24,7 +24,8 @@ import sys
import distutils
from distutils.core import setup
from distutils.command.install_data import install_data
from distutils.command.install import install
from distutils.dir_util import copy_tree
import itertools
icon_system_path = ['/usr/share/icons/Calculate/16x16/client-gui']
@ -107,13 +108,19 @@ for theme in ("gnome","hicolor"):
__version__ = "3.5.0_alpha1"
__app__ = "calculate-console-gui"
module_name = "calculate.consolegui"
packages = [
"calculate."+str('.'.join(root.split(os.sep)[1:]))
for root, dirs, files in os.walk('pym/consolegui')
if '__init__.py' in files
]
#TODO remove this once actual libs are ported
class my_install(install):
def run(self):
install.run(self)
copy_tree("./libs_crutch", f"{self.install_lib}calculate")
setup(
name = __app__,
version = __version__,
@ -126,5 +133,5 @@ setup(
package_dir = {'calculate.consolegui': "pym/consolegui"},
packages = packages,
scripts = (glob('bin/*')),
cmdclass={'install_data': install_data}
)
cmdclass={'install_data': install_data, "install" : my_install}
)
Loading…
Cancel
Save