]>
Commit | Line | Data |
---|---|---|
2a09529a JK |
1 | |
2 | # Conditional build: | |
3 | %bcond_without tests # do not perform "make test" | |
4 | %bcond_without python2 # CPython 2.x module | |
a0ff4b52 | 5 | %bcond_without python3 # CPython 3.x module |
2a09529a JK |
6 | |
7 | %define module tdbus | |
8 | Summary: Simple ("trivial") Python bindings for D-BUS | |
9 | Name: python-%{module} | |
3db05e76 | 10 | Version: 0.11 |
a89db7ee | 11 | Release: 6 |
2a09529a JK |
12 | License: MIT |
13 | Group: Libraries/Python | |
3db05e76 JK |
14 | Source0: https://github.com/hmvp/python-tdbus/archive/v%{version}/%{name}-%{version}.tar.gz |
15 | # Source0-md5: 51eb65661eafcb56a10326187cd65355 | |
16 | Patch0: reference_counting.patch | |
2a09529a JK |
17 | URL: https://github.com/hmvp/python-tdbus |
18 | BuildRequires: rpm-pythonprov | |
d78fde49 | 19 | BuildRequires: rpmbuild(macros) >= 1.710 |
2a09529a JK |
20 | %if %{with python2} |
21 | BuildRequires: python-devel | |
41b46a01 | 22 | BuildRequires: python-gevent |
a0ff4b52 | 23 | BuildRequires: python-setuptools |
2a09529a JK |
24 | %endif |
25 | %if %{with python3} | |
26 | BuildRequires: python3-devel | |
41b46a01 | 27 | BuildRequires: python3-gevent |
a0ff4b52 | 28 | BuildRequires: python3-setuptools |
2a09529a | 29 | %endif |
f9a3da58 JK |
30 | %if %{with tests} |
31 | BuildRequires: /usr/bin/dbus-launch | |
32 | %endif | |
2a09529a JK |
33 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
34 | ||
35 | %description | |
36 | Python-tdbus is a simple ("trivial") python interface for D-BUS. It | |
37 | builds directly on top of libdbus and has no other dependencies. Some | |
38 | benefits of python-tdbus with respect to the standard dbus-python [1]_ | |
39 | Python bindings: | |
40 | ||
41 | - The code is extremely simple. Python-tdbus is < 2.000 lines of code | |
42 | (C and Python), while dbus-python contains > 15.000 lines of code. | |
43 | - Event loop integration is not required for sending and receiving | |
44 | signals (if you can afford to block). | |
45 | - Includes `gevent' [2]_ event loop integration. | |
46 | - Event loop integration can be achieved in Python code rather than in | |
47 | C. | |
48 | - Uses native Python types for method and signal arguments, driven by | |
49 | a simple format string. | |
50 | - Provides a more "correct" object model (IMHO) where there's separate | |
51 | Dispatcher and Connection objects, instead of putting dispatching | |
52 | functionality into the connection object. | |
53 | ||
54 | %package -n python3-%{module} | |
55 | Summary: Simple ("trivial") Python bindings for D-BUS | |
56 | Group: Libraries/Python | |
57 | ||
58 | %description -n python3-%{module} | |
59 | Python-tdbus is a simple ("trivial") python interface for D-BUS. It | |
60 | builds directly on top of libdbus and has no other dependencies. Some | |
61 | benefits of python-tdbus with respect to the standard dbus-python [1]_ | |
62 | Python bindings: | |
63 | ||
64 | - The code is extremely simple. Python-tdbus is < 2.000 lines of code | |
65 | (C and Python), while dbus-python contains > 15.000 lines of code. | |
66 | - Event loop integration is not required for sending and receiving | |
67 | signals (if you can afford to block). | |
68 | - Includes `gevent' [2]_ event loop integration. | |
69 | - Event loop integration can be achieved in Python code rather than in | |
70 | C. | |
71 | - Uses native Python types for method and signal arguments, driven by | |
72 | a simple format string. | |
73 | - Provides a more "correct" object model (IMHO) where there's separate | |
74 | Dispatcher and Connection objects, instead of putting dispatching | |
75 | functionality into the connection object. | |
76 | ||
77 | %package apidocs | |
78 | Summary: %{module} API documentation | |
79 | Summary(pl.UTF-8): Dokumentacja API %{module} | |
80 | Group: Documentation | |
81 | ||
82 | %description apidocs | |
83 | API documentation for %{module}. | |
84 | ||
85 | %description apidocs -l pl.UTF-8 | |
86 | Dokumentacja API %{module}. | |
87 | ||
88 | %prep | |
89 | %setup -q | |
3db05e76 | 90 | |
30215a09 | 91 | %patch0 -p1 |
2a09529a JK |
92 | |
93 | %build | |
f9a3da58 JK |
94 | unset DISPLAY |
95 | unset DBUS_SESSION_BUS_ADDRESS | |
96 | unset XDG_RUNTIME_DIR | |
97 | ||
98 | %if %{with tests} | |
99 | eval $(dbus-launch --sh-syntax) | |
100 | %endif | |
101 | ||
2a09529a | 102 | %if %{with python2} |
a6570077 | 103 | %py_build %{?with_tests:test} |
2a09529a JK |
104 | %endif |
105 | ||
106 | %if %{with python3} | |
a6570077 | 107 | %py3_build %{?with_tests:test} |
2a09529a JK |
108 | %endif |
109 | ||
110 | %install | |
111 | rm -rf $RPM_BUILD_ROOT | |
112 | ||
113 | %if %{with python2} | |
a6570077 | 114 | %py_install |
2a09529a JK |
115 | |
116 | %py_postclean | |
117 | %endif | |
118 | ||
119 | %if %{with python3} | |
a6570077 | 120 | %py3_install |
2a09529a JK |
121 | %endif |
122 | ||
123 | %clean | |
124 | rm -rf $RPM_BUILD_ROOT | |
125 | ||
126 | %if %{with python2} | |
127 | %files | |
128 | %defattr(644,root,root,755) | |
a0ff4b52 | 129 | %doc AUTHORS CHANGES HACKING README.rst |
2a09529a JK |
130 | %dir %{py_sitedir}/%{module} |
131 | %{py_sitedir}/%{module}/*.py[co] | |
132 | %attr(755,root,root) %{py_sitedir}/%{module}/_tdbus.so | |
2a09529a JK |
133 | %{py_sitedir}/*.egg-info |
134 | %endif | |
2a09529a JK |
135 | |
136 | %if %{with python3} | |
137 | %files -n python3-%{module} | |
138 | %defattr(644,root,root,755) | |
a0ff4b52 JK |
139 | %doc AUTHORS CHANGES HACKING README.rst |
140 | %dir %{py3_sitedir}/%{module} | |
141 | %{py3_sitedir}/%{module}/__pycache__ | |
142 | %{py3_sitedir}/%{module}/*.py | |
143 | %attr(755,root,root) %{py3_sitedir}/%{module}/_tdbus*.so | |
2a09529a JK |
144 | %{py3_sitedir}/*.egg-info |
145 | %endif |