]>
Commit | Line | Data |
---|---|---|
d4085243 | 1 | # TODO: |
d4085243 MK |
2 | # Move man dir to proper place ? |
3 | ||
4 | # NOTE: | |
ab906c73 MK |
5 | # Not sure if should be build as separate packages for py 3.x / 2.x with different binaries? Same conflicting binaries? |
6 | # Are modules used by other soft? If not, just switch to py 3.x ? | |
d4085243 MK |
7 | |
8 | # Conditional build: | |
9 | %bcond_with doc # don't build doc | |
10 | %bcond_without tests # do not perform "make test" | |
11 | %bcond_without python2 # CPython 2.x module | |
ab906c73 | 12 | %bcond_without python3 # CPython 3.x module |
d4085243 MK |
13 | |
14 | %define module pgactivity | |
15 | Summary: - | |
16 | Summary(pl.UTF-8): - | |
17 | # Name must match the python module/package name (as in 'import' statement) | |
18 | Name: pg_activity | |
ab906c73 MK |
19 | Version: 1.3.0 |
20 | Release: 1 | |
d4085243 MK |
21 | License: distributable |
22 | Group: Libraries/Python | |
23 | Source0: https://github.com/julmon/pg_activity/archive/v%{version}.tar.gz | |
ab906c73 | 24 | # Source0-md5: 88096354973c38761f056d04e550f58b |
d4085243 MK |
25 | URL: https://github.com/julmon/pg_activity |
26 | BuildRequires: rpm-pythonprov | |
27 | # remove BR: python-devel for 'noarch' packages. | |
28 | # if py_postclean is used | |
29 | BuildRequires: rpmbuild(macros) >= 1.219 | |
30 | # if py3* macros are used | |
31 | BuildRequires: rpmbuild(macros) >= 1.612 | |
32 | # when using /usr/bin/env or other in-place substitutions | |
33 | #BuildRequires: sed >= 4.0 | |
34 | # when python3 present | |
35 | %if %{with python2} | |
36 | BuildRequires: python-psutil | |
37 | BuildRequires: python-psycopg2 >= 2.2.1 | |
38 | BuildRequires: python-setuptools | |
39 | %endif | |
40 | %if %{with python3} | |
41 | BuildRequires: python3-modules | |
42 | BuildRequires: python3-psutil | |
43 | BuildRequires: python3-psycopg2 >= 2.2.1 | |
44 | BuildRequires: python3-setuptools | |
45 | %endif | |
46 | # Below Rs only work for main package (python2) | |
47 | #Requires: python-libs | |
48 | Requires: python-modules | |
ab906c73 MK |
49 | Requires: python-psutil |
50 | Requires: python-psycopg2 | |
d4085243 MK |
51 | BuildArch: noarch |
52 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
53 | ||
54 | %description | |
55 | htop like application for PostgreSQL server activity monitoring | |
56 | ||
57 | %description -l pl.UTF-8 | |
58 | Podobna do htop aplikacja monitorująca aktywność PostgresSQL | |
59 | ||
60 | %package -n python3-%{module} | |
61 | Summary: - | |
62 | Summary(pl.UTF-8): - | |
63 | Group: Libraries/Python | |
64 | Requires: python3-modules | |
ab906c73 MK |
65 | Requires: python3-psutil |
66 | Requires: python3-psycopg2 | |
d4085243 MK |
67 | |
68 | %description -n python3-%{module} | |
69 | ||
70 | %description -n python3-%{module} -l pl.UTF-8 | |
71 | ||
72 | %package apidocs | |
73 | Summary: %{module} API documentation | |
74 | Summary(pl.UTF-8): Dokumentacja API %{module} | |
75 | Group: Documentation | |
76 | ||
77 | %description apidocs | |
78 | API documentation for %{module}. | |
79 | ||
80 | %description apidocs -l pl.UTF-8 | |
81 | Dokumentacja API %{module}. | |
82 | ||
83 | %prep | |
84 | # %setup -q -n %{module}-%{version} | |
85 | %setup -q | |
86 | ||
87 | # setup copy of source in py3 dir | |
88 | set -- * | |
89 | install -d py3 | |
90 | cp -a "$@" py3 | |
91 | ||
92 | %build | |
93 | %if %{with python2} | |
94 | %{__python} setup.py build --build-base build-2 %{?with_tests:test} --with-man | |
95 | %endif | |
96 | ||
97 | %if %{with python3} | |
98 | %{__python3} setup.py build --build-base build-3 %{?with_tests:test} --with-man | |
99 | %endif | |
100 | ||
101 | %if %{with doc} | |
102 | cd docs | |
103 | %{__make} -j1 html | |
104 | rm -rf _build/html/_sources | |
105 | %endif | |
106 | ||
107 | %install | |
108 | rm -rf $RPM_BUILD_ROOT | |
109 | ||
110 | %if %{with python2} | |
111 | %{__python} setup.py \ | |
112 | build --build-base build-2 \ | |
113 | install --skip-build \ | |
114 | --optimize=2 \ | |
115 | --root=$RPM_BUILD_ROOT | |
116 | ||
117 | %py_postclean | |
118 | %endif | |
119 | ||
120 | %if %{with python3} | |
121 | %{__python3} setup.py \ | |
122 | build --build-base build-3 \ | |
123 | install --skip-build \ | |
124 | --optimize=2 \ | |
125 | --root=$RPM_BUILD_ROOT | |
126 | %endif | |
127 | ||
128 | ||
129 | %clean | |
130 | rm -rf $RPM_BUILD_ROOT | |
131 | ||
132 | %if %{with python2} | |
133 | %files | |
134 | %defattr(644,root,root,755) | |
135 | %doc README.md docs | |
136 | %dir %{py_sitescriptdir}/%{module} | |
137 | %{py_sitescriptdir}//%{module}/*.py[co] | |
138 | %attr(755,root,root) %{_bindir}/pg_activity | |
139 | %if "%{py_ver}" > "2.4" | |
140 | %{py_sitescriptdir}/%{name}-%{version}-py*.egg-info | |
141 | %endif | |
142 | %endif | |
143 | ||
144 | %if %{with python3} | |
145 | %files -n python3-%{module} | |
146 | %defattr(644,root,root,755) | |
147 | %doc README.md docs | |
148 | %{py3_sitescriptdir}/%{module} | |
ab906c73 | 149 | %{py3_sitescriptdir}/%{name}-%{version}-py*.egg-info |
d4085243 MK |
150 | %endif |
151 | ||
152 | %if %{with doc} | |
153 | %files apidocs | |
154 | %defattr(644,root,root,755) | |
155 | %doc docs/_build/html/* | |
156 | %endif |