rpms/python-pyasn1/devel pyasn1-any.patch, NONE, 1.1 .cvsignore, 1.3, 1.4 python-pyasn1.spec, 1.6, 1.7 sources, 1.3, 1.4
rcritten
rcritten at fedoraproject.org
Tue Nov 17 15:47:26 UTC 2009
Author: rcritten
Update of /cvs/extras/rpms/python-pyasn1/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv28834
Modified Files:
.cvsignore python-pyasn1.spec sources
Added Files:
pyasn1-any.patch
Log Message:
- Update to upstream version 0.0.9a
- Include patch that adds parsing for the Any type
pyasn1-any.patch:
codec/ber/.decoder.py.swp |binary
codec/ber/decoder.py | 32 +++++++++++++++++++++++++++++++-
codec/ber/encoder.py | 15 ++++++++++++++-
type/univ.py | 5 +++++
4 files changed, 50 insertions(+), 2 deletions(-)
--- NEW FILE pyasn1-any.patch ---
diff -uN --recursive pyasn1-0.0.9a/pyasn1/v1/codec/ber/decoder.py pyasn1-0.0.9a.any/pyasn1/v1/codec/ber/decoder.py
--- pyasn1-0.0.9a/pyasn1/v1/codec/ber/decoder.py 2008-11-23 06:45:14.000000000 -0500
+++ pyasn1-0.0.9a.any/pyasn1/v1/codec/ber/decoder.py 2009-11-16 15:36:38.000000000 -0500
@@ -312,6 +312,29 @@
class UTCTimeDecoder(OctetStringDecoder):
protoComponent = useful.UTCTime()
+class AnyDecoder(ChoiceDecoder):
+ protoComponent = univ.Any
+ def __init__(self, header):
+ self.__header = header
+ def _createComponent(self, tagSet, asn1Spec):
+ if asn1Spec is None:
+ return self.protoComponent(tagSet=tagSet)
+ else:
+ return asn1Spec.clone()
+ def valueDecoder(self, substrate, asn1Spec, tagSet,
+ length, state, decodeFun):
+ if not decodeFun:
+ return r, substrate
+ component, new_substrate = decodeFun(
+ substrate, None, tagSet, length, state
+ )
+ assert substrate.endswith(new_substrate)
+ if new_substrate:
+ substrate = substrate[:-len(new_substrate)]
+ return univ.Any(self.__header+substrate), new_substrate
+
+ indefLenValueDecoder = valueDecoder
+
codecMap = {
eoo.endOfOctets.tagSet: EndOfOctetsDecoder(),
univ.Integer.tagSet: IntegerDecoder(),
@@ -352,6 +375,7 @@
# Decode tag & length
while state != stStop:
if state == stDecodeTag:
+ substrate_full = substrate
# Decode tag
if not substrate:
raise error.SubstrateUnderrunError(
@@ -415,6 +439,7 @@
raise error.SubstrateUnderrunError(
'%d-octet short' % (length - len(substrate))
)
+ substrate_header = substrate_full[:-len(substrate) or None]
if state == stGetValueDecoder:
if asn1Spec is None:
state = stGetValueDecoderByTag
@@ -457,7 +482,12 @@
__chosenSpec = asn1Spec
else:
__chosenSpec = None
- if __chosenSpec is None or not\
+ if __chosenSpec is None and isinstance(asn1Spec, dict) and \
+ isinstance(asn1Spec.get(univ.Any.tagSet), univ.Any):
+ concreteDecoder = AnyDecoder(substrate_header)
+ asn1Spec = None
+ state = stDecodeValue
+ elif __chosenSpec is None or not\
__chosenSpec.getTypeMap().has_key(tagSet):
state = stTryAsExplicitTag
else:
Binary files pyasn1-0.0.9a/pyasn1/v1/codec/ber/.decoder.py.swp and pyasn1-0.0.9a.any/pyasn1/v1/codec/ber/.decoder.py.swp differ
diff -uN --recursive pyasn1-0.0.9a/pyasn1/v1/codec/ber/encoder.py pyasn1-0.0.9a.any/pyasn1/v1/codec/ber/encoder.py
--- pyasn1-0.0.9a/pyasn1/v1/codec/ber/encoder.py 2008-05-17 05:59:56.000000000 -0400
+++ pyasn1-0.0.9a.any/pyasn1/v1/codec/ber/encoder.py 2009-11-16 15:36:38.000000000 -0500
@@ -194,6 +194,16 @@
) + substrate
return substrate, 1
+class AnyEncoder(AbstractItemEncoder):
+ def _encodeTag(self, t, isConstructed):
+ if isConstructed:
+ return chr(t[0]|t[1]|t[2]|tag.tagFormatConstructed)
+ else:
+ return chr(t[0]|t[1]|t[2])
+ def _encodeValue(self, encodeFun, value, defMode, maxChunkSize):
+ assert len(value._value) <= maxChunkSize
+ return str(value._value), 0
+
codecMap = {
eoo.endOfOctets.tagSet: EndOfOctetsEncoder(),
univ.Boolean.tagSet: IntegerEncoder(),
@@ -234,7 +244,10 @@
if len(tagSet) > 1:
concreteEncoder = explicitlyTaggedItemEncoder
else:
- concreteEncoder = self.__codecMap.get(tagSet)
+ if isinstance(value, univ.Any):
+ concreteEncoder = AnyEncoder()
+ else:
+ concreteEncoder = self.__codecMap.get(tagSet)
if not concreteEncoder:
# XXX
baseTagSet = tagSet.getBaseTag()
diff -uN --recursive pyasn1-0.0.9a/pyasn1/v1/type/univ.py pyasn1-0.0.9a.any/pyasn1/v1/type/univ.py
--- pyasn1-0.0.9a/pyasn1/v1/type/univ.py 2008-11-23 06:45:35.000000000 -0500
+++ pyasn1-0.0.9a.any/pyasn1/v1/type/univ.py 2009-11-16 15:36:38.000000000 -0500
@@ -629,5 +629,10 @@
def setDefaultComponents(self): pass
+class Any(base.AbstractSimpleAsn1Item):
+ tagSet = tag.TagSet() # untagged, XXX as in Choice
+ defaultValue = ''
+ def prettyOut(self, value): return repr(value)
+
# XXX
# coercion rules?
Index: .cvsignore
===================================================================
RCS file: /cvs/extras/rpms/python-pyasn1/devel/.cvsignore,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -p -r1.3 -r1.4
--- .cvsignore 9 Sep 2008 19:18:59 -0000 1.3
+++ .cvsignore 17 Nov 2009 15:47:26 -0000 1.4
@@ -1 +1 @@
-pyasn1-0.0.8a.tar.gz
+pyasn1-0.0.9a.tar.gz
Index: python-pyasn1.spec
===================================================================
RCS file: /cvs/extras/rpms/python-pyasn1/devel/python-pyasn1.spec,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -p -r1.6 -r1.7
--- python-pyasn1.spec 2 Sep 2009 19:13:45 -0000 1.6
+++ python-pyasn1.spec 17 Nov 2009 15:47:26 -0000 1.7
@@ -3,8 +3,8 @@
%define module pyasn1
Name: python-pyasn1
-Version: 0.0.8a
-Release: 5%{?dist}
+Version: 0.0.9a
+Release: 1%{?dist}
Summary: ASN.1 tools for Python
License: BSD
Group: System Environment/Libraries
@@ -13,6 +13,7 @@ URL: http://pyasn1.sourceforg
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: python-devel python-setuptools
+Patch1: pyasn1-any.patch
%description
This project is dedicated to implementation of ASN.1 types (concrete syntax)
@@ -22,6 +23,7 @@ compiler is planned for implementation i
%prep
%setup -n %{module}-%{version} -q
+%patch1 -p1
%build
@@ -44,6 +46,10 @@ rm -rf $RPM_BUILD_ROOT
%changelog
+* Mon Nov 16 2009 Rob Crittenden <rcritten at redhat.com> - 0.0.9a-1
+- Update to upstream version 0.0.9a
+- Include patch that adds parsing for the Any type
+
* Wed Sep 2 2009 Rob Crittenden <rcritten at redhat.com> - 0.0.8a-5
- Include doc/notes.html in the package
Index: sources
===================================================================
RCS file: /cvs/extras/rpms/python-pyasn1/devel/sources,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -p -r1.3 -r1.4
--- sources 9 Sep 2008 19:19:00 -0000 1.3
+++ sources 17 Nov 2009 15:47:26 -0000 1.4
@@ -1 +1 @@
-1befe83fd3d8dd8bb0d0fbe58a5788a5 pyasn1-0.0.8a.tar.gz
+a6b26c57bae5484381cd558c15277c03 pyasn1-0.0.9a.tar.gz
More information about the fedora-extras-commits
mailing list