summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--VERSION2
-rw-r--r--doc/install.rst12
-rw-r--r--doc/news.rst8
-rw-r--r--doc/thanks.rst2
-rwxr-xr-xpyderasn.py17
5 files changed, 27 insertions, 14 deletions
diff --git a/VERSION b/VERSION
index cc40bca..b8eb026 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-8.0
+8.1
diff --git a/doc/install.rst b/doc/install.rst
index 05a9147..7ec013b 100644
--- a/doc/install.rst
+++ b/doc/install.rst
@@ -4,11 +4,11 @@ Install
Preferable way is to :ref:`download <download>` tarball with the
signature from `official website <http://pyderasn.cypherpunks.ru/>`__::
- $ [fetch|wget] http://pyderasn.cypherpunks.ru/pyderasn-8.0.tar.xz
- $ [fetch|wget] http://pyderasn.cypherpunks.ru/pyderasn-8.0.tar.xz.sig
- $ gpg --verify pyderasn-8.0.tar.xz.sig pyderasn-8.0.tar.xz
- $ xz --decompress --stdout pyderasn-8.0.tar.xz | tar xf -
- $ cd pyderasn-8.0
+ $ [fetch|wget] http://pyderasn.cypherpunks.ru/pyderasn-8.1.tar.xz
+ $ [fetch|wget] http://pyderasn.cypherpunks.ru/pyderasn-8.1.tar.xz.sig
+ $ gpg --verify pyderasn-8.1.tar.xz.sig pyderasn-8.1.tar.xz
+ $ xz --decompress --stdout pyderasn-8.1.tar.xz | tar xf -
+ $ cd pyderasn-8.1
$ python setup.py install
# or copy pyderasn.py (+six.py, possibly termcolor.py) to your PYTHONPATH
@@ -21,7 +21,7 @@ You can also find it mirrored on :ref:`download <download>` page.
You could use pip (**no** OpenPGP authentication is performed!) with PyPI::
$ cat > requirements.txt <<EOF
- pyderasn==8.0 --hash=sha256:TO-BE-FILLED
+ pyderasn==8.1 --hash=sha256:TO-BE-FILLED
six==1.14.0 --hash=sha256:236bdbdce46e6e6a3d61a337c0f8b763ca1e8717c03b369e87a7ec7ce1319c0a
EOF
$ pip install --requirement requirements.txt
diff --git a/doc/news.rst b/doc/news.rst
index d93a1f7..dd587b7 100644
--- a/doc/news.rst
+++ b/doc/news.rst
@@ -1,6 +1,14 @@
News
====
+.. _release8.1:
+
+8.1
+---
+* Workability under Microsoft Windows OS should be restored: it has
+ different ``mmap`` constants and implementation, preventing
+ ``pyderasn`` importing
+
.. _release8.0:
8.0
diff --git a/doc/thanks.rst b/doc/thanks.rst
index 57e9d4d..fa14156 100644
--- a/doc/thanks.rst
+++ b/doc/thanks.rst
@@ -7,3 +7,5 @@ Thanks
:py:class:`pyderasn.AutoAddSlots` metaclass
* `Tim Perevezentsev <riffm2005@gmail.com>`_ for huge quantity of
improvement ideas
+* `Evgeny Drobotun <drobotun@xakep.ru>`_ for testing under Windows
+ and bugreporting
diff --git a/pyderasn.py b/pyderasn.py
index 516715a..4b690f7 100755
--- a/pyderasn.py
+++ b/pyderasn.py
@@ -1170,8 +1170,6 @@ from datetime import datetime
from datetime import timedelta
from io import BytesIO
from math import ceil
-from mmap import mmap
-from mmap import PROT_READ
from operator import attrgetter
from string import ascii_letters
from string import digits
@@ -1201,7 +1199,7 @@ except ImportError: # pragma: no cover
def colored(what, *args, **kwargs):
return what
-__version__ = "8.0"
+__version__ = "8.1"
__all__ = (
"agg_octet_string",
@@ -1292,8 +1290,13 @@ def file_mmaped(fd):
:param fd: file object
:returns: memoryview over read-only mmap-ing of the whole file
+
+ .. warning::
+
+ It is known to work under neither Python 2.x nor Windows.
"""
- return memoryview(mmap(fd.fileno(), 0, prot=PROT_READ))
+ import mmap
+ return memoryview(mmap.mmap(fd.fileno(), length=0, prot=mmap.PROT_READ))
def pureint(value):
@@ -7897,12 +7900,12 @@ def main(): # pragma: no cover
help="Path to BER/CER/DER file you want to decode",
)
args = parser.parse_args()
- if PY2:
+ try:
+ raw = file_mmaped(args.RAWFile)[args.skip:]
+ except:
args.RAWFile.seek(args.skip)
raw = memoryview(args.RAWFile.read())
args.RAWFile.close()
- else:
- raw = file_mmaped(args.RAWFile)[args.skip:]
oid_maps = (
[obj_by_path(_path) for _path in (args.oids or "").split(",")]
if args.oids else ()