]> git.pld-linux.org Git - packages/python-notify2.git/blob - python-notify2.spec
rebuild with tests and docs
[packages/python-notify2.git] / python-notify2.spec
1 #
2 # Conditional build:
3 %bcond_without  doc     # don't build doc
4 %bcond_without  python2 # CPython 2.x module
5 %bcond_without  python3 # CPython 3.x module
6
7 %define         module          notify2
8 %define         egg_name        notify2
9 %define         pypi_name       notify2
10 Summary:        Python 2 interface to DBus notifications
11 Name:           python-%{pypi_name}
12 Version:        0.3.1
13 Release:        8
14 License:        BSD
15 Group:          Libraries/Python
16 Source0:        https://files.pythonhosted.org/packages/source/n/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
17 # Source0-md5:  ffccaed9330787c7442b453f6520a474
18 URL:            https://bitbucket.org/takluyver/pynotify2
19 BuildRequires:  rpm-pythonprov
20 BuildRequires:  rpmbuild(macros) >= 1.714
21 %if %{with python2}
22 BuildRequires:  python-modules
23 BuildRequires:  python-setuptools
24 %endif
25 %if %{with python3}
26 BuildRequires:  python3-modules
27 BuildRequires:  python3-setuptools
28 %endif
29 %if %{with doc}
30 BuildRequires:  python3-devel-tools
31 BuildRequires:  sphinx-pdg
32 %endif
33 BuildArch:      noarch
34 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
35
36 %description
37 This is a pure Python replacement for notify-python, using python-dbus
38 to communicate with the notifications server directly.
39
40 %package -n python3-%{pypi_name}
41 Summary:        Python 3 interface to DBus notifications
42 Group:          Libraries/Python
43
44 %description -n python3-%{pypi_name}
45 This is a pure Python replacement for notify-python, using python-dbus
46 to communicate with the notifications server directly.
47
48 %package apidocs
49 Summary:        %{module} API documentation
50 Summary(pl.UTF-8):      Dokumentacja API %{module}
51 Group:          Documentation
52
53 %description apidocs
54 API documentation for %{module}.
55
56 %description apidocs -l pl.UTF-8
57 Dokumentacja API %{module}.
58
59 %prep
60 %setup -q -n %{pypi_name}-%{version}
61
62 %build
63 %if %{with python2}
64 %py_build
65 %endif
66
67 %if %{with python3}
68 %py3_build
69 %endif
70
71 %if %{with doc}
72 # generate html docs
73 sphinx-build docs html
74 # remove the sphinx-build leftovers
75 %{__rm} -r html/.{doctrees,buildinfo}
76 %endif
77
78 %install
79 rm -rf $RPM_BUILD_ROOT
80 %if %{with python2}
81 %py_install
82 %py_postclean
83 install -d $RPM_BUILD_ROOT%{_examplesdir}/python-%{module}-%{version}
84 cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python-%{module}-%{version}
85 %{__rm} $RPM_BUILD_ROOT%{_examplesdir}/python-%{pypi_name}-%{version}/notify2.py
86 %{__sed} -E -i -e '1s,#!\s*/usr/bin/env\s+python(\s|$),#!%{__python}\1,' \
87         $RPM_BUILD_ROOT%{_examplesdir}/python-%{module}-%{version}/*.py
88 %endif
89
90 %if %{with python3}
91 %py3_install
92 install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{pypi_name}-%{version}
93 cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python3-%{pypi_name}-%{version}
94 %{__rm} $RPM_BUILD_ROOT%{_examplesdir}/python3-%{pypi_name}-%{version}/notify2.py
95 %{__sed} -E -i -e '1s,#!\s*/usr/bin/env\s+python(\s|$),#!%{__python3}\1,' \
96         $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}/*.py
97 %endif
98
99 %clean
100 rm -rf $RPM_BUILD_ROOT
101
102 %if %{with python2}
103 %files
104 %defattr(644,root,root,755)
105 %{py_sitescriptdir}/%{pypi_name}.py[co]
106 %{py_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info
107 %{_examplesdir}/python-%{module}-%{version}
108 %endif
109
110 %if %{with python3}
111 %files -n python3-%{pypi_name}
112 %defattr(644,root,root,755)
113 %{py3_sitescriptdir}/%{pypi_name}.py
114 %{py3_sitescriptdir}/__pycache__/*.pyc
115 %{py3_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info
116 %{_examplesdir}/python3-%{pypi_name}-%{version}
117 %endif
118
119 %if %{with doc}
120 %files apidocs
121 %defattr(644,root,root,755)
122 %doc html/*
123 %endif
This page took 0.140156 seconds and 4 git commands to generate.