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 type(view) == Exception:
if hasattr (view, 'message'): # if hasattr (view, 'message'):
view = view.message # view = view.message
if type(view.message) == tuple: # if type(view) == tuple:
if view.message[0] == 403: # if view.message[0] == 403:
msg = _('Permission denied') # msg = _('Permission denied')
else: # else:
msg = ' '.join(map(lambda x: str(x), view.message)) # msg = ' '.join(map(lambda x: str(x), view.message))
else: # else:
msg = view.message.__str__() # msg = view.message.__str__()
msg = str(view)
show_msg(msg) show_msg(msg)
return 1 return 1

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

@ -691,7 +691,7 @@ class HTTPSClientCertTransport(HttpTransport):
else: else:
import M2Crypto import M2Crypto
bio = M2Crypto.BIO.openfile(key) 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: if not rsa:
raise OpenSSL.crypto.Error raise OpenSSL.crypto.Error
with open(key) as key_file: with open(key) as key_file:

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

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

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