Andreas Tille pushed to branch master at Debian Med / cycle
Commits: fbba171f by Andreas Tille at 2019-09-13T08:59:04Z Follow hint of Michael Kesper <[email protected]> (from [email protected]) to fix mix of string and bytestring issue - - - - - d4dca1ee by Andreas Tille at 2019-09-13T09:02:42Z peter green <[email protected]> at [email protected]: Also python 3 bytes objects behave a bit differently from python 2 str objects. To accommodate this I believe you need the following changes in p_rotor.py - - - - - 8732b337 by Andreas Tille at 2019-09-13T09:09:34Z Inform users about Python3 migration in NEWS.Debian - - - - - e8742584 by Andreas Tille at 2019-09-13T09:12:37Z Unicode-objects must be encoded before hashing - - - - - 66ab18a9 by Andreas Tille at 2019-09-13T09:17:31Z Warn users about issues to be expected due to Python3 migration and advise what to do - - - - - 6 changed files: - + debian/NEWS.Debian - debian/changelog - debian/docs - debian/patches/2to3.patch - + debian/patches/python3_migration_warning.patch - debian/patches/series Changes: ===================================== debian/NEWS.Debian ===================================== @@ -0,0 +1,13 @@ +cycle (0.3.1-16) unstable; urgency=medium + + Cycle was converted to Python3 by the Debian Med team since + Python2 will be removed from Debian 11. + If you notice any issues that might be connected to this conversion + please do + + reportbug cycle + + to let us know. + + -- Andreas Tille <[email protected]> Wed, 11 Sep 2019 15:32:06 +0200 + ===================================== debian/changelog ===================================== @@ -3,6 +3,7 @@ cycle (0.3.1-16) UNRELEASED; urgency=medium * Team upload. * Redo 2to3 patch, wxPython 4 migration Closes: #939181 + * Inform users about Python3 migration in NEWS.Debian -- Andreas Tille <[email protected]> Wed, 11 Sep 2019 15:32:06 +0200 ===================================== debian/docs ===================================== @@ -3,3 +3,4 @@ README_de.html README.html README_ru.html THANKS +debian/NEWS.Debian ===================================== debian/patches/2to3.patch ===================================== @@ -2570,8 +2570,12 @@ Last-Update: Fri, 06 Sep 2019 14:57:13 +0200 _('more' 'than' 'one' 'string') --- a/p_rotor.py +++ b/p_rotor.py -@@ -80,11 +80,11 @@ class newrotor(object): - for c in map(ord, buf): +@@ -77,14 +77,14 @@ class newrotor(object): + size, nr, rotors, pos = self.get_rotors(do_decrypt) + outbuf = [] + append = outbuf.append +- for c in map(ord, buf): ++ for c in buf: if do_decrypt: # Apply decrypt rotors and xor in reverse order - for i in xrange(nr-1,-1,-1): @@ -2584,7 +2588,7 @@ Last-Update: Fri, 06 Sep 2019 14:57:13 +0200 c = rotors[i][c ^ pos[i]] append(c) -@@ -96,7 +96,7 @@ class newrotor(object): +@@ -96,11 +96,11 @@ class newrotor(object): # Masking with 0xff simulates this behavior. # pnew = 0 # (pnew >= size) works as "carry bit" @@ -2593,6 +2597,11 @@ Last-Update: Fri, 06 Sep 2019 14:57:13 +0200 pnew = ((pos[i] + (pnew >= size)) & 0xff) + rotors[i][size] pos[i] = pnew % size +- return ''.join(map(chr, outbuf)) ++ return bytes(outbuf) + + def get_rotors(self, do_decrypt): + # Return a tuple (size, nr, rotors, positions) where @@ -146,7 +146,7 @@ class newrotor(object): # Generate identity permutation for 8-bit bytes plus an # (unused) increment value @@ -2611,6 +2620,15 @@ Last-Update: Fri, 06 Sep 2019 14:57:13 +0200 i = size positions.append(rand(i)) erotor = id_rotor[:] +@@ -184,7 +184,7 @@ def random_func(key): + x=995 + y=576 + z=767 +- for c in map(ord, key): ++ for c in key: + x = (((x<<3 | x>>13) + c) & mask) + y = (((y<<3 | y>>13) ^ c) & mask) + z = (((z<<3 | z>>13) - c) & mask) --- a/save_load.py +++ b/save_load.py @@ -1,10 +1,10 @@ @@ -2636,6 +2654,15 @@ Last-Update: Fri, 06 Sep 2019 14:57:13 +0200 import cal_year try: import rotor +@@ -24,7 +24,7 @@ def Save_Cycle(name='cycle', passwd='123 + """ + objSave=[] + m=hashlib.md5() +- m.update(passwd) ++ m.update(passwd.encode()) + rt=rotor.newrotor(m.digest()) + objSave.append(['period', cal_year.cycle.period]) + objSave.append(['by_average', cal_year.cycle.by_average]) @@ -32,23 +32,23 @@ def Save_Cycle(name='cycle', passwd='123 objSave.append(['first_week_day', cal_year.cycle.first_week_day]) objSave.append(['note', cal_year.cycle.note]) @@ -2660,7 +2687,7 @@ Last-Update: Fri, 06 Sep 2019 14:57:13 +0200 - tmp=rt.encrypt( 'Cycle'+cPickle.dumps(objSave) ) - tmp="UserName="+cPickle.dumps(name)+"==="+tmp -+ tmp=rt.encrypt( 'Cycle'+pickle.dumps(objSave) ) ++ tmp = rt.encrypt('Cycle{}'.format(pickle.dumps(objSave))) + tmp="UserName="+pickle.dumps(name)+"==="+tmp p, f_name=get_f_name(file) ===================================== debian/patches/python3_migration_warning.patch ===================================== @@ -0,0 +1,20 @@ +Description: Warn users about issues to be expected due to Python3 migration and advise what to do +Bug-Debian: https://bugs.debian.org/939181 +Author: Andreas Tille <[email protected]> +Last-Update: Fri, 06 Sep 2019 14:57:13 +0200 + +--- a/dialogs.py ++++ b/dialogs.py +@@ -326,7 +326,11 @@ def ask_name(parent=None): + "like HIV/AIDS.\n\nIt is just an electronic means of keeping track\n" + "of some of your medical data and extracting some statistical\n" + "conclusions from them. You cannot consider this program as a\n" +- "substitute for your gynecologist in any way.")) ++ "substitute for your gynecologist in any way.\n\n" ++ "Please also note: This program was ported from Python2 which is\n" ++ "End Of Life since 2020-01-01 to Python3 by the Debian Med team\n" ++ "In case you might notice any issue with this program report it via\n" ++ " reportbug cycle")) + dlg = wx.TextEntryDialog(parent, _('Enter your name:'),_('New user'),'', + style=wx.OK | wx.CANCEL) + while dlg.ShowModal()==wx.ID_OK: ===================================== debian/patches/series ===================================== @@ -11,3 +11,4 @@ 07_wxpython3.0.patch wxclientsize.patch 2to3.patch +python3_migration_warning.patch View it on GitLab: https://salsa.debian.org/med-team/cycle/compare/3daaebaa5a71cc0130e842d1dfa968348108d924...66ab18a9d83d9843b678b779088be12555d65cb3 -- View it on GitLab: https://salsa.debian.org/med-team/cycle/compare/3daaebaa5a71cc0130e842d1dfa968348108d924...66ab18a9d83d9843b678b779088be12555d65cb3 You're receiving this email because of your account on salsa.debian.org.
_______________________________________________ debian-med-commit mailing list [email protected] https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/debian-med-commit
