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