Skip to content

Commit 6841783

Browse files
committed
alvistack/1.16.0
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#86 Signed-off-by: Wong Hoi Sing Edison <[email protected]>
1 parent ba44abd commit 6841783

16 files changed

+275
-7
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ build/
44
__pycache__/
55
*.egg-info/
66
*.so
7+
.pybuild
8+
build

debian/.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
*.pydist
2+
*.substvars
3+
*debhelper*
4+
.debhelper
5+
files
6+
python3-cffi
7+
python3-cffi-backend
8+
tmp

debian/changelog

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
python-cffi (100:1.16.0-1) UNRELEASED; urgency=medium
2+
3+
* https://github.com/python-cffi/cffi/releases/tag/v1.16.0
4+
5+
-- Wong Hoi Sing Edison <[email protected]> Mon, 01 Jan 2024 20:00:32 +0800

debian/control

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
Source: python-cffi
2+
Section: python
3+
Priority: optional
4+
Standards-Version: 4.5.0
5+
Maintainer: Wong Hoi Sing Edison <[email protected]>
6+
Homepage: https://github.com/python-cffi/cffi/tags
7+
Vcs-Browser: https://github.com/alvistack/python-cffi-cffi
8+
Vcs-Git: https://github.com/alvistack/python-cffi-cffi.git
9+
Build-Depends:
10+
debhelper,
11+
debhelper-compat (= 10),
12+
dh-python,
13+
fdupes,
14+
cython3,
15+
libffi-dev,
16+
python3-dev,
17+
python3-setuptools,
18+
19+
Package: python3-cffi
20+
Architecture: amd64
21+
Description: Foreign Function Interface for Python to call C code
22+
Foreign Function Interface for Python, providing a convenient and
23+
reliable way of calling existing C code from Python. The interface is
24+
based on LuaJIT’s FFI.
25+
Depends:
26+
${misc:Depends},
27+
${shlibs:Depends},
28+
${python3:Depends},
29+
python3,
30+
python3-cffi-backend (<< ${source:Version}+c),
31+
python3-cffi-backend (>= ${source:Version}),
32+
python3-pycparser,
33+
34+
Package: python3-cffi-backend
35+
Architecture: amd64
36+
Description: Foreign Function Interface for Python to call C code - runtime
37+
This package contains the runtime support for pre-built cffi modules.
38+
Depends:
39+
${misc:Depends},
40+
${shlibs:Depends},
41+
${python3:Depends},
42+
Replaces:
43+
python3-cffi (<< 1),
44+
Breaks:
45+
python3-cffi (<< 1),
46+
Provides:
47+
${cffi:Provides},

debian/copyright

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2+
3+
Files: debian/*
4+
Copyright: 2024 Wong Hoi Sing Edison <[email protected]>
5+
License: Apache-2.0
6+
7+
License: Apache-2.0
8+
Licensed under the Apache License, Version 2.0 (the "License");
9+
you may not use this file except in compliance with the License.
10+
You may obtain a copy of the License at
11+
.
12+
http://www.apache.org/licenses/LICENSE-2.0
13+
.
14+
Unless required by applicable law or agreed to in writing, software
15+
distributed under the License is distributed on an "AS IS" BASIS,
16+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
See the License for the specific language governing permissions and
18+
limitations under the License.
19+
.
20+
The complete text of the Apache version 2.0 license
21+
can be found in "/usr/share/common-licenses/Apache-2.0".

debian/gen-backend-versions.py

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/python3
2+
3+
import re
4+
5+
6+
def target_version():
7+
with open('src/cffi/recompiler.py', encoding='UTF-8') as f:
8+
for line in f:
9+
m = re.match(r'^VERSION_BASE = (0x[0-9A-F]+)$', line)
10+
if m:
11+
return int(m.group(1), 16)
12+
raise Exception('Version not found')
13+
14+
15+
def backend_supported_versions():
16+
versions = {}
17+
with open('src/c/cffi1_module.c', encoding='UTF-8') as f:
18+
for line in f:
19+
m = re.match(r'^#define CFFI_VERSION_(MIN|MAX) *(0x[0-9A-F]+)$',
20+
line)
21+
if m:
22+
versions[m.group(1)] = int(m.group(2), 16)
23+
if len(versions) == 2:
24+
return versions['MIN'], versions['MAX']
25+
raise Exception('Versions not found')
26+
27+
28+
versions = backend_supported_versions()
29+
target = target_version()
30+
for pkg in ('python-cffi', 'python3-cffi'):
31+
subst = {
32+
'pkg': pkg,
33+
'min': versions[0],
34+
'max': versions[1],
35+
'target': target,
36+
}
37+
with open('debian/{0}-backend.substvars'.format(pkg), 'a',
38+
encoding='UTF-8') as f:
39+
f.write('cffi:Provides={pkg}-backend-api-min (= {min}), '
40+
'{pkg}-backend-api-max (= {max}), '
41+
'{pkg}-backend-api-{target}\n'.format(**subst))
42+
with open('debian/{0}.pydist'.format(pkg), 'w', encoding='UTF-8') as f:
43+
f.write('cffi {pkg}-backend-api-min (<= {target}), '
44+
'{pkg}-backend-api-max (>= {target})\n'
45+
.format(**subst))

debian/python3-cffi-backend.install

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
usr/lib/python*/*-packages/_cffi_backend.*.so
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
python3-cffi-backend: copyright-without-copyright-notice
2+
python3-cffi-backend: initial-upload-closes-no-bugs
3+
python3-cffi-backend: zero-byte-file-in-doc-directory

debian/python3-cffi.install

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
usr/lib/python*/*-packages/cffi*

debian/python3-cffi.lintian-overrides

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
python3-cffi: copyright-without-copyright-notice
2+
python3-cffi: initial-upload-closes-no-bugs
3+
python3-cffi: no-manual-page
4+
python3-cffi: zero-byte-file-in-doc-directory

debian/rules

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/make -f
2+
3+
SHELL := /bin/bash
4+
5+
override_dh_auto_install:
6+
debian/gen-backend-versions.py
7+
dh_auto_install --destdir=debian/tmp
8+
find debian/tmp/usr/lib/python*/*-packages -type f -name '*.pyc' -exec rm -rf {} \;
9+
fdupes -qnrps debian/tmp/usr/lib/python*/*-packages
10+
11+
override_dh_auto_test:
12+
13+
override_dh_auto_clean:
14+
15+
%:
16+
dh $@ --buildsystem=pybuild --with python3

debian/source/format

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.0 (quilt)

debian/source/lintian-overrides

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
python-cffi source: file-without-copyright-information
2+
python-cffi source: no-debian-changes
3+
python-cffi source: not-binnmuable-any-depends-any
4+
python-cffi source: source-contains-prebuilt-windows-binary
5+
python-cffi source: source-is-missing
6+
python-cffi source: source-package-encodes-python-version

python-cffi.spec

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Copyright 2024 Wong Hoi Sing Edison <[email protected]>
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
%global debug_package %{nil}
16+
17+
%global source_date_epoch_from_changelog 0
18+
19+
Name: python-cffi
20+
Epoch: 100
21+
Version: 1.16.0
22+
Release: 1%{?dist}
23+
Summary: Foreign Function Interface for Python to call C code
24+
License: MIT
25+
URL: https://github.com/python-cffi/cffi/tags
26+
Source0: %{name}_%{version}.orig.tar.gz
27+
BuildRequires: fdupes
28+
BuildRequires: libffi-devel
29+
BuildRequires: python-rpm-macros
30+
BuildRequires: python3-Cython3
31+
BuildRequires: python3-devel
32+
BuildRequires: python3-setuptools
33+
34+
%description
35+
Foreign Function Interface for Python, providing a convenient and
36+
reliable way of calling existing C code from Python. The interface is
37+
based on LuaJIT’s FFI.
38+
39+
%prep
40+
%autosetup -T -c -n %{name}_%{version}-%{release}
41+
tar -zx -f %{S:0} --strip-components=1 -C .
42+
43+
%build
44+
%py3_build
45+
46+
%install
47+
%py3_install
48+
find %{buildroot}%{python3_sitearch} -type f -name '*.pyc' -exec rm -rf {} \;
49+
fdupes -qnrps %{buildroot}%{python3_sitearch}
50+
51+
%check
52+
53+
%if 0%{?suse_version} > 1500 || 0%{?rhel} == 7
54+
%package -n python%{python3_version_nodots}-cffi
55+
Summary: Foreign Function Interface for Python to call C code
56+
Requires: python3
57+
Requires: python3-pycparser
58+
Provides: python3-cffi = %{epoch}:%{version}-%{release}
59+
Provides: python3dist(cffi) = %{epoch}:%{version}-%{release}
60+
Provides: python%{python3_version}-cffi = %{epoch}:%{version}-%{release}
61+
Provides: python%{python3_version}dist(cffi) = %{epoch}:%{version}-%{release}
62+
Provides: python%{python3_version_nodots}-cffi = %{epoch}:%{version}-%{release}
63+
Provides: python%{python3_version_nodots}dist(cffi) = %{epoch}:%{version}-%{release}
64+
65+
%description -n python%{python3_version_nodots}-cffi
66+
Foreign Function Interface for Python, providing a convenient and
67+
reliable way of calling existing C code from Python. The interface is
68+
based on LuaJIT’s FFI.
69+
70+
%files -n python%{python3_version_nodots}-cffi
71+
%license LICENSE
72+
%{python3_sitearch}/_cffi_backend.*.so
73+
%{python3_sitearch}/cffi*
74+
%endif
75+
76+
%if !(0%{?suse_version} > 1500) && !(0%{?rhel} == 7)
77+
%package -n python3-cffi
78+
Summary: Foreign Function Interface for Python to call C code
79+
Requires: python3
80+
Requires: python3-pycparser
81+
Provides: python3-cffi = %{epoch}:%{version}-%{release}
82+
Provides: python3dist(cffi) = %{epoch}:%{version}-%{release}
83+
Provides: python%{python3_version}-cffi = %{epoch}:%{version}-%{release}
84+
Provides: python%{python3_version}dist(cffi) = %{epoch}:%{version}-%{release}
85+
Provides: python%{python3_version_nodots}-cffi = %{epoch}:%{version}-%{release}
86+
Provides: python%{python3_version_nodots}dist(cffi) = %{epoch}:%{version}-%{release}
87+
88+
%description -n python3-cffi
89+
Foreign Function Interface for Python, providing a convenient and
90+
reliable way of calling existing C code from Python. The interface is
91+
based on LuaJIT’s FFI.
92+
93+
%files -n python3-cffi
94+
%license LICENSE
95+
%{python3_sitearch}/_cffi_backend.*.so
96+
%{python3_sitearch}/cffi*
97+
%endif
98+
99+
%changelog

setup.cfg

+12-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
[metadata]
22
license_file = LICENSE
33
license_files = LICENSE
4-
project_urls =
5-
Documentation = http://cffi.readthedocs.org/
6-
Source Code = https://github.com/python-cffi/cffi
7-
Issue Tracker = https://github.com/python-cffi/cffi/issues
8-
Changelog = https://cffi.readthedocs.io/en/latest/whatsnew.html
9-
Downloads = https://github.com/python-cffi/cffi/releases
10-
Contact = https://groups.google.com/forum/#!forum/python-cffi
4+
project_urls =
5+
Documentation = http://cffi.readthedocs.org/
6+
Source Code = https://github.com/python-cffi/cffi
7+
Issue Tracker = https://github.com/python-cffi/cffi/issues
8+
Changelog = https://cffi.readthedocs.io/en/latest/whatsnew.html
9+
Downloads = https://github.com/python-cffi/cffi/releases
10+
Contact = https://groups.google.com/forum/#!forum/python-cffi
11+
12+
[egg_info]
13+
tag_build =
14+
tag_date = 0
15+

src/c/_cffi_backend.c

+4
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,10 @@
191191
# define USE_WRITEUNRAISABLEMSG
192192
#endif
193193

194+
#if PY_VERSION_HEX >= 0x030c0000
195+
# define Py_FileSystemDefaultEncoding PyConfig.filesystem_encoding
196+
#endif
197+
194198
/************************************************************/
195199

196200
/* base type flag: exactly one of the following: */

0 commit comments

Comments
 (0)