00c746ec7ccead24c125003fe44fb27ee382b21f
[packages/python3-ipykernel.git] / python-ipykernel.spec
1 #
2 # Conditional build:
3 %bcond_without  doc     # Sphinx documentation
4 %bcond_without  tests   # unit tests
5 %bcond_without  python2 # CPython 2.x module
6 %bcond_without  python3 # CPython 3.x module
7
8 Summary:        IPython kernel for Jupyter
9 Summary(pl.UTF-8):      Jądro IPythona dla Jupytera
10 Name:           python-ipykernel
11 Version:        4.10.1
12 Release:        3
13 License:        BSD
14 Group:          Libraries/Python
15 #Source0Download: https://pypi.org/simple/ipykernel/
16 Source0:        https://files.pythonhosted.org/packages/source/i/ipykernel/ipykernel-%{version}.tar.gz
17 # Source0-md5:  23871bb7da2907749cb65a9446c9e637
18 Patch0:         %{name}-use_setuptools.patch
19 URL:            https://pypi.org/project/ipykernel/
20 %if %{with python2}
21 BuildRequires:  python-modules >= 1:2.7
22 BuildRequires:  python-setuptools
23 %if %{with tests}
24 BuildRequires:  python-ipython >= 4.0.0
25 BuildRequires:  python-jupyter_client
26 BuildRequires:  python-mock
27 BuildRequires:  python-nose
28 BuildRequires:  python-pytest
29 BuildRequires:  python-pytest-cov
30 BuildRequires:  python-traitlets >= 4.1.0
31 BuildRequires:  python-tornado >= 4.0
32 %endif
33 %endif
34 %if %{with python3}
35 BuildRequires:  python3-modules >= 1:3.4
36 BuildRequires:  python3-setuptools
37 %if %{with tests}
38 BuildRequires:  python3-ipython >= 4.0.0
39 BuildRequires:  python3-jupyter_client
40 BuildRequires:  python3-nose
41 BuildRequires:  python3-pytest
42 BuildRequires:  python3-pytest-cov
43 BuildRequires:  python3-traitlets >= 4.1.0
44 BuildRequires:  python3-tornado >= 4.0
45 %endif
46 %endif
47 BuildRequires:  rpm-pythonprov
48 BuildRequires:  rpmbuild(macros) >= 1.714
49 BuildRequires:  sed >= 4.0
50 %if %{with doc}
51 BuildRequires:  python3-sphinxcontrib_github_alt
52 BuildRequires:  sphinx-pdg-3
53 %endif
54 Requires:       python-modules >= 1:2.7
55 BuildArch:      noarch
56 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
57
58 %description
59 This package provides the IPython kernel for Jupyter.
60
61 %description -l pl.UTF-8
62 Ten pakiet dostarcza jądro IPythona dla Jupytera.
63
64 %package -n python3-ipykernel
65 Summary:        IPython kernel for Jupyter
66 Summary(pl.UTF-8):      Jądro IPythona dla Jupytera
67 Group:          Libraries/Python
68 Requires:       python3-modules >= 1:3.4
69
70 %description -n python3-ipykernel
71 This package provides the IPython kernel for Jupyter.
72
73 %description -n python3-ipykernel -l pl.UTF-8
74 Ten pakiet dostarcza jądro IPythona dla Jupytera.
75
76 %package apidocs
77 Summary:        API documentation for Python ipykernel module
78 Summary(pl.UTF-8):      Dokumentacja API modułu Pythona ipykernel
79 Group:          Documentation
80
81 %description apidocs
82 API documentation for Python ipykernel module.
83
84 %description apidocs -l pl.UTF-8
85 Dokumentacja API modułu Pythona ipykernel.
86
87 %prep
88 %setup -q -n ipykernel-%{version}
89 %patch0 -p1
90
91 %build
92 %if %{with python2}
93 %py_build
94
95 %if %{with tests}
96 # test_oinfo_detail test requires ipython source code
97 PYTHONPATH=$(pwd) \
98 %{__python} -m pytest -k 'not test_oinfo_detail' ipykernel
99 %endif
100 %endif
101
102 %if %{with python3}
103 %py3_build
104
105 %if %{with tests}
106 PYTHONPATH=$(pwd) \
107 %{__python3} -m pytest ipykernel
108 %endif
109 %endif
110
111 %if %{with doc}
112 %{__make} -C docs html \
113         SPHINXBUILD=sphinx-build-3
114 %endif
115
116 %install
117 rm -rf $RPM_BUILD_ROOT
118
119 %if %{with python2}
120 %py_install
121
122 install -d $RPM_BUILD_ROOT%{_examplesdir}/python-ipykernel-%{version}
123 cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python-ipykernel-%{version}
124 find $RPM_BUILD_ROOT%{_examplesdir}/python-ipykernel-%{version} -name '*.py' \
125         | xargs sed -i '1s|/usr/bin/env python|%{__python}|'
126
127 %py_postclean
128 %{__rm} -r $RPM_BUILD_ROOT%{py_sitescriptdir}/ipykernel/tests \
129         $RPM_BUILD_ROOT%{py_sitescriptdir}/ipykernel/inprocess/tests
130 %endif
131
132 %if %{with python3}
133 %py3_install
134
135 install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-ipykernel-%{version}
136 cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python3-ipykernel-%{version}
137 find $RPM_BUILD_ROOT%{_examplesdir}/python3-ipykernel-%{version} -name '*.py' \
138         | xargs sed -i '1s|/usr/bin/env python|%{__python3}|'
139
140 %{__rm} -r $RPM_BUILD_ROOT%{py3_sitescriptdir}/ipykernel/tests \
141         $RPM_BUILD_ROOT%{py3_sitescriptdir}/ipykernel/inprocess/tests
142 %endif
143
144 %clean
145 rm -rf $RPM_BUILD_ROOT
146
147 %if %{with python2}
148 %files
149 %defattr(644,root,root,755)
150 %doc COPYING.md README.md
151 %{py_sitescriptdir}/ipykernel
152 %{py_sitescriptdir}/ipykernel_launcher.py[co]
153 %{py_sitescriptdir}/ipykernel-%{version}-py*.egg-info
154 %dir %{_datadir}/jupyter
155 %dir %{_datadir}/jupyter/kernels
156 %{_datadir}/jupyter/kernels/python2
157 %{_examplesdir}/python-ipykernel-%{version}
158 %endif
159
160 %if %{with python3}
161 %files -n python3-ipykernel
162 %defattr(644,root,root,755)
163 %doc COPYING.md README.md
164 %{py3_sitescriptdir}/ipykernel
165 %{py3_sitescriptdir}/ipykernel_launcher.py
166 %{py3_sitescriptdir}/__pycache__/ipykernel_launcher.cpython-*.py[co]
167 %{py3_sitescriptdir}/ipykernel-%{version}-py*.egg-info
168 %dir %{_datadir}/jupyter
169 %dir %{_datadir}/jupyter/kernels
170 %{_datadir}/jupyter/kernels/python3
171 %{_examplesdir}/python3-ipykernel-%{version}
172 %endif
173
174 %if %{with doc}
175 %files apidocs
176 %defattr(644,root,root,755)
177 %doc docs/_build/html/{_static,*.html,*.js}
178 %endif
This page took 0.10167 seconds and 2 git commands to generate.