Skip to content

Commit

Permalink
Update python-bloscpack to version 0.16.0 / rev 8 via SR 1033055
Browse files Browse the repository at this point in the history
https://build.opensuse.org/request/show/1033055
by user dgarcia + dimstar_suse
- Add drop-python2-support.patch to remove python-six
  gh#Blosc/bloscpack#118
- Remove python_module definition
  • Loading branch information
dgarcia authored and bmwiedemann committed Nov 4, 2022
1 parent 9546b26 commit ec4c7fa
Show file tree
Hide file tree
Showing 5 changed files with 233 additions and 5 deletions.
Binary file modified packages/p/python-bloscpack/.files
Binary file not shown.
11 changes: 11 additions & 0 deletions packages/p/python-bloscpack/.rev
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,15 @@
<comment></comment>
<requestid>946886</requestid>
</revision>
<revision rev="8" vrev="7">
<srcmd5>414007d86f5d26983958a47bb9829a0d</srcmd5>
<version>0.16.0</version>
<time>1667499292</time>
<user>dimstar_suse</user>
<comment>- Add drop-python2-support.patch to remove python-six
gh#Blosc/bloscpack#118
- Remove python_module definition
</comment>
<requestid>1033055</requestid>
</revision>
</revisionlist>
212 changes: 212 additions & 0 deletions packages/p/python-bloscpack/drop-python2-support.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
Index: bloscpack-0.16.0/bloscpack/args.py
===================================================================
--- bloscpack-0.16.0.orig/bloscpack/args.py
+++ bloscpack-0.16.0/bloscpack/args.py
@@ -3,7 +3,6 @@


import blosc
-from six import integer_types, string_types


from .abstract_objects import (MutableMappingObject,
@@ -181,7 +180,7 @@ def calculate_nchunks(in_file_size, chun
return (1, 0, 0)
log.verbose("Input was length zero, ignoring 'chunk_size'")
# convert a human readable description to an int
- if isinstance(chunk_size, string_types):
+ if isinstance(chunk_size, str):
chunk_size = reverse_pretty(chunk_size)
check_range('chunk_size', chunk_size, 1, blosc.BLOSC_MAX_BUFFERSIZE)
# downcast
@@ -264,7 +263,7 @@ def _handle_max_apps(offsets, nchunks, m
# it's a callable all right
log.debug("max_app_chunks is a callable")
max_app_chunks = max_app_chunks(nchunks)
- if not isinstance(max_app_chunks, integer_types):
+ if not isinstance(max_app_chunks, int):
raise ValueError(
"max_app_chunks callable returned a non integer "
"of type '%s'" % type(max_app_chunks))
@@ -272,7 +271,7 @@ def _handle_max_apps(offsets, nchunks, m
if max_app_chunks < 0:
raise ValueError(
'max_app_chunks callable returned a negative integer')
- elif isinstance(max_app_chunks, integer_types):
+ elif isinstance(max_app_chunks, int):
# it's a plain int, check its range
log.debug("max_app_chunks is an int")
check_range('max_app_chunks', max_app_chunks, 0, MAX_CHUNKS)
@@ -425,7 +424,7 @@ class MetadataArgs(MutableMappingObject)
def effective_max_meta_size(self, meta_size):
if hasattr(self.max_meta_size, '__call__'):
max_meta_size = self.max_meta_size(meta_size)
- elif isinstance(self.max_meta_size, integer_types):
+ elif isinstance(self.max_meta_size, int):
max_meta_size = self.max_meta_size
log.debug('max meta size is deemed to be: %d' % max_meta_size)
return max_meta_size
Index: bloscpack-0.16.0/bloscpack/file_io.py
===================================================================
--- bloscpack-0.16.0.orig/bloscpack/file_io.py
+++ bloscpack-0.16.0/bloscpack/file_io.py
@@ -8,8 +8,6 @@ import itertools
import os.path as path

import blosc
-import six
-from six.moves import xrange
from deprecated import deprecated


@@ -86,7 +84,7 @@ def _write_metadata(output_fp, metadata,
serializer_impl = SERIALIZERS_LOOKUP[metadata_args.magic_format]
metadata = serializer_impl.dumps(metadata)
meta_size = len(metadata)
- if six.PY3 and isinstance(metadata, str):
+ if isinstance(metadata, str):
metadata = metadata.encode()
if metadata_args.should_compress:
codec_impl = metadata_args.meta_codec_impl
@@ -128,7 +126,7 @@ def _write_metadata(output_fp, metadata,
output_fp.write(raw_metadata_header)
output_fp.write(metadata)
prealloc = max_meta_size - meta_comp_size
- for i in xrange(prealloc):
+ for i in range(prealloc):
output_fp.write(b'\x00')
metadata_total += prealloc
log.debug("metadata has %d preallocated empty bytes" % prealloc)
@@ -227,7 +225,7 @@ def _read_metadata(input_fp):
('compressed' if metadata_header.meta_codec != 'None' else
'uncompressed', metadata_header.meta_comp_size))
serializer_impl = SERIALIZERS_LOOKUP[metadata_header.magic_format]
- if six.PY3 and isinstance(metadata, bytes):
+ if isinstance(metadata, bytes):
metadata = metadata.decode()
metadata = serializer_impl.loads(metadata)
return metadata, metadata_header
@@ -257,7 +255,7 @@ def _read_offsets(input_fp, bloscpack_he
offsets_raw = input_fp.read(8 * total_entries)
log.debug('Read raw offsets: %s' % repr(offsets_raw))
offsets = [decode_int64(offsets_raw[j - 8:j]) for j in
- xrange(8, bloscpack_header.nchunks * 8 + 1, 8)]
+ range(8, bloscpack_header.nchunks * 8 + 1, 8)]
log.debug('Offsets: %s' % offsets)
return offsets
else:
@@ -363,7 +361,7 @@ class CompressedFPSource(CompressedSourc
self.nchunks = self.bloscpack_header.nchunks

def __iter__(self):
- for i in xrange(self.nchunks):
+ for i in range(self.nchunks):
compressed, header, digest = _read_compressed_chunk_fp(self.input_fp, self.checksum_impl)
compressed(digest)

Index: bloscpack-0.16.0/bloscpack/headers.py
===================================================================
--- bloscpack-0.16.0.orig/bloscpack/headers.py
+++ bloscpack-0.16.0/bloscpack/headers.py
@@ -11,7 +11,6 @@ except ImportError:


import blosc
-from six import PY3, integer_types, binary_type

from .abstract_objects import (MutableMappingObject,
)
@@ -40,7 +39,7 @@ from . import log

def check_range(name, value, min_, max_):
""" Check that a variable is in range. """
- if not isinstance(value, integer_types):
+ if not isinstance(value, int):
raise TypeError("'%s' must be of type 'int'" % name)
elif not min_ <= value <= max_:
raise ValueError(
@@ -49,7 +48,7 @@ def check_range(name, value, min_, max_)


def _check_str(name, value, max_len):
- if not isinstance(value, binary_type):
+ if not isinstance(value, bytes):
raise TypeError("'%s' must be of type 'str'/'bytes'" % name)
elif len(value) > max_len:
raise ValueError("'%s' can be of max length '%i' but is: '%s'" %
@@ -103,10 +102,7 @@ def check_options_zero(options, indices)


def decode_uint8(byte):
- if PY3:
- return byte
- else:
- return struct.unpack('<B', byte)[0]
+ return byte


def decode_uint32(fourbyte):
@@ -126,10 +122,7 @@ def decode_bitfield(byte):


def decode_magic_string(str_):
- if PY3:
- return str_.strip(b'\x00')
- else:
- return str_.strip('\x00')
+ return str_.strip(b'\x00')


def encode_uint8(byte):
Index: bloscpack-0.16.0/bloscpack/memory_io.py
===================================================================
--- bloscpack-0.16.0.orig/bloscpack/memory_io.py
+++ bloscpack-0.16.0/bloscpack/memory_io.py
@@ -2,7 +2,6 @@
# vim :set ft=py:

import blosc
-from six.moves import xrange

from .abstract_io import (PlainSource,
CompressedSource,
@@ -38,7 +37,7 @@ class CompressedMemorySource(CompressedS
self.checksums = compressed_memory_sink.checksums

def __iter__(self):
- for i in xrange(self.nchunks):
+ for i in range(self.nchunks):
compressed = self.chunks[i]
digest = self.checksums[i] if self.checksum else None
compressed(digest)
Index: bloscpack-0.16.0/bloscpack/numpy_io.py
===================================================================
--- bloscpack-0.16.0.orig/bloscpack/numpy_io.py
+++ bloscpack-0.16.0/bloscpack/numpy_io.py
@@ -6,8 +6,6 @@ import ast

import blosc
import numpy
-import six
-from six.moves import xrange
from deprecated import deprecated


@@ -88,7 +86,7 @@ class PlainNumpySource(PlainSource):
)
self.nitems = int(self.chunk_size / self.ndarray.itemsize)
offset = self.ptr
- for i in xrange(self.nchunks - 1):
+ for i in range(self.nchunks - 1):
offset(self.nitems)
offset += self.chunk_size
offset(int(self.last_chunk / self.ndarray.itemsize))
@@ -111,8 +109,6 @@ def _conv(descr):
descr = [_conv(d) for d in descr]
else:
descr = tuple([_conv(d) for d in descr])
- elif six.PY2 and isinstance(descr, unicode): # pragma: no cover
- descr = str(descr)
return descr


7 changes: 7 additions & 0 deletions packages/p/python-bloscpack/python-bloscpack.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Nov 3 11:41:40 UTC 2022 - Daniel Garcia <[email protected]>

- Add drop-python2-support.patch to remove python-six
gh#Blosc/bloscpack#118
- Remove python_module definition

-------------------------------------------------------------------
Sun Jan 16 16:12:38 UTC 2022 - Benjamin Greiner <[email protected]>

Expand Down
8 changes: 3 additions & 5 deletions packages/p/python-bloscpack/python-bloscpack.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# spec file for package python-bloscpack
#
# Copyright (c) 2021 SUSE LLC
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
Expand All @@ -16,8 +16,6 @@
#


%{?!python_module:%define python_module() python3-%{**}}
%define skip_python2 1
Name: python-bloscpack
Version: 0.16.0
Release: 0
Expand All @@ -28,12 +26,13 @@ Source: https://files.pythonhosted.org/packages/source/b/bloscpack/blosc
# PATCH-FEATURE-UPSTREAM remove_nose.patch gh#Blosc/bloscpack#99 [email protected]
# Remove nose dependency
Patch0: remove_nose.patch
# PATCH-FIX-UPSTREAM drop-python2-support.patch gh#Blosc/bloscpack#118
Patch1: drop-python2-support.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-blosc
Requires: python-numpy
Requires: python-six
Requires(post): update-alternatives
Requires(postun):update-alternatives
Recommends: cryptography >= 1.3.4
Expand All @@ -46,7 +45,6 @@ BuildRequires: %{python_module cryptography >= 1.3.4}
BuildRequires: %{python_module numpy}
BuildRequires: %{python_module pyOpenSSL >= 0.14}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module six}
# /SECTION
%python_subpackages

Expand Down

0 comments on commit ec4c7fa

Please sign in to comment.