Accepting request 480703 from devel:languages:python:singlespec
singlespec + version update OBS-URL: https://build.opensuse.org/request/show/480703 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cffi?expand=0&rev=31
This commit is contained in:
parent
68f8dd10a1
commit
3fb594641e
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a7f75c4ef2362c0a0e54657add0a6c509fecbfa3b3807bc0925f5cb1c9f927db
|
||||
size 397024
|
3
cffi-1.9.1.tar.gz
Normal file
3
cffi-1.9.1.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:563e0bd53fda03c151573217b3a49b3abad8813de9dd0632e10090f6190fdaf8
|
||||
size 407108
|
@ -1,39 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User Armin Rigo <arigo@tunes.org>
|
||||
# Date 1464590378 -7200
|
||||
# Node ID bc14c64da0f41ba70f6fab821540b376f78e0a85
|
||||
# Parent f6d4b0a1e70b885352de186fcaeedf41365793c6
|
||||
Issue #260: don't use "x << 0" but "x | 0" to check that x is an
|
||||
integer. It seems that "x << 0" is undefined, according to the C
|
||||
standard, if x is any negative value...
|
||||
|
||||
diff --git a/cffi/recompiler.py b/cffi/recompiler.py
|
||||
--- a/cffi/recompiler.py
|
||||
+++ b/cffi/recompiler.py
|
||||
@@ -814,7 +814,7 @@
|
||||
try:
|
||||
if ftype.is_integer_type() or fbitsize >= 0:
|
||||
# accept all integers, but complain on float or double
|
||||
- prnt(" (void)((p->%s) << 1); /* check that '%s.%s' is "
|
||||
+ prnt(" (void)((p->%s) | 0); /* check that '%s.%s' is "
|
||||
"an integer */" % (fname, cname, fname))
|
||||
continue
|
||||
# only accept exactly the type declared, except that '[]'
|
||||
@@ -991,7 +991,7 @@
|
||||
prnt('static int %s(unsigned long long *o)' % funcname)
|
||||
prnt('{')
|
||||
prnt(' int n = (%s) <= 0;' % (name,))
|
||||
- prnt(' *o = (unsigned long long)((%s) << 0);'
|
||||
+ prnt(' *o = (unsigned long long)((%s) | 0);'
|
||||
' /* check that %s is an integer */' % (name, name))
|
||||
if check_value is not None:
|
||||
if check_value > 0:
|
||||
@@ -1250,7 +1250,7 @@
|
||||
|
||||
def _emit_bytecode_UnknownIntegerType(self, tp, index):
|
||||
s = ('_cffi_prim_int(sizeof(%s), (\n'
|
||||
- ' ((%s)-1) << 0 /* check that %s is an integer type */\n'
|
||||
+ ' ((%s)-1) | 0 /* check that %s is an integer type */\n'
|
||||
' ) <= 0)' % (tp.name, tp.name, tp.name))
|
||||
self.cffi_types[index] = CffiOp(OP_PRIMITIVE, s)
|
||||
|
@ -1,3 +1,82 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Mar 16 17:33:16 UTC 2017 - jmatejek@suse.com
|
||||
|
||||
- update to 1.9.1
|
||||
- Structs with variable-sized arrays as their last field: now we track the
|
||||
length of the array after ffi.new() is called, just like we always tracked
|
||||
the length of ffi.new("int[]", 42). This lets us detect out-of-range
|
||||
accesses to array items. This also lets us display a better repr(), and
|
||||
have the total size returned by ffi.sizeof() and ffi.buffer(). Previously
|
||||
both functions would return a result based on the size of the declared
|
||||
structure type, with an assumed empty array. (Thanks andrew for starting
|
||||
this refactoring.)
|
||||
- Add support in cdef()/set_source() for unspecified-length arrays in
|
||||
typedefs: typedef int foo_t[...];. It was already supported for global
|
||||
variables or structure fields.
|
||||
- I turned in v1.8 a warning from cffi/model.py into an error: 'enum xxx' has
|
||||
no values explicitly defined: refusing to guess which integer type it is
|
||||
meant to be (unsigned/signed, int/long). Now I’m turning it back to a
|
||||
warning again; it seems that guessing that the enum has size int is a
|
||||
99%-safe bet. (But not 100%, so it stays as a warning.)
|
||||
- Fix leaks in the code handling FILE * arguments. In CPython 3 there is a
|
||||
remaining issue that is hard to fix: if you pass a Python file object to a
|
||||
FILE * argument, then os.dup() is used and the new file descriptor is only
|
||||
closed when the GC reclaims the Python file object—and not at the earlier
|
||||
time when you call close(), which only closes the original file descriptor.
|
||||
If this is an issue, you should avoid this automatic convertion of Python
|
||||
file objects: instead, explicitly manipulate file descriptors and call
|
||||
fdopen() from C (...via cffi).
|
||||
- When passing a void * argument to a function with a different pointer type,
|
||||
or vice-versa, the cast occurs automatically, like in C. The same occurs
|
||||
for initialization with ffi.new() and a few other places. However, I
|
||||
thought that char * had the same property—but I was mistaken. In C you get
|
||||
the usual warning if you try to give a char * to a char ** argument, for
|
||||
example. Sorry about the confusion. This has been fixed in CFFI by giving
|
||||
for now a warning, too. It will turn into an error in a future version.
|
||||
- Issue #283: fixed ffi.new() on structures/unions with nested anonymous
|
||||
structures/unions, when there is at least one union in the mix. When
|
||||
initialized with a list or a dict, it should now behave more closely like
|
||||
the { } syntax does in GCC.
|
||||
- CPython 3.x: experimental: the generated C extension modules now use the
|
||||
“limited API”, which means that, as a compiled .so/.dll, it should work
|
||||
directly on any version of CPython >= 3.2. The name produced by distutils
|
||||
is still version-specific. To get the version-independent name, you can
|
||||
rename it manually to NAME.abi3.so, or use the very recent setuptools 26.
|
||||
- Added ffi.compile(debug=...), similar to python setup.py build --debug but
|
||||
defaulting to True if we are running a debugging version of Python itself.
|
||||
- Removed the restriction that ffi.from_buffer() cannot be used on byte
|
||||
strings. Now you can get a char * out of a byte string, which is valid as
|
||||
long as the string object is kept alive. (But don’t use it to modify the
|
||||
string object! If you need this, use bytearray or other official
|
||||
techniques.)
|
||||
- PyPy 5.4 can now pass a byte string directly to a char * argument (in older
|
||||
versions, a copy would be made). This used to be a CPython-only
|
||||
optimization.
|
||||
- ffi.gc(p, None) removes the destructor on an object previously created by
|
||||
another call to ffi.gc()
|
||||
- bool(ffi.cast("primitive type", x)) now returns False if the value is zero
|
||||
(including -0.0), and True otherwise. Previously this would only return
|
||||
False for cdata objects of a pointer type when the pointer is NULL.
|
||||
- bytearrays: ffi.from_buffer(bytearray-object) is now supported. (The reason
|
||||
it was not supported was that it was hard to do in PyPy, but it works since
|
||||
PyPy 5.3.) To call a C function with a char * argument from a buffer
|
||||
object—now including bytearrays—you write lib.foo(ffi.from_buffer(x)).
|
||||
Additionally, this is now supported: p[0:length] = bytearray-object. The
|
||||
problem with this was that a iterating over bytearrays gives numbers
|
||||
instead of characters. (Now it is implemented with just a memcpy, of
|
||||
course, not actually iterating over the characters.)
|
||||
- C++: compiling the generated C code with C++ was supposed to work, but
|
||||
failed if you make use the bool type (because that is rendered as the C
|
||||
_Bool type, which doesn’t exist in C++).
|
||||
- help(lib) and help(lib.myfunc) now give useful information, as well as
|
||||
dir(p) where p is a struct or pointer-to-struct.
|
||||
- drop upstreamed python-cffi-avoid-bitshifting-negative-int.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Dec 6 14:39:52 UTC 2016 - jmatejek@suse.com
|
||||
|
||||
- update for multipython build
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sun May 29 05:23:27 UTC 2016 - badshah400@gmail.com
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package python-cffi
|
||||
#
|
||||
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -16,58 +16,52 @@
|
||||
#
|
||||
|
||||
|
||||
Name: python-cffi
|
||||
Version: 1.6.0
|
||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||
%define modname cffi
|
||||
Name: python-%{modname}
|
||||
Version: 1.9.1
|
||||
Release: 0
|
||||
Summary: Foreign Function Interface for Python calling C code
|
||||
License: MIT
|
||||
Group: Development/Languages/Python
|
||||
Url: http://cffi.readthedocs.org
|
||||
Source0: https://pypi.io/packages/source/c/cffi/cffi-%{version}.tar.gz
|
||||
Url: http://%{modname}.readthedocs.org
|
||||
Source0: https://files.pythonhosted.org/packages/source/c/%{modname}/%{modname}-%{version}.tar.gz
|
||||
Source1: python-cffi-rpmlintrc
|
||||
# PATCH-FIX-UPSTREAM python-cffi-avoid-bitshifting-negative-int.patch boo#981848 badshah400@gmail.com -- Use bitwise AND instead of bitshifts to test for integer types; patch submitted upstream
|
||||
Patch0: python-cffi-avoid-bitshifting-negative-int.patch
|
||||
BuildRequires: %{python_module devel}
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: python-devel
|
||||
BuildRequires: python-setuptools
|
||||
BuildRequires: python-rpm-macros
|
||||
# Documentation requirements:
|
||||
BuildRequires: python-Sphinx
|
||||
BuildRequires: python-pycparser
|
||||
BuildRequires: python-pytest
|
||||
BuildRequires: %{python_module pycparser}
|
||||
BuildRequires: %{python_module pytest}
|
||||
BuildRequires: python3-Sphinx
|
||||
Requires: python-pycparser
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
|
||||
%{!?python_sitearch: %global python_sitearch %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
|
||||
BuildRequires: libffi43-devel
|
||||
%else
|
||||
BuildRequires: pkgconfig(libffi)
|
||||
%endif
|
||||
|
||||
%python_subpackages
|
||||
|
||||
%description
|
||||
Foreign Function Interface for Python calling C code. The aim of this project
|
||||
is to provide a convenient and reliable way of calling C code from Python.
|
||||
|
||||
%prep
|
||||
%setup -q -n cffi-%{version}
|
||||
%patch0 -p1
|
||||
%setup -q -n %{modname}-%{version}
|
||||
|
||||
%build
|
||||
CFLAGS="%{optflags}" python setup.py build
|
||||
python setup.py build_sphinx && rm build/sphinx/html/.buildinfo
|
||||
export CFLAGS="%{optflags}"
|
||||
%python_build
|
||||
python3 setup.py build_sphinx && rm build/sphinx/html/.buildinfo
|
||||
|
||||
%install
|
||||
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
|
||||
%python_install
|
||||
|
||||
# tests fail on SLE11 i586, so skip them
|
||||
# TODO recheck with version > 1.1.0
|
||||
%if 0%{?suse_version} > 1110
|
||||
%check
|
||||
PYTHONPATH=%{buildroot}%{python_sitearch} py.test
|
||||
%endif
|
||||
%python_expand PYTHONPATH=%{buildroot}%{$python_sitearch} py.test-%$python_bin_suffix
|
||||
|
||||
%files
|
||||
%files %{python_files}
|
||||
%defattr(-,root,root,-)
|
||||
%doc LICENSE build/sphinx/html/
|
||||
%doc LICENSE build/sphinx/html
|
||||
%{python_sitearch}/*
|
||||
|
||||
%changelog
|
||||
|
Loading…
x
Reference in New Issue
Block a user