Check in pyasn1 version 0.1.2, including the modules from pyasn1's upstream (version 0.0.2)
This commit is contained in:
parent
75be8c90fd
commit
634d7bb9ee
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,4 @@
|
||||
pyasn1-0.0.9a.tar.gz
|
||||
/pyasn1-0.0.12a.tar.gz
|
||||
/pyasn1-0.1.2.tar.gz
|
||||
/pyasn1-modules-0.0.2.tar.gz
|
||||
|
109
pyasn1-any.patch
109
pyasn1-any.patch
@ -1,109 +0,0 @@
|
||||
diff -u --recursive pyasn1-0.0.12a/pyasn1/codec/ber/decoder.py pyasn1-0.0.12a.any/pyasn1/codec/ber/decoder.py
|
||||
--- pyasn1-0.0.12a/pyasn1/codec/ber/decoder.py 2010-11-19 12:43:25.000000000 -0500
|
||||
+++ pyasn1-0.0.12a.any/pyasn1/codec/ber/decoder.py 2010-12-22 15:22:03.000000000 -0500
|
||||
@@ -316,6 +316,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(),
|
||||
@@ -359,6 +382,7 @@
|
||||
# Decode tag & length
|
||||
while state != stStop:
|
||||
if state == stDecodeTag:
|
||||
+ substrate_full = substrate
|
||||
# Decode tag
|
||||
if not substrate:
|
||||
raise error.SubstrateUnderrunError(
|
||||
@@ -422,6 +446,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
|
||||
@@ -464,7 +489,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:
|
||||
diff -u --recursive pyasn1-0.0.12a/pyasn1/codec/ber/encoder.py pyasn1-0.0.12a.any/pyasn1/codec/ber/encoder.py
|
||||
--- pyasn1-0.0.12a/pyasn1/codec/ber/encoder.py 2010-11-19 12:43:25.000000000 -0500
|
||||
+++ pyasn1-0.0.12a.any/pyasn1/codec/ber/encoder.py 2010-12-22 15:22:03.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 -u --recursive pyasn1-0.0.12a/pyasn1/type/univ.py pyasn1-0.0.12a.any/pyasn1/type/univ.py
|
||||
--- pyasn1-0.0.12a/pyasn1/type/univ.py 2010-11-19 12:43:25.000000000 -0500
|
||||
+++ pyasn1-0.0.12a.any/pyasn1/type/univ.py 2010-12-22 15:22:03.000000000 -0500
|
||||
@@ -639,5 +639,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?
|
@ -1,38 +1,50 @@
|
||||
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
|
||||
|
||||
%define module pyasn1
|
||||
%global module pyasn1
|
||||
%global modules_version 0.0.2
|
||||
|
||||
Name: python-pyasn1
|
||||
Version: 0.0.12a
|
||||
Release: 2%{?dist}
|
||||
Version: 0.1.2
|
||||
Release: 1%{?dist}
|
||||
Summary: ASN.1 tools for Python
|
||||
License: BSD
|
||||
Group: System Environment/Libraries
|
||||
Source0: http://downloads.sourceforge.net/pyasn1/pyasn1-%{version}.tar.gz
|
||||
Source1: http://downloads.sourceforge.net/pyasn1/pyasn1-modules-%{modules_version}.tar.gz
|
||||
URL: http://pyasn1.sourceforge.net/
|
||||
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)
|
||||
and codecs (transfer syntaxes) for Python programming environment. ASN.1
|
||||
compiler is planned for implementation in the future.
|
||||
|
||||
%package modules
|
||||
Summary: Modules for pyasn1
|
||||
|
||||
|
||||
%description modules
|
||||
ASN.1 types modules.
|
||||
|
||||
%prep
|
||||
%setup -n %{module}-%{version} -q
|
||||
%patch1 -p1
|
||||
%setup -n %{module}-%{version} -q -b1
|
||||
|
||||
|
||||
%build
|
||||
%{__python} setup.py build
|
||||
pushd ../pyasn1-modules-%{modules_version}
|
||||
%{__python} setup.py build
|
||||
popd
|
||||
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT
|
||||
pushd ../pyasn1-modules-%{modules_version}
|
||||
%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT
|
||||
popd
|
||||
|
||||
|
||||
%clean
|
||||
@ -41,11 +53,20 @@ rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%doc README LICENSE doc/notes.html examples/*
|
||||
%{python_sitelib}/*
|
||||
%doc README LICENSE doc/*.html
|
||||
%{python_sitelib}/%{module}
|
||||
%{python_sitelib}/%{module}-%{version}-*.egg-info/
|
||||
|
||||
%files modules
|
||||
%defattr(-,root,root,-)
|
||||
%{python_sitelib}/%{module}_modules/
|
||||
%{python_sitelib}/%{module}_modules-%{modules_version}-*.egg-info/
|
||||
|
||||
|
||||
%changelog
|
||||
* Mon Jan 02 2012 Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> - 0.1.2-1
|
||||
- New upstream version
|
||||
|
||||
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.0.12a-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user