]> git.pld-linux.org Git - packages/python-ctypesgen.git/blob - python-ctypesgen.spec
727d08e7e461aa40c24911dbd9dceb26a2f21173
[packages/python-ctypesgen.git] / python-ctypesgen.spec
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
7 %define         module  ctypesgen
8 Summary:        A pure-python wrapper generator for ctypes
9 Summary(pl.UTF-8):      Generator wrapperów dla ctypes napisany w czystym Pythonie
10 Name:           python-%{module}
11 Version:        1.0.2
12 Release:        2
13 License:        BSD
14 Group:          Libraries/Python
15 # only wheels on https://pypi.org/simple/ctypesgen so get from github
16 #Source0Download: https://github.com/davidjamesca/ctypesgen/releases
17 Source0:        https://github.com/davidjamesca/ctypesgen/archive/ctypesgen-%{version}/%{module}-%{version}.tar.gz
18 # Source0-md5:  0928ef10a1f0323a82d55d6a0dfac8ff
19 Patch0:         %{name}-x32.patch
20 URL:            https://github.com/davidjamesca/ctypesgen
21 %if %{with python2}
22 BuildRequires:  python >= 1:2.3
23 BuildRequires:  python-modules >= 1:2.3
24 BuildRequires:  python-setuptools
25 %if %{with tests}
26 BuildRequires:  python-pytest
27 %endif
28 %endif
29 %if %{with python3}
30 BuildRequires:  python3 >= 1:3.2
31 BuildRequires:  python3-modules >= 1:3.2
32 BuildRequires:  python3-setuptools
33 %if %{with tests}
34 BuildRequires:  python3-pytest
35 %endif
36 %endif
37 BuildRequires:  rpm-pythonprov
38 BuildRequires:  rpmbuild(macros) >= 1.714
39 BuildArch:      noarch
40 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
41
42 %description
43 This project automatically generates ctypes wrappers for header files
44 written in C.
45
46 %description -l pl.UTF-8
47 Ten program automatycznie generuje wrappery ctypes dla plików
48 nagłówkowych w C.
49
50 %package -n python3-%{module}
51 Summary:        A pure-python wrapper generator for ctypes
52 Summary(pl.UTF-8):      Generator wrapperów dla ctypes napisany w czystym Pythonie
53 Group:          Libraries/Python
54
55 %description -n python3-%{module}
56 This project automatically generates ctypes wrappers for header files
57 written in C.
58
59 %description -n python3-%{module} -l pl.UTF-8
60 Ten program automatycznie generuje wrappery ctypes dla plików
61 nagłówkowych w C.
62
63 %prep
64 %setup -q -n %{module}-%{module}-%{version}
65 %patch0 -p1
66
67 %build
68 %if %{with python2}
69 %py_build
70
71 %if %{with tests}
72 PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
73 %{__python} -m pytest -v -x --showlocals ctypesgen/test/testsuite.py
74 %endif
75
76 find ctypesgen -name '*.py[co]' | xargs %{__rm}
77 %endif
78
79 %if %{with python3}
80 %py3_build
81
82 %if %{with tests}
83 PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
84 %{__python3} -m pytest -v -x --showlocals ctypesgen/test/testsuite.py
85 %endif
86
87 find ctypesgen -name '__pycache__' | xargs %{__rm} -r
88 %endif
89
90 %install
91 rm -rf $RPM_BUILD_ROOT
92
93 %if %{with python2}
94 %py_install
95
96 # defaultheader.py and preamble.py are templates not modules, so .py files
97 # are required instead of compiled versions
98 # libraryloader.py is used both as module and template, so both forms are required
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
106 find 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}
115 ln -s ctypesgen-3 $RPM_BUILD_ROOT%{_bindir}/ctypesgen
116 %endif
117
118 %clean
119 rm -rf $RPM_BUILD_ROOT
120
121 %if %{with python2}
122 %files
123 %defattr(644,root,root,755)
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.115067 seconds and 2 git commands to generate.