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: all:
python setup.py build $(PYTHON) setup.py build
.PHONY: all .PHONY: all
clean: clean:
python setup.py clean $(PYTHON) setup.py clean
.PHONY: clean .PHONY: clean
install: 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}) #ifeq (1,${DEBIANBUILD})
# cp *.py $(DESTDIR)/$(PYTHON_SITEARCH)/qubes/ # cp *.py $(DESTDIR)/$(PYTHON_SITEARCH)/qubes/
#else #else

View File

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

View File

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