rpm: packge qubesimgconverter for both python2 and python3

And while at it, move it to separate subpackages, following Fedora
packaging guidelines.
This commit is contained in:
Marek Marczykowski-Górecki 2017-05-17 15:19:01 +02:00
parent 1db0daea9c
commit 6c36cb8de9
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
3 changed files with 39 additions and 15 deletions

View File

@ -1,13 +1,15 @@
PYTHON ?= python
all:
python setup.py build
$(PYTHON) setup.py build
.PHONY: all
clean:
python setup.py clean
$(PYTHON) setup.py clean
.PHONY: clean
install:
python setup.py install -O1 --skip-build $(PYTHON_PREFIX_ARG) --root $(DESTDIR)
$(PYTHON) setup.py install -O1 $(PYTHON_PREFIX_ARG) --root $(DESTDIR)
#ifeq (1,${DEBIANBUILD})
# cp *.py $(DESTDIR)/$(PYTHON_SITEARCH)/qubes/
#else

View File

@ -197,7 +197,7 @@ expects header+RGBA on stdin. This method is invoked from qvm-imgconverter-clien
try:
sys.stdout.write(open(filename).read())
except Exception, e:
except Exception as e:
raise Exception('Something went wrong: {0!s}'.format(e))
finally:
sys.stdout.close()

View File

@ -3,8 +3,6 @@
%define _builddir %(pwd)
%endif
%{!?python_sitepath: %define python_sitepath %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(0)")}
Name: qubes-utils
Version: %{version}
Release: 1%{?dist}
@ -17,7 +15,7 @@ URL: http://www.qubes-os.org
Requires: udev
Requires: %{name}-libs
Requires: ImageMagick
Requires: pycairo
Requires: python3-qubesimgconverter
BuildRequires: qubes-libvchan-devel
BuildRequires: python-setuptools
# for meminfo-writer
@ -26,6 +24,22 @@ BuildRequires: xen-devel
%description
Common Linux files for Qubes Dom0 and VM
%package -n python2-qubesimgconverter
Summary: Python package qubesimgconverter
Requires: python
Requires: pycairo
%description -n python2-qubesimgconverter
Python package qubesimgconverter
%package -n python3-qubesimgconverter
Summary: Python package qubesimgconverter
Requires: python3
Requires: python3-cairo
%description -n python3-qubesimgconverter
Python package qubesimgconverter
%package devel
Summary: Development headers for qubes-utils
Release: 1%{?dist}
@ -53,7 +67,9 @@ ln -sf . %{name}-%{version}
make all
%install
make install DESTDIR=%{buildroot}
make install DESTDIR=%{buildroot} PYTHON=%{__python2}
rm -rf imgconverter/build
%make_install -C imgconverter PYTHON=%{__python3}
%post
# dom0
@ -80,13 +96,19 @@ rm -rf $RPM_BUILD_ROOT
%{_sbindir}/meminfo-writer
%{_unitdir}/qubes-meminfo-writer.service
%{_unitdir}/qubes-meminfo-writer-dom0.service
#%{python_sitearch}/qubes/__init__.py
#%{python_sitearch}/qubes/__init__.pyc
#%{python_sitearch}/qubes/__init__.pyo
%{python_sitepath}/qubesimgconverter/__init__.py*
%{python_sitepath}/qubesimgconverter/imggen.py*
%{python_sitepath}/qubesimgconverter/test.py*
%{python_sitepath}/qubesimgconverter-%{version}-py?.?.egg-info/*
%files -n python2-qubesimgconverter
%{python_sitelib}/qubesimgconverter/__init__.py*
%{python_sitelib}/qubesimgconverter/imggen.py*
%{python_sitelib}/qubesimgconverter/test.py*
%{python_sitelib}/qubesimgconverter-%{version}-py?.?.egg-info/*
%files -n python3-qubesimgconverter
%{python3_sitelib}/qubesimgconverter/__init__.py
%{python3_sitelib}/qubesimgconverter/imggen.py
%{python3_sitelib}/qubesimgconverter/test.py
%{python3_sitelib}/qubesimgconverter-%{version}-py?.?.egg-info/*
%{python3_sitelib}/qubesimgconverter/__pycache__
%files libs
%{_libdir}/libqrexec-utils.so.2