File python-python-docx.spec of Package python-python-docx
#
# spec file for package python-python-docx
#
# Copyright (c) 2019 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2019 LISA GmbH, Bingen, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
%bcond_without docs
%bcond_without tests
%define modname docx
%define tarname python-%{modname}
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-%{tarname}
Version: 0.8.11
Release: 0
License: MIT
Summary: Create and modify Word documents with Python
Group: Development/Languages/Python
URL: https://github.com/python-openxml/python-docx
Source: https://files.pythonhosted.org/packages/source/p/%{tarname}/%{tarname}-%{version}.tar.gz
BuildRequires: %{python_module devel}
BuildRequires: %{python_module lxml}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
%if %{with docs}
BuildRequires: %{python_module Sphinx}
%endif
%if %{with tests}
BuildRequires: %{python_module mock}
BuildRequires: %{python_module pyparsing}
BuildRequires: %{python_module pytest}
Suggests: %{name}-doc
%endif
BuildArch: noarch
Requires: %{python_module lxml}
%python_subpackages
%description
This package is a Python library for creating and updating Microsoft Word (.docx) files.
%if %{with docs}
%package -n %{name}-doc
Summary: Documentation for %{name}
Group: Development/Languages/Python
Requires: %{name} = %{version}
%description -n %{name}-doc
This package contains documentation files for %{name}.
%endif
%prep
%setup -q -n %{tarname}-%{version}
# tidy package: delete .gitignore and a stray .orig file, proper newlines in doc sources
find . -name .gitignore -delete
find docs -name \*.rst -exec sed -i 's/\r//' {} \;
rm docs/_themes/armstrong/theme.conf.orig
%build
%python_build
%if %{with docs}
python3 setup.py build_sphinx && rm build/sphinx/html/.buildinfo
# %%doc doesn't deal with hardlinks properly yet(?!?), symlink dupes :-(
%fdupes -s build/sphinx/html
%endif
%install
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%if %{with tests}
%check
%pytest
%endif
%files %{python_files}
%defattr(-,root,root,-)
%license LICENSE
%doc README.rst HISTORY.rst
%{python_sitelib}/%{modname}
%{python_sitelib}/python_%{modname}-%{version}-py%{python_version}.egg-info
%if %{with docs}
%files -n %{name}-doc
%defattr(-,root,root,-)
%doc build/sphinx/html
%endif
%changelog