]> git.pld-linux.org Git - packages/python-graphviz.git/blob - python-graphviz.spec
- added mock patch
[packages/python-graphviz.git] / python-graphviz.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:        Simple Python interface for Graphviz
9 Summary(pl.UTF-8):      Prosty pythonowy interfejs do Graphviza
10 Name:           python-graphviz
11 # keep 0.16.x here for python2 support
12 Version:        0.16
13 Release:        2
14 Epoch:          1
15 License:        MIT
16 Group:          Libraries/Python
17 #Source0Download: https://pypi.org/simple/graphviz/
18 Source0:        https://files.pythonhosted.org/packages/source/g/graphviz/graphviz-%{version}.zip
19 # Source0-md5:  76a73ed4821bcd993519490ec46d2061
20 Patch0:         %{name}-mock.patch
21 URL:            https://github.com/xflr6/graphviz
22 BuildRequires:  rpm-pythonprov
23 BuildRequires:  rpmbuild(macros) >= 1.714
24 BuildRequires:  sed >= 4.0
25 %if %{with python2}
26 BuildRequires:  python-modules >= 1:2.7
27 BuildRequires:  python-setuptools
28 %if %{with tests}
29 BuildRequires:  python-mock >= 2
30 BuildRequires:  python-pytest >= 4
31 BuildRequires:  python-pytest-cov
32 BuildRequires:  python-pytest-mock >= 1.8
33 %endif
34 %endif
35 %if %{with python3}
36 BuildRequires:  python3-modules >= 1:3.4
37 BuildRequires:  python3-setuptools
38 %if %{with tests}
39 BuildRequires:  python3-pytest >= 4
40 BuildRequires:  python3-pytest-cov
41 BuildRequires:  python3-pytest-mock >= 1.8
42 %endif
43 %endif
44 %if %{with tests}
45 BuildRequires:  graphviz
46 %endif
47 %if %{with apidocs}
48 BuildRequires:  python3-sphinx_rtd_theme
49 BuildRequires:  sphinx-pdg-3 >= 1.7
50 %endif
51 Requires:       graphviz
52 Requires:       python-modules >= 1:2.7
53 BuildArch:      noarch
54 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
55
56 %description
57 This package facilitates the creation and rendering of graph
58 descriptions in the DOT language of the Graphviz graph drawing
59 software from Python.
60
61 %description -l pl.UTF-8
62 Ten pakiet wspomaga tworzenie i renderowanie opisów grafów w języku
63 DOT oprogramowania do rysowania grafów Graphviz z poziomu Pythona.
64
65 %package -n python3-graphviz
66 Summary:        Simple Python interface for Graphviz
67 Summary(pl.UTF-8):      Prosty pythonowy interfejs do Graphviza
68 Group:          Libraries/Python
69 Requires:       graphviz
70 Requires:       python3-modules >= 1:3.4
71
72 %description -n python3-graphviz
73 This package facilitates the creation and rendering of graph
74 descriptions in the DOT language of the Graphviz graph drawing
75 software from Python.
76
77 %description -n python3-graphviz -l pl.UTF-8
78 Ten pakiet wspomaga tworzenie i renderowanie opisów grafów w języku
79 DOT oprogramowania do rysowania grafów Graphviz z poziomu Pythona.
80
81 %package apidocs
82 Summary:        API documentation for Python graphviz module
83 Summary(pl.UTF-8):      Dokumentacja API modułu Pythona graphviz
84 Group:          Documentation
85
86 %description apidocs
87 API documentation for Python graphviz module.
88
89 %description apidocs -l pl.UTF-8
90 Dokumentacja API modułu Pythona graphviz.
91
92 %prep
93 %setup -q -n graphviz-%{version}
94 %patch0 -p1
95
96 %build
97 %if %{with python2}
98 %py_build
99
100 %if %{with tests}
101 PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
102 PYTEST_PLUGINS="pytest_cov.plugin,pytest_mock" \
103 %{__python} -m pytest tests
104 %endif
105 %endif
106
107 %if %{with python3}
108 %py3_build
109
110 %if %{with tests}
111 PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
112 PYTEST_PLUGINS="pytest_cov.plugin,pytest_mock" \
113 %{__python3} -m pytest tests
114 %endif
115 %endif
116
117 %if %{with doc}
118 cd docs
119 sphinx-build-3 -b html . _build/html
120 %endif
121
122 %install
123 rm -rf $RPM_BUILD_ROOT
124
125 %if %{with python2}
126 %py_install
127
128 %py_postclean
129 %endif
130
131 %if %{with python3}
132 %py3_install
133 %endif
134
135 %if %{with python2}
136 install -d $RPM_BUILD_ROOT%{_examplesdir}/python-graphviz-%{version}
137 cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python-graphviz-%{version}
138 %{__sed} -i -e '1s,/usr/bin/env python,%{__python},' $RPM_BUILD_ROOT%{_examplesdir}/python-graphviz-%{version}/*.py
139 %endif
140 %if %{with python3}
141 install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-graphviz-%{version}
142 cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python3-graphviz-%{version}
143 %{__sed} -i -e '1s,/usr/bin/env python,%{__python3},' $RPM_BUILD_ROOT%{_examplesdir}/python3-graphviz-%{version}/*.py
144 %endif
145
146 %clean
147 rm -rf $RPM_BUILD_ROOT
148
149 %if %{with python2}
150 %files
151 %defattr(644,root,root,755)
152 %doc CHANGES.txt LICENSE.txt README.rst
153 %{py_sitescriptdir}/graphviz
154 %{py_sitescriptdir}/graphviz-%{version}-py*.egg-info
155 %{_examplesdir}/python-graphviz-%{version}
156 %endif
157
158 %if %{with python3}
159 %files -n python3-graphviz
160 %defattr(644,root,root,755)
161 %doc CHANGES.txt LICENSE.txt README.rst
162 %{py3_sitescriptdir}/graphviz
163 %{py3_sitescriptdir}/graphviz-%{version}-py*.egg-info
164 %{_examplesdir}/python3-graphviz-%{version}
165 %endif
166
167 %if %{with doc}
168 %files apidocs
169 %defattr(644,root,root,755)
170 %doc docs/_build/html/{_images,_static,*.html,*.js}
171 %endif
This page took 0.118676 seconds and 3 git commands to generate.