# this upstream supports Python 3 but one of its dependents (python-ctypeslib) # does not #%%if 0%%{?fedora} #%%global with_python3 1 #%%endif Name: python-cusepy Version: 0.1 Release: 0.2.20101019git%{?dist} Summary: Character device in userspace driver library for Python 2 BuildArch: noarch License: BSD URL: https://code.google.com/p/cusepy/ Source0: https://cusepy.googlecode.com/archive/3d63cd65c0704aabae0fa8e6e2bf561217d5a6ed.tar.gz BuildRequires: python2-devel BuildRequires: fuse-devel BuildRequires: libattr-devel BuildRequires: gccxml BuildRequires: python-ctypeslib %if 0%{?with_python3} BuildRequires: python3-devel BuildRequires: python3-tools %endif Requires: fuse-libs Requires: libattr %if 0%{?fedora} #for cuse.ko Requires: kernel-modules-extra %endif %description Character device in userspace (CUSE) driver library for Python 2. %if 0%{?with_python3} %package -n python3-cusepy Summary: Character device in userspace bindings for Python 3 %description -n python3-cusepy Character device in userspace (CUSE) driver library for Python 3. %endif %prep %setup -q -n cusepy-3d63cd65c070 %if 0%{?with_python3} rm -rf %{py3dir} cp -a . %{py3dir} find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|' expand %{py3dir}/setup.py > _setup.tmp mv _setup.tmp %{py3dir}/setup.py %endif find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python}|' %build # Remove CFLAGS=... for noarch packages (unneeded) CFLAGS="%{optflags}" %{__python} setup.py build %if 0%{?with_python3} pushd %{py3dir} CFLAGS="%{optflags}" %{__python3} setup.py build popd %endif head -n16 setup.py > LICENSE %install rm -rf %{buildroot} # Must do the python3 install first because the scripts in /usr/bin are # overwritten with every setup.py install (and we want the python2 version # to be the default for now). %if 0%{?with_python3} pushd %{py3dir} %{__python} setup.py install --skip-build --root %{buildroot} popd %endif %{__python} setup.py install -O1 --skip-build --root %{buildroot} %files %doc LICENSE README.txt cuse_example.py %{python_sitelib}/cuse %{python_sitelib}/cusepy*.egg-info %if 0%{?with_python3} %files -n python3-cusepy %doc LICENSE README.txt cuse_example.py %{python3_sitelib}/cuse %endif %changelog * Wed Feb 25 2015 T.C. Hollingsworth - 0.1-0.2.20101019git - use %%{*python*} since %%{*python2*} are unavailable on EL6 * Wed Feb 25 2015 T.C. Hollingsworth - 0-0.1.20101019git - initial package