]> git.pld-linux.org Git - packages/python-ctypesgen.git/blame - python-ctypesgen.spec
rebuild with python 3.10
[packages/python-ctypesgen.git] / python-ctypesgen.spec
CommitLineData
3a01e527
JB
1#
2# Conditional build:
3%bcond_without tests # unit tests
4%bcond_without python2 # CPython 2.x module
5%bcond_without python3 # CPython 3.x module
6
97a7f1de 7%define module ctypesgen
97a7f1de 8Summary: A pure-python wrapper generator for ctypes
9966eb05 9Summary(pl.UTF-8): Generator wrapperów dla ctypes napisany w czystym Pythonie
97a7f1de 10Name: python-%{module}
3a01e527 11Version: 1.0.2
5830f4a6 12Release: 3
97a7f1de
AM
13License: BSD
14Group: Libraries/Python
3a01e527
JB
15# only wheels on https://pypi.org/simple/ctypesgen so get from github
16#Source0Download: https://github.com/davidjamesca/ctypesgen/releases
17Source0: https://github.com/davidjamesca/ctypesgen/archive/ctypesgen-%{version}/%{module}-%{version}.tar.gz
18# Source0-md5: 0928ef10a1f0323a82d55d6a0dfac8ff
d3adbc4e 19Patch0: %{name}-x32.patch
9ea10f04 20URL: https://github.com/davidjamesca/ctypesgen
3a01e527 21%if %{with python2}
9ea10f04 22BuildRequires: python >= 1:2.3
9ea10f04 23BuildRequires: python-modules >= 1:2.3
3a01e527
JB
24BuildRequires: python-setuptools
25%if %{with tests}
26BuildRequires: python-pytest
27%endif
28%endif
29%if %{with python3}
30BuildRequires: python3 >= 1:3.2
31BuildRequires: python3-modules >= 1:3.2
32BuildRequires: python3-setuptools
33%if %{with tests}
34BuildRequires: python3-pytest
35%endif
36%endif
efa91d97 37BuildRequires: rpm-pythonprov
3a01e527 38BuildRequires: rpmbuild(macros) >= 1.714
97a7f1de
AM
39BuildArch: noarch
40BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
41
42%description
43This project automatically generates ctypes wrappers for header files
44written in C.
45
9966eb05
JB
46%description -l pl.UTF-8
47Ten program automatycznie generuje wrappery ctypes dla plików
48nagłówkowych w C.
49
3a01e527
JB
50%package -n python3-%{module}
51Summary: A pure-python wrapper generator for ctypes
52Summary(pl.UTF-8): Generator wrapperów dla ctypes napisany w czystym Pythonie
53Group: Libraries/Python
54
55%description -n python3-%{module}
56This project automatically generates ctypes wrappers for header files
57written in C.
58
59%description -n python3-%{module} -l pl.UTF-8
60Ten program automatycznie generuje wrappery ctypes dla plików
61nagłówkowych w C.
62
97a7f1de 63%prep
3a01e527 64%setup -q -n %{module}-%{module}-%{version}
d3adbc4e 65%patch0 -p1
97a7f1de
AM
66
67%build
3a01e527 68%if %{with python2}
d11d9109 69%py_build
97a7f1de 70
3a01e527
JB
71%if %{with tests}
72PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
73%{__python} -m pytest -v -x --showlocals ctypesgen/test/testsuite.py
74%endif
75
76find ctypesgen -name '*.py[co]' | xargs %{__rm}
77%endif
78
79%if %{with python3}
80%py3_build
81
82%if %{with tests}
83PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
84%{__python3} -m pytest -v -x --showlocals ctypesgen/test/testsuite.py
85%endif
86
87find ctypesgen -name '__pycache__' | xargs %{__rm} -r
88%endif
89
97a7f1de
AM
90%install
91rm -rf $RPM_BUILD_ROOT
92
3a01e527 93%if %{with python2}
d11d9109 94%py_install
97a7f1de 95
9966eb05 96# defaultheader.py and preamble.py are templates not modules, so .py files
9ea10f04 97# are required instead of compiled versions
9966eb05 98# libraryloader.py is used both as module and template, so both forms are required
3a01e527
JB
99%py_postclean -x defaultheader.py,preamble/2_5.py,preamble/2_7.py,preable/3_2.py,libraryloader.py
100%{__rm} $RPM_BUILD_ROOT%{py_sitescriptdir}/ctypesgen/printer_python/defaultheader.py[co]
101%{__rm} $RPM_BUILD_ROOT%{py_sitescriptdir}/ctypesgen/printer_python/preamble/[23]_*.py[co]
102%{__rm} -r $RPM_BUILD_ROOT%{py_sitescriptdir}/ctypesgen/test
103
104%{__mv} $RPM_BUILD_ROOT%{_bindir}/ctypesgen{,-2}
105
106find ctypesgen -name '*.py[co]' | xargs %{__rm}
107%endif
108
109%if %{with python3}
110%py3_install
111
112%{__rm} -r $RPM_BUILD_ROOT%{py3_sitescriptdir}/ctypesgen/test
113
114%{__mv} $RPM_BUILD_ROOT%{_bindir}/ctypesgen{,-3}
115ln -s ctypesgen-3 $RPM_BUILD_ROOT%{_bindir}/ctypesgen
116%endif
9966eb05 117
97a7f1de
AM
118%clean
119rm -rf $RPM_BUILD_ROOT
120
3a01e527 121%if %{with python2}
97a7f1de
AM
122%files
123%defattr(644,root,root,755)
3a01e527
JB
124%doc LICENSE README.md todo.txt
125%attr(755,root,root) %{_bindir}/ctypesgen-2
126%{py_sitescriptdir}/ctypesgen
127%{py_sitescriptdir}/ctypesgen-0.0.0-py*.egg-info
128%endif
129
130%files -n python3-%{module}
131%defattr(644,root,root,755)
132%doc LICENSE README.md todo.txt
133%attr(755,root,root) %{_bindir}/ctypesgen
134%attr(755,root,root) %{_bindir}/ctypesgen-3
135%{py3_sitescriptdir}/ctypesgen
136%{py3_sitescriptdir}/ctypesgen-0.0.0-py*.egg-info
This page took 0.161698 seconds and 4 git commands to generate.