Skip to content

Commit

Permalink
alvistack/1.16.0
Browse files Browse the repository at this point in the history
    git clean -xdf
    tar zcvf ../python-cffi_1.16.0.orig.tar.gz --exclude=.git .
    debuild -uc -us
    cp python-cffi.spec ../python-cffi_1.16.0-1.spec
    cp ../python*-cffi*1.16.0*.{gz,xz,spec,dsc} /osc/home\:alvistack/python-cffi-cffi-1.16.0/
    rm -rf ../python*-cffi*1.16.0*.* ../python*-cffi-backend*1.16.0*.*

See python-cffi#34

Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
  • Loading branch information
hswong3i committed Jun 13, 2024
1 parent ba44abd commit 25c5994
Show file tree
Hide file tree
Showing 16 changed files with 275 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ build/
__pycache__/
*.egg-info/
*.so
.pybuild
build
8 changes: 8 additions & 0 deletions debian/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*.pydist
*.substvars
*debhelper*
.debhelper
files
python3-cffi
python3-cffi-backend
tmp
5 changes: 5 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
python-cffi (100:1.16.0-1) UNRELEASED; urgency=medium

* https://github.com/python-cffi/cffi/releases/tag/v1.16.0

-- Wong Hoi Sing Edison <hswong3i@pantarei-design.com> Mon, 01 Jan 2024 20:00:32 +0800
47 changes: 47 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Source: python-cffi
Section: python
Priority: optional
Standards-Version: 4.5.0
Maintainer: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
Homepage: https://github.com/python-cffi/cffi/tags
Vcs-Browser: https://github.com/alvistack/python-cffi-cffi
Vcs-Git: https://github.com/alvistack/python-cffi-cffi.git
Build-Depends:
debhelper,
debhelper-compat (= 10),
dh-python,
fdupes,
cython3,
libffi-dev,
python3-dev,
python3-setuptools,

Package: python3-cffi
Architecture: amd64
Description: Foreign Function Interface for Python to call C code
Foreign Function Interface for Python, providing a convenient and
reliable way of calling existing C code from Python. The interface is
based on LuaJIT’s FFI.
Depends:
${misc:Depends},
${shlibs:Depends},
${python3:Depends},
python3,
python3-cffi-backend (<< ${source:Version}+c),
python3-cffi-backend (>= ${source:Version}),
python3-pycparser,

Package: python3-cffi-backend
Architecture: amd64
Description: Foreign Function Interface for Python to call C code - runtime
This package contains the runtime support for pre-built cffi modules.
Depends:
${misc:Depends},
${shlibs:Depends},
${python3:Depends},
Replaces:
python3-cffi (<< 1),
Breaks:
python3-cffi (<< 1),
Provides:
${cffi:Provides},
21 changes: 21 additions & 0 deletions debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/

Files: debian/*
Copyright: 2024 Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
License: Apache-2.0

License: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
.
http://www.apache.org/licenses/LICENSE-2.0
.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
.
The complete text of the Apache version 2.0 license
can be found in "/usr/share/common-licenses/Apache-2.0".
45 changes: 45 additions & 0 deletions debian/gen-backend-versions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/python3

import re


def target_version():
with open('src/cffi/recompiler.py', encoding='UTF-8') as f:
for line in f:
m = re.match(r'^VERSION_BASE = (0x[0-9A-F]+)$', line)
if m:
return int(m.group(1), 16)
raise Exception('Version not found')


def backend_supported_versions():
versions = {}
with open('src/c/cffi1_module.c', encoding='UTF-8') as f:
for line in f:
m = re.match(r'^#define CFFI_VERSION_(MIN|MAX) *(0x[0-9A-F]+)$',
line)
if m:
versions[m.group(1)] = int(m.group(2), 16)
if len(versions) == 2:
return versions['MIN'], versions['MAX']
raise Exception('Versions not found')


versions = backend_supported_versions()
target = target_version()
for pkg in ('python-cffi', 'python3-cffi'):
subst = {
'pkg': pkg,
'min': versions[0],
'max': versions[1],
'target': target,
}
with open('debian/{0}-backend.substvars'.format(pkg), 'a',
encoding='UTF-8') as f:
f.write('cffi:Provides={pkg}-backend-api-min (= {min}), '
'{pkg}-backend-api-max (= {max}), '
'{pkg}-backend-api-{target}\n'.format(**subst))
with open('debian/{0}.pydist'.format(pkg), 'w', encoding='UTF-8') as f:
f.write('cffi {pkg}-backend-api-min (<= {target}), '
'{pkg}-backend-api-max (>= {target})\n'
.format(**subst))
1 change: 1 addition & 0 deletions debian/python3-cffi-backend.install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
usr/lib/python*/*-packages/_cffi_backend.*.so
3 changes: 3 additions & 0 deletions debian/python3-cffi-backend.lintian-overrides
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
python3-cffi-backend: copyright-without-copyright-notice
python3-cffi-backend: initial-upload-closes-no-bugs
python3-cffi-backend: zero-byte-file-in-doc-directory
1 change: 1 addition & 0 deletions debian/python3-cffi.install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
usr/lib/python*/*-packages/cffi*
4 changes: 4 additions & 0 deletions debian/python3-cffi.lintian-overrides
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
python3-cffi: copyright-without-copyright-notice
python3-cffi: initial-upload-closes-no-bugs
python3-cffi: no-manual-page
python3-cffi: zero-byte-file-in-doc-directory
16 changes: 16 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/make -f

SHELL := /bin/bash

override_dh_auto_install:
debian/gen-backend-versions.py
dh_auto_install --destdir=debian/tmp
find debian/tmp/usr/lib/python*/*-packages -type f -name '*.pyc' -exec rm -rf {} \;
fdupes -qnrps debian/tmp/usr/lib/python*/*-packages

override_dh_auto_test:

override_dh_auto_clean:

%:
dh $@ --buildsystem=pybuild --with python3
1 change: 1 addition & 0 deletions debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (quilt)
6 changes: 6 additions & 0 deletions debian/source/lintian-overrides
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
python-cffi source: file-without-copyright-information
python-cffi source: no-debian-changes
python-cffi source: not-binnmuable-any-depends-any
python-cffi source: source-contains-prebuilt-windows-binary
python-cffi source: source-is-missing
python-cffi source: source-package-encodes-python-version
99 changes: 99 additions & 0 deletions python-cffi.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Copyright 2024 Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

%global debug_package %{nil}

%global source_date_epoch_from_changelog 0

Name: python-cffi
Epoch: 100
Version: 1.16.0
Release: 1%{?dist}
Summary: Foreign Function Interface for Python to call C code
License: MIT
URL: https://github.com/python-cffi/cffi/tags
Source0: %{name}_%{version}.orig.tar.gz
BuildRequires: fdupes
BuildRequires: libffi-devel
BuildRequires: python-rpm-macros
BuildRequires: python3-Cython3
BuildRequires: python3-devel
BuildRequires: python3-setuptools

%description
Foreign Function Interface for Python, providing a convenient and
reliable way of calling existing C code from Python. The interface is
based on LuaJIT’s FFI.

%prep
%autosetup -T -c -n %{name}_%{version}-%{release}
tar -zx -f %{S:0} --strip-components=1 -C .

%build
%py3_build

%install
%py3_install
find %{buildroot}%{python3_sitearch} -type f -name '*.pyc' -exec rm -rf {} \;
fdupes -qnrps %{buildroot}%{python3_sitearch}

%check

%if 0%{?suse_version} > 1500 || 0%{?rhel} == 7
%package -n python%{python3_version_nodots}-cffi
Summary: Foreign Function Interface for Python to call C code
Requires: python3
Requires: python3-pycparser
Provides: python3-cffi = %{epoch}:%{version}-%{release}
Provides: python3dist(cffi) = %{epoch}:%{version}-%{release}
Provides: python%{python3_version}-cffi = %{epoch}:%{version}-%{release}
Provides: python%{python3_version}dist(cffi) = %{epoch}:%{version}-%{release}
Provides: python%{python3_version_nodots}-cffi = %{epoch}:%{version}-%{release}
Provides: python%{python3_version_nodots}dist(cffi) = %{epoch}:%{version}-%{release}

%description -n python%{python3_version_nodots}-cffi
Foreign Function Interface for Python, providing a convenient and
reliable way of calling existing C code from Python. The interface is
based on LuaJIT’s FFI.

%files -n python%{python3_version_nodots}-cffi
%license LICENSE
%{python3_sitearch}/_cffi_backend.*.so
%{python3_sitearch}/cffi*
%endif

%if !(0%{?suse_version} > 1500) && !(0%{?rhel} == 7)
%package -n python3-cffi
Summary: Foreign Function Interface for Python to call C code
Requires: python3
Requires: python3-pycparser
Provides: python3-cffi = %{epoch}:%{version}-%{release}
Provides: python3dist(cffi) = %{epoch}:%{version}-%{release}
Provides: python%{python3_version}-cffi = %{epoch}:%{version}-%{release}
Provides: python%{python3_version}dist(cffi) = %{epoch}:%{version}-%{release}
Provides: python%{python3_version_nodots}-cffi = %{epoch}:%{version}-%{release}
Provides: python%{python3_version_nodots}dist(cffi) = %{epoch}:%{version}-%{release}

%description -n python3-cffi
Foreign Function Interface for Python, providing a convenient and
reliable way of calling existing C code from Python. The interface is
based on LuaJIT’s FFI.

%files -n python3-cffi
%license LICENSE
%{python3_sitearch}/_cffi_backend.*.so
%{python3_sitearch}/cffi*
%endif

%changelog
19 changes: 12 additions & 7 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
[metadata]
license_file = LICENSE
license_files = LICENSE
project_urls =
Documentation = http://cffi.readthedocs.org/
Source Code = https://github.com/python-cffi/cffi
Issue Tracker = https://github.com/python-cffi/cffi/issues
Changelog = https://cffi.readthedocs.io/en/latest/whatsnew.html
Downloads = https://github.com/python-cffi/cffi/releases
Contact = https://groups.google.com/forum/#!forum/python-cffi
project_urls =
Documentation = http://cffi.readthedocs.org/
Source Code = https://github.com/python-cffi/cffi
Issue Tracker = https://github.com/python-cffi/cffi/issues
Changelog = https://cffi.readthedocs.io/en/latest/whatsnew.html
Downloads = https://github.com/python-cffi/cffi/releases
Contact = https://groups.google.com/forum/#!forum/python-cffi

[egg_info]
tag_build =
tag_date = 0

4 changes: 4 additions & 0 deletions src/c/_cffi_backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -6118,7 +6118,11 @@ static void _my_PyErr_WriteUnraisable(PyObject *t, PyObject *v, PyObject *tb,

PyErr_Restore(t, v, tb);
if (s != NULL) {
#if PY_VERSION_HEX >= 0x030D0000
PyErr_FormatUnraisable("Exception ignored %S", s);
#else
_PyErr_WriteUnraisableMsg(PyText_AS_UTF8(s), NULL);
#endif
Py_DECREF(s);
}
else
Expand Down

0 comments on commit 25c5994

Please sign in to comment.