Date: Fri, 25 Mar 2022 13:50:53 GMT From: Po-Chuan Hsieh <sunpoet@FreeBSD.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org Subject: git: e4b417e3be07 - main - security/py-cerealizer: Fix build with setuptools 58.0.0+ Message-ID: <202203251350.22PDorNg037536@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by sunpoet: URL: https://cgit.FreeBSD.org/ports/commit/?id=e4b417e3be07475addc65bd4981ded03a730cdbb commit e4b417e3be07475addc65bd4981ded03a730cdbb Author: Po-Chuan Hsieh <sunpoet@FreeBSD.org> AuthorDate: 2022-03-25 13:33:54 +0000 Commit: Po-Chuan Hsieh <sunpoet@FreeBSD.org> CommitDate: 2022-03-25 13:38:20 +0000 security/py-cerealizer: Fix build with setuptools 58.0.0+ With hat: python --- security/py-cerealizer/files/patch-2to3 | 98 +++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) diff --git a/security/py-cerealizer/files/patch-2to3 b/security/py-cerealizer/files/patch-2to3 new file mode 100644 index 000000000000..e6dc7b618ead --- /dev/null +++ b/security/py-cerealizer/files/patch-2to3 @@ -0,0 +1,98 @@ +--- __init__.py.orig 2008-06-29 21:52:17 UTC ++++ __init__.py +@@ -123,12 +123,12 @@ import logging + logger = logging.getLogger("cerealizer") + #logging.basicConfig(level=logging.INFO) + +-from cStringIO import StringIO ++from io import StringIO + from new import instance + +-class EndOfFile(StandardError): pass +-class NotCerealizerFileError(StandardError): pass +-class NonCerealizableObjectError(StandardError): pass ++class EndOfFile(Exception): pass ++class NotCerealizerFileError(Exception): pass ++class NonCerealizableObjectError(Exception): pass + + def _priority_sorter(a, b): return cmp(a[0], b[0]) + +@@ -206,7 +206,7 @@ Reads a reference from file S.""" + elif c == "r": return self.id2obj[int(s.readline())] + elif c == "n": return None + elif c == "b": return bool(int(s.read(1))) +- elif c == "l": return long(s.readline()) ++ elif c == "l": return int(s.readline()) + elif c == "c": return complex(s.readline()) + raise ValueError("Unknown ref code '%s'!" % c) + +@@ -357,13 +357,13 @@ class DictHandler(Handler): + classname = "dict\n" + def collect(self, obj, dumper): + if Handler.collect(self, obj, dumper): +- for i in obj.iterkeys (): dumper.collect(i) # Collect is not ordered +- for i in obj.itervalues(): dumper.collect(i) ++ for i in obj.keys (): dumper.collect(i) # Collect is not ordered ++ for i in obj.values(): dumper.collect(i) + return 1 + + def dump_data(self, obj, dumper, s): + s.write("%s\n" % len(obj)) +- for k, v in obj.iteritems(): ++ for k, v in obj.items(): + _HANDLERS_[v.__class__].dump_ref(v, dumper, s) # Value is saved fist + _HANDLERS_[k.__class__].dump_ref(k, dumper, s) + +@@ -509,16 +509,16 @@ have to write a custom Handler or a __getstate__ and _ + + CLASSNAME is the classname used in Cerealizer files. It defaults to the full classname (module.class) + but you may choose something shorter -- as long as there is no risk of name clash.""" +- if not _configurable: raise StandardError("Cannot register new classes after freeze_configuration has been called!") ++ if not _configurable: raise Exception("Cannot register new classes after freeze_configuration has been called!") + if "\n" in classname: raise ValueError("CLASSNAME cannot have \\n (Cerealizer automatically add a trailing \\n for performance reason)!") + if not handler: + if hasattr(Class, "__getnewargs__" ): handler = NewArgsObjHandler (Class, classname) + elif hasattr(Class, "__getinitargs__"): handler = InitArgsObjHandler(Class, classname) + elif hasattr(Class, "__slots__" ): handler = SlotedObjHandler (Class, classname) + else: handler = ObjHandler (Class, classname) +- if _HANDLERS_.has_key(Class): raise ValueError("Class %s has already been registred!" % Class) ++ if Class in _HANDLERS_: raise ValueError("Class %s has already been registred!" % Class) + if not isinstance(handler, RefHandler): +- if _HANDLERS .has_key(handler.classname): raise ValueError("A class has already been registred under the name %s!" % handler.classname[:-1]) ++ if handler.classname in _HANDLERS: raise ValueError("A class has already been registred under the name %s!" % handler.classname[:-1]) + _HANDLERS [handler.classname] = handler + if handler.__class__ is ObjHandler: + logger.info("Registring class %s as '%s'" % (Class, handler.classname[:-1])) +@@ -544,7 +544,7 @@ and you'll be able to open old files containing OldCla + handler = _HANDLERS_.get(Class) + if not handler: + raise ValueError("Cannot register alias '%s' to Class %s: the class is not yet registred!" % (alias, Class)) +- if _HANDLERS.has_key(alias): ++ if alias in _HANDLERS: + raise ValueError("Cannot register alias '%s' to Class %s: another class is already registred under the alias name!" % (alias, Class)) + logger.info("Registring alias '%s' for %s" % (alias, Class)) + _HANDLERS[alias + "\n"] = handler +@@ -563,10 +563,10 @@ unexpected calls to register().""" + + register(type(None), NoneHandler ()) + register(str , StrHandler ()) +-register(unicode , UnicodeHandler ()) ++register(str , UnicodeHandler ()) + register(bool , BoolHandler ()) + register(int , IntHandler ()) +-register(long , LongHandler ()) ++register(int , LongHandler ()) + register(float , FloatHandler ()) + register(complex , ComplexHandler ()) + register(dict , DictHandler ()) +@@ -613,8 +613,8 @@ def dump_class_of_module(*modules): + Utility function; for each classes found in the given module, print the needed call to register.""" + class D: pass + class O(object): pass +- s = set([c for module in modules for c in module.__dict__.values() if isinstance(c, type(D)) or isinstance(c, type(O))]) ++ s = set([c for module in modules for c in list(module.__dict__.values()) if isinstance(c, type(D)) or isinstance(c, type(O))]) + l = ['cerealizer.register(%s.%s)' % (c.__module__, c.__name__) for c in s] + l.sort() +- for i in l: print i ++ for i in l: print(i) +
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202203251350.22PDorNg037536>