Hello community, here is the log from the commit of package python-pybeam for openSUSE:Factory checked in at 2014-02-23 07:16:19 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 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 2013-07-09 21:10:27.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python-pybeam.new/python-pybeam.changes 2014-02-23 07:16:20.000000000 +0100 @@ -1,0 +2,8 @@ +Thu Feb 20 16:40:23 UTC 2014 - [email protected] + +- Version 0.3: + - python 3.3 support + - minor fixes and add more unit-tests + - Code LitT FunT chunk now understood + +------------------------------------------------------------------- Old: ---- pybeam-0.2.tar.gz New: ---- pybeam-0.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pybeam.spec ++++++ --- /var/tmp/diff_new_pack.WE0Ded/_old 2014-02-23 07:16:21.000000000 +0100 +++ /var/tmp/diff_new_pack.WE0Ded/_new 2014-02-23 07:16:21.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-pybeam # -# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -13,19 +13,20 @@ # published by the Open Source Initiative. # Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Name: python-pybeam -Version: 0.2 +Version: 0.3 Release: 0 -License: MIT Summary: Python module to parse Erlang BEAM files -Url: http://github.com/matwey/pybeam +License: MIT Group: Development/Languages/Python +Url: http://github.com/matwey/pybeam Source: http://pypi.python.org/packages/source/p/pybeam/pybeam-%{version}.tar.gz +BuildRequires: python-construct BuildRequires: python-devel BuildRequires: python-setuptools -BuildRequires: python-construct Requires: python-construct BuildRoot: %{_tmppath}/%{name}-%{version}-build %if 0%{?suse_version} && 0%{?suse_version} <= 1110 ++++++ pybeam-0.2.tar.gz -> pybeam-0.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pybeam-0.2/PKG-INFO new/pybeam-0.3/PKG-INFO --- old/pybeam-0.2/PKG-INFO 2013-05-06 16:04:24.000000000 +0200 +++ new/pybeam-0.3/PKG-INFO 2014-02-20 17:34:34.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: pybeam -Version: 0.2 +Version: 0.3 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.2/pybeam/__init__.py new/pybeam-0.3/pybeam/__init__.py --- old/pybeam-0.2/pybeam/__init__.py 2013-04-29 19:26:42.000000000 +0200 +++ new/pybeam-0.3/pybeam/__init__.py 2014-02-20 17:30:18.000000000 +0100 @@ -20,7 +20,7 @@ # THE SOFTWARE. # -from beam_file import BeamFile +from pybeam.beam_file import BeamFile __all__ = ["BeamFile"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pybeam-0.2/pybeam/beam_construct.py new/pybeam-0.3/pybeam/beam_construct.py --- old/pybeam-0.2/pybeam/beam_construct.py 2013-05-01 19:01:30.000000000 +0200 +++ new/pybeam-0.3/pybeam/beam_construct.py 2014-02-20 17:30:18.000000000 +0100 @@ -1,5 +1,6 @@ # # Copyright (c) 2013 Matwey V. Kornilov <[email protected]> +# Copyright (c) 2013 Fredrik Ahlberg <[email protected]> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,11 +22,25 @@ # from construct import * -from eetf_construct import term +from pybeam.eetf_construct import term, external_term +import codecs -chunk_atom = Struct("chunk_atom", - UBInt32("len"), - Array(lambda ctx: ctx.len, PascalString("atom")) +erl_version_magic = Magic(b'\x83') + +chunk_atom = Rename("chunk_atom", PrefixedArray(PascalString("atom", encoding="latin1"), length_field = UBInt32("len"))) + +chunk_attr = Rename("chunk_attr", 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_expt = Struct("chunk_expt", @@ -48,6 +63,25 @@ ) ) +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 + ) + ) + ) + ) + ) + chunk_loct = Struct("chunk_loct", UBInt32("len"), Array(lambda ctx: ctx.len, Struct("entry", @@ -58,44 +92,45 @@ ) ) -chunk_attr = Struct("chunk_attr", - Const(UBInt8("131"),131), - term - ) - -chunk_cinf = Struct("chunk_cinf", - Const(UBInt8("131"),131), - term +chunk_strt = Struct("chunk_strt", + PascalString("string", length_field = UBInt32("len"), encoding="latin1") ) chunk = Struct("chunk", String("chunk_name",4), UBInt32("size"), - SeqOfOne("payload", - Switch("payload", lambda ctx: ctx.chunk_name, - { - "Atom" : chunk_atom, - "ExpT" : chunk_expt, - "ImpT" : chunk_impt, -# "Code" : chunk_code, -# "StrT" : chunk_strt, - "Attr" : chunk_attr, - "CInf" : chunk_cinf, - "LocT" : chunk_loct, -# "Trac" : chunk_trac, - }, - default = Bytes("skip", lambda ctx: ctx.size) + If(lambda ctx: ctx.size > 0, + SeqOfOne("payload", + Switch("payload", lambda ctx: ctx.chunk_name, + { +# "Abst" : chunk_abst, + b"Atom" : chunk_atom, + b"Attr" : chunk_attr, + b"CInf" : chunk_cinf, + b"Code" : chunk_code, + b"ExpT" : chunk_expt, +# "FunT" : chunk_funt, + b"ImpT" : chunk_impt, +# "Line" : chink_line, + b"LitT" : chunk_litt, + b"LocT" : chunk_loct, +# "StrT" : chunk_strt, +# "Trac" : chunk_trac, + }, + default = Bytes("skip", lambda ctx: ctx.size) + ), + Padding(lambda ctx: (4 - ctx.size % 4) % 4, pattern = "\00"), + nested = False, ), - Padding(lambda ctx: (4 - ctx.size % 4) % 4, pattern = "\00"), - nested = False, - ) + [] + ) ) beam = Struct("beam", - Const(String('for1',4),'FOR1'), + Const(String('for1',4),b'FOR1'), UBInt32("size"), - Const(String('beam',4),'BEAM'), - GreedyRange(chunk), + Const(String('beam',4),b'BEAM'), + OptionalGreedyRange(chunk), Terminator, ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pybeam-0.2/pybeam/beam_file.py new/pybeam-0.3/pybeam/beam_file.py --- old/pybeam-0.2/pybeam/beam_file.py 2013-05-06 16:04:04.000000000 +0200 +++ new/pybeam-0.3/pybeam/beam_file.py 2014-02-20 17:30:18.000000000 +0100 @@ -20,11 +20,11 @@ # THE SOFTWARE. # -from beam_construct import beam +from pybeam.beam_construct import beam class BeamFile(object): def __init__(self, filename): - self._tree = beam.parse(file(filename,"r").read()) + self._tree = beam.parse(open(filename,"rb").read()) def selectChunkByName(self, name): for c in self._tree.chunk: @@ -34,31 +34,45 @@ @property def atoms(self): - return self.selectChunkByName("Atom").payload.atom + return self.selectChunkByName(b"Atom").payload @property - def modulename(self): - return self.atoms[0] + def attributes(self): + attr = self.selectChunkByName(b"Attr") + # convert from proplist to dict + return dict(attr.payload) + + @property + def code(self): + code = self.selectChunkByName(b"Code").payload + return (code.set, code.opcode_max, code.labels, code.functions, code.code) + + @property + def compileinfo(self): + cinf = self.selectChunkByName(b"CInf") + return dict(cinf.payload) @property def exports(self): - expt = self.selectChunkByName("ExpT") + expt = self.selectChunkByName(b"ExpT") atoms = self.atoms return [(atoms[e.function-1], e.arity, e.label) for e in expt.payload.entry] @property + def literals(self): + return [e.term for e in self.selectChunkByName(b"LitT").payload.data.entry] + + @property def imports(self): - impt = self.selectChunkByName("ImpT") + impt = self.selectChunkByName(b"ImpT") atoms = self.atoms return [(atoms[e.module-1], atoms[e.function-1], e.arity) for e in impt.payload.entry] @property - def attributes(self): - attr = self.selectChunkByName("Attr") - # convert from proplist to dict - return dict(attr.payload.term) - + def modulename(self): + return self.atoms[0] + @property - def compileinfo(self): - cinf = self.selectChunkByName("CInf") - return dict(cinf.payload.term) + def strings(self): + strt = self.selectChunkByName(b"StrT") + return strt.payload diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pybeam-0.2/pybeam/eetf_construct.py new/pybeam-0.3/pybeam/eetf_construct.py --- old/pybeam-0.2/pybeam/eetf_construct.py 2013-05-04 22:10:46.000000000 +0200 +++ new/pybeam-0.3/pybeam/eetf_construct.py 2014-02-20 17:30:18.000000000 +0100 @@ -22,8 +22,12 @@ # External Term Format -from erlang_types import AtomCacheReference, Reference, Port, Pid, String as etString, Binary, Fun, MFA, BitBinary +from pybeam.erlang_types import AtomCacheReference, Reference, Port, Pid, String as etString, Binary, Fun, MFA, BitBinary from construct import * +import sys + +if sys.version > '3': + long = int class TupleAdapter(Adapter): def _decode(self, obj, ctx): @@ -87,10 +91,10 @@ decoder = lambda obj,ctx: AtomCacheReference(obj)) small_integer = UBInt8("small_integer") integer = SBInt32("integer") -float_ = ExprAdapter(String("float",31,padchar='\00'), +float_ = ExprAdapter(String("float",31,padchar='\00',encoding="latin1"), encoder = lambda obj,ctx: "%.20e " % obj, decoder = lambda obj,ctx: float(obj.strip())) -atom = PascalString("atom", length_field = UBInt16("length")) +atom = PascalString("atom", length_field = UBInt16("length"), encoding="latin1") reference = ExprAdapter(Sequence("reference", LazyBound("Node", lambda : term), UBInt32("ID"), @@ -118,7 +122,7 @@ nil = ExprAdapter(Sequence("nil"), encoder = lambda obj,ctx: (), decoder = lambda obj,ctx: []) -string = ExprAdapter(PascalString("string", length_field = UBInt16("length")), +string = ExprAdapter(PascalString("string", length_field = UBInt16("length"), encoding="utf8"), encoder = lambda obj,ctx: obj.value, decoder = lambda obj,ctx: etString(obj)) list_ = ExprAdapter(Sequence("list", @@ -142,7 +146,7 @@ nested = False), 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") +small_atom = PascalString("small_atom", encoding="latin1") fun = ExprAdapter(Sequence("fun", UBInt32("NumFree"), LazyBound("Pid", lambda : term), @@ -170,8 +174,8 @@ 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")) -small_atom_utf8 = PascalString("small_atom_utf8") +atom_utf8 = PascalString("atom_utf8", length_field = UBInt16("length"), encoding="utf8") +small_atom_utf8 = PascalString("small_atom_utf8", encoding="utf8") term = ExprAdapter(Sequence("term", UBInt8("tag"), @@ -208,6 +212,10 @@ lambda obj, ctx: obj[1] ) -__all__ = ["term"] +erl_version_magic = Magic(b'\x83') + +external_term = SeqOfOne("external_term",erl_version_magic,term) + +__all__ = ["term", "external_term"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pybeam-0.2/pybeam.egg-info/PKG-INFO new/pybeam-0.3/pybeam.egg-info/PKG-INFO --- old/pybeam-0.2/pybeam.egg-info/PKG-INFO 2013-05-06 16:04:24.000000000 +0200 +++ new/pybeam-0.3/pybeam.egg-info/PKG-INFO 2014-02-20 17:34:34.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: pybeam -Version: 0.2 +Version: 0.3 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.2/setup.py new/pybeam-0.3/setup.py --- old/pybeam-0.2/setup.py 2013-05-06 16:04:04.000000000 +0200 +++ new/pybeam-0.3/setup.py 2014-02-20 17:30:33.000000000 +0100 @@ -1,7 +1,7 @@ from setuptools import setup setup(name='pybeam', - version='0.2', + version='0.3', description='Python module to parse Erlang BEAM files', url='http://github.com/matwey/pybeam', author='Matwey V. Kornilov', -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
