simplify spec file

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
This commit is contained in:
Igor Gnatenko 2017-11-04 10:22:24 +01:00
parent 7d41db3e38
commit 880e6417a5

View File

@ -47,7 +47,7 @@ Summary: Library with cross-python path, ini-parsing, io, code, log facil
BuildRequires: python2-devel BuildRequires: python2-devel
BuildRequires: python2-setuptools BuildRequires: python2-setuptools
%if %{with docs} %if %{with docs}
BuildRequires: python-sphinx BuildRequires: %{_bindir}/sphinx-build-2
%endif # with_docs %endif # with_docs
%if %{with tests} %if %{with tests}
BuildRequires: python2-pytest >= %{pytest_version_lb}, python2-pytest < %{pytest_version_ub} BuildRequires: python2-pytest >= %{pytest_version_lb}, python2-pytest < %{pytest_version_ub}
@ -75,7 +75,7 @@ Summary: Library with cross-python path, ini-parsing, io, code, log facil
BuildRequires: python3-devel BuildRequires: python3-devel
BuildRequires: python3-setuptools BuildRequires: python3-setuptools
%if %{with docs} %if %{with docs}
BuildRequires: python3-sphinx BuildRequires: %{_bindir}/sphinx-build-3
%endif # with_docs %endif # with_docs
%if %{with tests} %if %{with tests}
BuildRequires: python3-pytest >= %{pytest_version_lb}, python3-pytest < %{pytest_version_ub} BuildRequires: python3-pytest >= %{pytest_version_lb}, python3-pytest < %{pytest_version_ub}
@ -98,100 +98,59 @@ following tools and modules:
%endif %endif
%prep %prep
%setup -qc -n %{srcname}-%{version} %autosetup -n %{srcname}-%{version}
pushd %{srcname}-%{version}
# remove shebangs and fix permissions # remove shebangs and fix permissions
find -type f -a \( -name '*.py' -o -name 'py.*' \) \ find -type f -a \( -name '*.py' -o -name 'py.*' \) \
-exec sed -i '1{/^#!/d}' {} \; \ -exec sed -i '1{/^#!/d}' {} \; \
-exec chmod u=rw,go=r {} \; -exec chmod u=rw,go=r {} \;
popd
mv %{srcname}-%{version} python2
cp -a python2 python3
%build %build
%if %{with python2}
pushd python2
%py2_build %py2_build
%if %{with docs}
make -C doc html PYTHONPATH=$(pwd)
%endif # with_docs
popd
%endif
%if %{with python3}
pushd python3
%py3_build %py3_build
%if %{with docs} %if %{with docs}
make -C doc html PYTHONPATH=$(pwd) SPHINXBUILD=sphinx-build-3 export PYTHONPATH=$(pwd)
%endif # with_docs pushd doc
sphinx-build-2 -b html -d _build-2/doctrees . _build-2/html
sphinx-build-3 -b html -d _build-3/doctrees . _build-3/html
popd popd
%endif %endif # with_docs
%install %install
%if %{with python2}
pushd python2
%py2_install %py2_install
# remove hidden file
rm -rf doc/_build/html/.buildinfo
popd
%endif
%if %{with python3}
pushd python3
%py3_install %py3_install
# remove hidden file # remove hidden file
rm -rf doc/_build/html/.buildinfo rm -rf doc/_build/html/.buildinfo
popd
%endif
%check %check
%if %{with tests} %if %{with tests}
%if %{with python2}
# disable failing Subversion checks for now # disable failing Subversion checks for now
pushd python2
PYTHONPATH=%{buildroot}%{python2_sitelib} \ PYTHONPATH=%{buildroot}%{python2_sitelib} \
LC_ALL="en_US.UTF-8" \ LC_ALL="en_US.UTF-8" \
py.test-%{python2_version} -r s -k"-TestWCSvnCommandPath" testing py.test-%{python2_version} -r s -k"-TestWCSvnCommandPath" testing
popd
%endif
%if %{with python3}
pushd python3
PYTHONPATH=%{buildroot}%{python3_sitelib} \ PYTHONPATH=%{buildroot}%{python3_sitelib} \
LC_ALL="en_US.UTF-8" \ LC_ALL="en_US.UTF-8" \
py.test-%{python3_version} -r s -k"-TestWCSvnCommandPath" testing py.test-%{python3_version} -r s -k"-TestWCSvnCommandPath" testing
popd
%endif
%endif # with tests %endif # with tests
%if %{with python2}
%files -n python2-%{srcname} %files -n python2-%{srcname}
%doc python2/CHANGELOG %doc CHANGELOG
%doc python2/README.rst %doc README.rst
%license python2/LICENSE %license LICENSE
%if %{with docs} %if %{with docs}
%doc python2/doc/_build/html %doc doc/_build-2/html
%endif # with_docs %endif # with_docs
%{python2_sitelib}/* %{python2_sitelib}/*
%endif
%if %{with python3}
%files -n python3-%{srcname} %files -n python3-%{srcname}
%doc python3/CHANGELOG %doc CHANGELOG
%doc python3/README.rst %doc README.rst
%license python3/LICENSE %license LICENSE
%if %{with docs} %if %{with docs}
%doc python3/doc/_build/html %doc doc/_build-3/html
%endif # with_docs %endif # with_docs
%{python3_sitelib}/* %{python3_sitelib}/*
%endif
%changelog %changelog
* Fri Nov 03 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 1.4.34-6 * Fri Nov 03 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 1.4.34-6