Hello community,

here is the log from the commit of package python-pybeam for openSUSE:Factory 
checked in at 2017-01-28 11:04:27
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pybeam (Old)
 and      /work/SRC/openSUSE:Factory/.python-pybeam.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-pybeam"

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pybeam/python-pybeam.changes      
2017-01-23 11:29:16.290947929 +0100
+++ /work/SRC/openSUSE:Factory/.python-pybeam.new/python-pybeam.changes 
2017-02-03 18:58:08.119321216 +0100
@@ -1,0 +2,6 @@
+Fri Jan 20 19:35:02 UTC 2017 - matwey.korni...@gmail.com
+
+- Version 0.4:
+  - ported to construct 2.8.x
+
+-------------------------------------------------------------------

Old:
----
  pybeam-0.3.3.tar.gz

New:
----
  pybeam-0.4.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-pybeam.spec ++++++
--- /var/tmp/diff_new_pack.ID6ieK/_old  2017-02-03 18:58:09.227165626 +0100
+++ /var/tmp/diff_new_pack.ID6ieK/_new  2017-02-03 18:58:09.227165626 +0100
@@ -17,14 +17,14 @@
 
 
 Name:           python-pybeam
-Version:        0.3.3
+Version:        0.4
 Release:        0
 Summary:        Python module to parse Erlang BEAM files
 License:        MIT
 Group:          Development/Languages/Python
 Url:            http://github.com/matwey/pybeam
 Source:         
https://files.pythonhosted.org/packages/source/p/pybeam/pybeam-%{version}.tar.gz
-BuildRequires:  python-construct < 2.8
+BuildRequires:  python-construct >= 2.8
 BuildRequires:  python-devel
 BuildRequires:  python-setuptools
 Requires:       python-construct

++++++ pybeam-0.3.3.tar.gz -> pybeam-0.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pybeam-0.3.3/PKG-INFO new/pybeam-0.4/PKG-INFO
--- old/pybeam-0.3.3/PKG-INFO   2017-01-08 15:06:32.000000000 +0100
+++ new/pybeam-0.4/PKG-INFO     2017-01-20 20:30:35.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.0
 Name: pybeam
-Version: 0.3.3
+Version: 0.4
 Summary: Python module to parse Erlang BEAM files
 Home-page: http://github.com/matwey/pybeam
 Author: Matwey V. Kornilov
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pybeam-0.3.3/pybeam/beam_construct.py 
new/pybeam-0.4/pybeam/beam_construct.py
--- old/pybeam-0.3.3/pybeam/beam_construct.py   2017-01-08 14:57:10.000000000 
+0100
+++ new/pybeam-0.4/pybeam/beam_construct.py     2017-01-18 19:11:21.000000000 
+0100
@@ -25,83 +25,44 @@
 from pybeam.eetf_construct import term, external_term
 import codecs
 
-erl_version_magic = Magic(b'\x83')
+chunk_atom = PrefixedArray(Int32ub, PascalString(lengthfield = Int8ub, 
encoding="latin1"))
 
-chunk_atom = Rename("chunk_atom", PrefixedArray(PascalString("atom", 
encoding="latin1"), length_field = UBInt32("len")))
+chunk_attr = external_term
 
-chunk_attr = Rename("chunk_attr", external_term)
+chunk_cinf = external_term
 
-chunk_cinf = Rename("chunk_cinf", external_term)
-
-chunk_code = Struct("chunk_code",
-       UBInt32("headerlen"),
-       UBInt32("set"),
-       UBInt32("opcode_max"),
-       UBInt32("labels"),
-       UBInt32("functions"),
-       Bytes("skip", lambda ctx: ctx.headerlen-16),
-       Bytes("code", lambda ctx: ctx._.size-ctx.headerlen-4),
+chunk_code = Struct("headerlen" / Int32ub,
+       "set" / Int32ub,
+       "opcode_max" / Int32ub,
+       "labels" / Int32ub,
+       "functions" / Int32ub,
+       Bytes(lambda ctx: ctx.headerlen-16),
+       Bytes(lambda ctx: ctx._.size-ctx.headerlen-4),
        )
 
-chunk_expt = Struct("chunk_expt",
-       UBInt32("len"),
-       Array(lambda ctx: ctx.len, Struct("entry",
-                       UBInt32("function"),
-                       UBInt32("arity"),
-                       UBInt32("label"),
-               )
-       )
-       )
+chunk_expt = Struct("entry" / PrefixedArray(Int32ub, Struct("function" / 
Int32ub,
+       "arity" / Int32ub,
+       "label" / Int32ub)))
 
-chunk_impt = Struct("chunk_impt",
-       UBInt32("len"),
-       Array(lambda ctx: ctx.len, Struct("entry",
-                       UBInt32("module"),
-                       UBInt32("function"),
-                       UBInt32("arity"),
-               )
-       )
-       )
+chunk_impt = Struct("entry" / PrefixedArray(Int32ub, Struct("module" / Int32ub,
+       "function" / Int32ub,
+       "arity" / Int32ub)))
 
-chunk_litt = Struct("chunk_litt",
-       UBInt32("len_uncompressed"),
-       TunnelAdapter(
-               ExprAdapter(Bytes("data", length = lambda ctx: ctx._.size-4),
-                       encoder = lambda obj,ctx: 
codecs.encode(obj,"zlib_codec"),
-                       decoder = lambda obj,ctx: 
codecs.decode(obj,"zlib_codec")
-               ),
-               Struct("uncompressed",
-                       UBInt32("len"),
-                       Array(lambda ctx: ctx.len, Struct("entry",
-                                       UBInt32("len"),
-                                       erl_version_magic,
-                                       term
-                               )
-                       )
-               )
-       )
+uncomp_chunk_litt = Struct("entry" / PrefixedArray(Int32ub, Prefixed(Int32ub, 
Struct("term" / external_term))))
+chunk_litt = Struct(Int32ub,
+       "data" / Prefixed(Computed(lambda ctx: ctx._.size-4),
+               Compressed(uncomp_chunk_litt, "zlib")
        )
+)
 
-chunk_loct = Struct("chunk_loct",
-       UBInt32("len"),
-       Array(lambda ctx: ctx.len, Struct("entry",
-                       UBInt32("function"),
-                       UBInt32("arity"),
-                       UBInt32("label"),
-               )
-       )
-       )
+chunk_loct = PrefixedArray(Int32ub, Struct("function" / Int32ub,
+       "arity" / Int32ub,
+       "label" / Int32ub))
 
-chunk_strt = Struct("chunk_strt",
-       PascalString("string", length_field = UBInt32("len"), encoding="latin1")
-       )
-
-chunk = Struct("chunk",
-       String("chunk_name",4),
-       UBInt32("size"),
-       If(lambda ctx: ctx.size > 0,
-               SeqOfOne("payload",
-                       Switch("payload", lambda ctx: ctx.chunk_name,
+chunk = Struct(
+       "chunk_name" / String(4),
+       "size" / Int32ub,
+       "payload" / Switch(this.chunk_name,
                                {
 #                              "Abst" : chunk_abst,
                                b"Atom" : chunk_atom,
@@ -117,21 +78,18 @@
 #                              "StrT" : chunk_strt,
 #                              "Trac" : chunk_trac,
                                },
-                               default = Bytes("skip", lambda ctx: ctx.size)
+                               default = Bytes(lambda ctx: ctx.size)
                        ),
-                       Padding(lambda ctx: (4 - ctx.size % 4) % 4, pattern = 
"\00"),
-                       nested = False,
-               ),
-               []
+# Aligned(4, ..)
+                       Padding(lambda ctx: (4 - ctx.size % 4) % 4, pattern = 
b'\00'),
                )
-       )
 
-beam = Struct("beam",
-       Const(String('for1',4),b'FOR1'),
-       UBInt32("size"),
-       Const(String('beam',4),b'BEAM'),
-       OptionalGreedyRange(chunk),
-       Terminator,
+beam = Struct(
+       "for1" / Const(b'FOR1'),
+       "size" / Int32ub,
+       "beam" / Const(b'BEAM'),
+       "chunk" / GreedyRange(chunk),
+       Terminated,
        )
 
 __all__ = ["beam"]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pybeam-0.3.3/pybeam/beam_file.py 
new/pybeam-0.4/pybeam/beam_file.py
--- old/pybeam-0.3.3/pybeam/beam_file.py        2017-01-08 14:57:10.000000000 
+0100
+++ new/pybeam-0.4/pybeam/beam_file.py  2017-01-18 19:11:40.000000000 +0100
@@ -23,8 +23,10 @@
 from pybeam.beam_construct import beam
 
 class BeamFile(object):
-       def __init__(self, filename):
-               self._tree = beam.parse(open(filename,"rb").read())
+       def __init__(self, f):
+               if not hasattr(f, 'read'):
+                       f = open(f, "rb")
+               self._tree = beam.parse(f.read())
 
        def selectChunkByName(self, name):
                for c in self._tree.chunk:
@@ -71,8 +73,3 @@
        @property
        def modulename(self):
                return self.atoms[0]
-
-       @property
-       def strings(self):
-               strt = self.selectChunkByName(b"StrT")
-               return strt.payload
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pybeam-0.3.3/pybeam/eetf_construct.py 
new/pybeam-0.4/pybeam/eetf_construct.py
--- old/pybeam-0.3.3/pybeam/eetf_construct.py   2017-01-08 14:57:10.000000000 
+0100
+++ new/pybeam-0.4/pybeam/eetf_construct.py     2017-01-18 19:11:21.000000000 
+0100
@@ -51,7 +51,7 @@
        def _encode(self, obj, ctx):
                return list(obj.items())
 
-def BigInteger(subconname, length_field = UBInt8("length")):
+def BigInteger(length_field):
        def decode_big(obj,ctx):
                (length, isNegative, value) = obj
                ret = sum([d << i*8 for (d,i) in 
zip(value,range(0,len(value)))])
@@ -70,11 +70,9 @@
                        obj = obj >> 8
                return (len(value), isNegative, value)
 
-       return ExprAdapter(Sequence(subconname,
-               length_field,
-               UBInt8("isNegative"),
-               Array(lambda ctx: ctx.length, UBInt8("value")),
-               nested = False),
+       return ExprAdapter(Sequence("len" / length_field,
+               "isNegative" / Int8ub,
+               "value" / Array(lambda ctx: ctx.len, Int8ub)),
                encoder = encode_big,
                decoder = decode_big)
 
@@ -102,142 +100,122 @@
        else: 
                return mapping[obj.__class__]
 
-atom_cache_ref = ExprAdapter(UBInt8("atom_cache_ref"),
+# Recurrent term
+term_ = LazyBound(lambda ctx: term)
+
+atom_cache_ref = ExprAdapter(Int8ub,
                encoder = lambda obj,ctx: obj.index,
                decoder = lambda obj,ctx: AtomCacheReference(obj))
-small_integer = UBInt8("small_integer")
-integer = SBInt32("integer")
-float_ = ExprAdapter(String("float",31,padchar='\00',encoding="latin1"),
+small_integer = Int8ub
+integer = Int32sb
+float_ = ExprAdapter(String(31,padchar=b'\00',encoding="latin1"),
                encoder = lambda obj,ctx: "%.20e    " % obj,
                decoder = lambda obj,ctx: float(obj.strip()))
-atom = PascalString("atom", length_field = UBInt16("length"), 
encoding="latin1")
-reference = ExprAdapter(Sequence("reference",
-               LazyBound("Node", lambda : term),
-               UBInt32("ID"),
-               UBInt8("Creation"),
-               nested = False),
+atom = PascalString(lengthfield = Int16ub, encoding="latin1")
+reference = ExprAdapter(Sequence("node" / term_,
+               "id" / Int32ub,
+               "creation" / Int8ub),
                encoder = lambda obj,ctx: (obj.node, obj.id, obj.creation),
                decoder = lambda obj,ctx: Reference(*obj))
-port = ExprAdapter(Sequence("port",
-               LazyBound("Node", lambda : term),
-               UBInt32("ID"),
-               UBInt8("Creation"),
-               nested = False),
+port = ExprAdapter(Sequence("node" / term_,
+               "id" / Int32ub,
+               "creation" / Int8ub),
                encoder = lambda obj,ctx: (obj.node, obj.id, obj.creation),
                decoder = lambda obj,ctx: Port(*obj))
-pid = ExprAdapter(Sequence("pid",
-               LazyBound("Node", lambda : term),
-               UBInt32("ID"),
-               UBInt32("Serial"),
-               UBInt8("Creation"),
-               nested = False),
+pid = ExprAdapter(Sequence("node" / term_,
+               "id" / Int32ub,
+               "serial" / Int32ub,
+               "creation" / Int8ub),
                encoder = lambda obj,ctx: (obj.node, obj.id, obj.serial, 
obj.creation),
                decoder = lambda obj,ctx: Pid(*obj))
-small_tuple = TupleAdapter(PrefixedArray(LazyBound("small_tuple",lambda : 
term), length_field = UBInt8("arity")))
-large_tuple = TupleAdapter(PrefixedArray(LazyBound("large_tuple",lambda : 
term), length_field = UBInt32("arity")))
-nil = ExprAdapter(Sequence("nil"),
+small_tuple = TupleAdapter(PrefixedArray(Int8ub,  term_))
+large_tuple = TupleAdapter(PrefixedArray(Int32ub, term_))
+nil = ExprAdapter(Sequence(),
                encoder = lambda obj,ctx: (),
                decoder = lambda obj,ctx: [])
-string = ExprAdapter(PascalString("string", length_field = UBInt16("length"), 
encoding=None),
+string = ExprAdapter(PascalString(lengthfield = Int16ub, encoding=None),
                encoder = lambda obj,ctx: obj.value,
                decoder = lambda obj,ctx: etString(obj))
-list_ = ListAdapter(Sequence("list",
-               UBInt32("length"),
-               Array(lambda ctx: ctx.length, LazyBound("elements", lambda : 
term)),
-               LazyBound("tail", lambda : term),
-               nested = False,
-               ))
-binary = ExprAdapter(PascalString("binary", length_field = UBInt32("length")),
+list_ = ListAdapter(Sequence("len" / Int32ub,
+               Array(this.len, term_),
+               term_))
+binary = ExprAdapter(PascalString(lengthfield = Int32ub),
                encoder = lambda obj,ctx: obj.value,
                decoder = lambda obj,ctx: Binary(obj))
-small_big = BigInteger("small_big", length_field = UBInt8("length"))
-large_big = BigInteger("large_big", length_field = UBInt32("length"))
-new_reference = ExprAdapter(Sequence("new_reference",
-               UBInt16("Len"),
-               LazyBound("Node", lambda : term),
-               UBInt8("Creation"),
-               Array(lambda ctx: ctx.Len, UBInt32("ID")),
-               nested = False),
+small_big = BigInteger(Int8ub)
+large_big = BigInteger(Int32ub)
+new_reference = ExprAdapter(Sequence("len" / Int16ub,
+               "node" / term_,
+               "creation" / Int8ub,
+               "id" / Array(this.len, Int32ub)),
                encoder = lambda obj,ctx: (len(obj.id), obj.node, obj.creation, 
obj.id),
                decoder = lambda obj,ctx: Reference(obj[1], obj[3], obj[2]))
-small_atom = PascalString("small_atom", encoding="latin1")
-fun = ExprAdapter(Sequence("fun",
-               UBInt32("NumFree"),
-               LazyBound("Pid", lambda : term),
-               LazyBound("Module", lambda : term),
-               LazyBound("Index", lambda : term),
-               LazyBound("Uniq", lambda : term),
-               Array(lambda ctx: ctx.NumFree, LazyBound("FreeVars", lambda : 
term)),
-               nested = False),
+small_atom = PascalString(lengthfield = Int8ub, encoding="latin1")
+fun = ExprAdapter(Sequence("num_free" / Int32ub,
+               "pid" / term_,
+               "module" / term_,
+               "oldindex" / term_,
+               "olduniq" / term_,
+               "free" / Array(this.num_free, term_)),
                 encoder = lambda obj,ctx: (len(obj.free), obj.pid, obj.module, 
obj.oldindex, olj.olduniq, obj.free) ,
                 decoder = lambda obj,ctx: Fun(None, None, None, obj[2], 
obj[3], obj[4], obj[1], obj[5]))
 # new fun to be implemented later
 new_fun = fun
-export = ExprAdapter(Sequence("export",
-               LazyBound("Module", lambda : term),
-               LazyBound("Function", lambda : term),
-               LazyBound("Arity", lambda : term),
-               nested = False),
+export = ExprAdapter(Sequence("module" / LazyBound(lambda ctx: term),
+               "function" / LazyBound(lambda ctx: term),
+               "arity" / LazyBound(lambda ctx: term)),
                encoder = lambda obj,ctx: (obj.module, obj.function, obj.arity),
                decoder = lambda obj,ctx: MFA(*obj))
-bit_binary = ExprAdapter(Sequence("bit_binary",
-               UBInt32("Len"),
-               UBInt8("Bits"),
-               String("Data", lambda ctx: ctx.Len),
-               nested = False),
+bit_binary = ExprAdapter(Sequence("len" / Int32ub,
+               "bits" / Int8ub,
+               "data" / String(this.len)),
                encoder = lambda obj,ctx: (len(obj.value), obj.bits, obj.value),
                decoder = lambda obj,ctx: BitBinary(obj[2],obj[1]))
-new_float = BFloat64("new_float")
-atom_utf8 = PascalString("atom_utf8", length_field = UBInt16("length"), 
encoding="utf8")
-small_atom_utf8 = PascalString("small_atom_utf8", encoding="utf8")
-key_value = ExprAdapter(Sequence("key_value",
-       LazyBound("key", lambda : term),
-       LazyBound("value", lambda : term)),
+new_float = Float64b
+atom_utf8 = PascalString(lengthfield = Int16ub, encoding="utf8")
+small_atom_utf8 = PascalString(lengthfield = Int8ub, encoding="utf8")
+key_value = ExprAdapter(Sequence(term_,term_),
                encoder = lambda obj,ctx: obj,
-               decoder = lambda obj,ctx: tuple(obj)
-       )
-map = MapAdapter(PrefixedArray(key_value, length_field = UBInt32("arity")))
+               decoder = lambda obj,ctx: tuple(obj))
+map = MapAdapter(PrefixedArray(Int32ub, key_value))
 
-term = ExprAdapter(Sequence("term",
-       UBInt8("tag"),
-       Switch("payload", lambda ctx: ctx.tag,
-                {
-                       82: atom_cache_ref,
-                       97: small_integer,
-                       98: integer,
-                       99: float_,
-                       100: atom,
-                       101: reference,
-                       102: port,
-                       103: pid,
-                       104: small_tuple,
-                       105: large_tuple,
-                       106: nil,
-                       107: string,
-                       108: list_,
-                       109: binary,
-                       110: small_big,
-                       111: large_big,
-                       114: new_reference,
-                       115: small_atom,
-                       116: map,
-                       117: fun,
-                       112: new_fun,
-                       113: export,
-                       77: bit_binary,
-                       70: new_float,
-                       118: atom_utf8,
-                       119: small_atom_utf8,
-                },),
-       nested = False),
-               lambda obj, ctx: (tag(obj, ctx), obj),
-               lambda obj, ctx: obj[1]
+term = ExprAdapter(Sequence("tag" / Int8ub,
+       Switch(this.tag, {
+               82: atom_cache_ref,
+               97: small_integer,
+               98: integer,
+               99: float_,
+               100: atom,
+               101: reference,
+               102: port,
+               103: pid,
+               104: small_tuple,
+               105: large_tuple,
+               106: nil,
+               107: string,
+               108: list_,
+               109: binary,
+               110: small_big,
+               111: large_big,
+               114: new_reference,
+               115: small_atom,
+               116: map,
+               117: fun,
+               112: new_fun,
+               113: export,
+               77: bit_binary,
+               70: new_float,
+               118: atom_utf8,
+               119: small_atom_utf8,
+       })),
+       lambda obj,ctx: (tag(obj, ctx), obj),
+       lambda obj,ctx: obj[1]
        )
 
-erl_version_magic = Magic(b'\x83')
+erl_version_magic = Const(b'\x83')
 
-external_term = SeqOfOne("external_term",erl_version_magic,term)
+external_term = ExprAdapter(Sequence(erl_version_magic, term),
+       encoder = lambda obj,ctx: (None, obj),
+       decoder = lambda obj,ctx: obj[1])
 
 __all__ = ["term", "external_term"]
-
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pybeam-0.3.3/pybeam.egg-info/PKG-INFO 
new/pybeam-0.4/pybeam.egg-info/PKG-INFO
--- old/pybeam-0.3.3/pybeam.egg-info/PKG-INFO   2017-01-08 15:06:31.000000000 
+0100
+++ new/pybeam-0.4/pybeam.egg-info/PKG-INFO     2017-01-20 20:30:34.000000000 
+0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.0
 Name: pybeam
-Version: 0.3.3
+Version: 0.4
 Summary: Python module to parse Erlang BEAM files
 Home-page: http://github.com/matwey/pybeam
 Author: Matwey V. Kornilov
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pybeam-0.3.3/pybeam.egg-info/requires.txt 
new/pybeam-0.4/pybeam.egg-info/requires.txt
--- old/pybeam-0.3.3/pybeam.egg-info/requires.txt       2017-01-08 
15:06:31.000000000 +0100
+++ new/pybeam-0.4/pybeam.egg-info/requires.txt 2017-01-20 20:30:34.000000000 
+0100
@@ -1 +1 @@
-construct>=2.5,<2.8
+construct>=2.8
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pybeam-0.3.3/setup.py new/pybeam-0.4/setup.py
--- old/pybeam-0.3.3/setup.py   2017-01-08 15:05:36.000000000 +0100
+++ new/pybeam-0.4/setup.py     2017-01-20 20:23:41.000000000 +0100
@@ -1,7 +1,7 @@
 from setuptools import setup
 
 setup(name='pybeam',
-      version='0.3.3',
+      version='0.4',
       description='Python module to parse Erlang BEAM files',
       url='http://github.com/matwey/pybeam',
       author='Matwey V. Kornilov',
@@ -9,5 +9,5 @@
       license='MIT',
       packages=['pybeam'],
       test_suite = 'test',
-      install_requires=['construct>=2.5,<2.8'],
+      install_requires=['construct>=2.8'], 
       zip_safe=False)


Reply via email to