]>
Commit | Line | Data |
---|---|---|
42b43fca JR |
1 | # |
2 | # This is template for pure python modules (noarch) | |
3 | # use template-specs/python-ext.spec for binary python packages | |
4 | # | |
5 | # | |
6 | # Conditional build: | |
7 | %bcond_without python2 # CPython 2.x module | |
8 | %bcond_without python3 # CPython 3.x module | |
9 | ||
10 | # NOTES: | |
11 | # - 'module' should match the Python import path (first component?) | |
12 | # - 'egg_name' should equal to Python egg name | |
13 | # - 'pypi_name' must match the Python Package Index name | |
14 | %define module pybind11 | |
15 | %define egg_name pybind11 | |
16 | %define pypi_name pybind11 | |
17 | Summary: Seamless operability between C++11 and Python | |
18 | Name: python-%{pypi_name} | |
19 | Version: 2.2.4 | |
8eabd08d | 20 | Release: 1 |
42b43fca JR |
21 | License: BSD |
22 | Group: Libraries/Python | |
23 | Source0: https://files.pythonhosted.org/packages/source/p/%{pypi_name}/%{pypi_name}-%{version}.tar.gz | |
24 | # Source0-md5: 159d9ac0b6570c2888511b14019a2578 | |
25 | URL: https://pypi.org/project/pybind11/ | |
26 | BuildRequires: rpmbuild(macros) >= 1.714 | |
27 | %if %{with python2} | |
28 | BuildRequires: python-modules | |
29 | BuildRequires: python-setuptools | |
30 | BuildRequires: rpm-pythonprov | |
31 | %endif | |
32 | %if %{with python3} | |
33 | BuildRequires: python3-modules | |
34 | BuildRequires: python3-setuptools | |
35 | %endif | |
36 | # when using /usr/bin/env or other in-place substitutions | |
37 | #BuildRequires: sed >= 4.0 | |
38 | # replace with other requires if defined in setup.py | |
39 | Requires: python-modules | |
40 | BuildArch: noarch | |
41 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
42 | ||
43 | %description | |
44 | pybind11 is a lightweight header-only library that exposes C++ types | |
45 | in Python and vice versa, mainly to create Python bindings of existing | |
46 | C++ code. Its goals and syntax are similar to the excellent | |
47 | Boost.Python library by David Abrahams: to minimize boilerplate code | |
48 | in traditional extension modules by inferring type information using | |
49 | compile-time introspection. | |
50 | ||
51 | %package -n python3-%{pypi_name} | |
52 | Summary: Seamless operability between C++11 and Python | |
53 | Group: Libraries/Python | |
54 | Requires: python3-modules | |
55 | ||
56 | %description -n python3-%{pypi_name} | |
57 | pybind11 is a lightweight header-only library that exposes C++ types | |
58 | in Python and vice versa, mainly to create Python bindings of existing | |
59 | C++ code. Its goals and syntax are similar to the excellent | |
60 | Boost.Python library by David Abrahams: to minimize boilerplate code | |
61 | in traditional extension modules by inferring type information using | |
62 | compile-time introspection. | |
63 | ||
64 | %prep | |
65 | %setup -q -n %{pypi_name}-%{version} | |
66 | ||
67 | %build | |
68 | %if %{with python2} | |
69 | %py_build | |
70 | %endif | |
71 | ||
72 | %if %{with python3} | |
73 | %py3_build | |
74 | %endif | |
75 | ||
76 | %install | |
77 | rm -rf $RPM_BUILD_ROOT | |
78 | ||
79 | %if %{with python2} | |
80 | %py_install | |
81 | ||
82 | # when files are installed in other way that standard 'setup.py | |
83 | # they need to be (re-)compiled | |
84 | # change %{py_sitedir} to %{py_sitescriptdir} for 'noarch' packages! | |
85 | %py_ocomp $RPM_BUILD_ROOT%{py_sitedir} | |
86 | %py_comp $RPM_BUILD_ROOT%{py_sitedir} | |
87 | ||
88 | %py_postclean | |
89 | %endif | |
90 | ||
91 | %if %{with python3} | |
92 | %py3_install | |
93 | %endif | |
94 | ||
95 | %clean | |
96 | rm -rf $RPM_BUILD_ROOT | |
97 | ||
98 | %if %{with python2} | |
99 | %files | |
100 | %defattr(644,root,root,755) | |
101 | %doc CONTRIBUTING.md README.md | |
102 | %{py_sitescriptdir}/%{module} | |
103 | %{py_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info | |
104 | %{py_incdir}/pybind11 | |
105 | %endif | |
106 | ||
107 | %if %{with python3} | |
108 | %files -n python3-%{pypi_name} | |
109 | %defattr(644,root,root,755) | |
110 | %doc CONTRIBUTING.md README.md | |
111 | %{py3_sitescriptdir}/%{module} | |
112 | %{py3_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info | |
113 | %{py3_incdir}/pybind11 | |
114 | %endif |