Blob Blame History Raw
%bcond_without tests

%global pypi_name owlrl

%global _description %{expand:
A simple implementation of the OWL2 RL Profile, as well as a basic RDFS
inference, on top of RDFLib. Based mechanical forward chaining. The
distribution contains:

* scripts/RDFConvertService: can be used as a CGI script to invoke the
library. It may have to be adapted to the local server setup.
* scripts/owlrl: script that can be run locally on to transform a file into RDF
(on the standard output). Run the script with -h to get the available flags.}

Name:           python-owl_rl
Version:        5.2.1
Release:        6%{?dist}
Summary:        OWL-RL and RDFS based RDF Closure inferencing for Python

License:        W3C
URL:            https://github.com/RDFLib/OWL-RL
Source0:        https://github.com/RDFLib/OWL-RL/archive/v%{version}/%{pypi_name}-%{version}.tar.gz
# Updated license text from upstream
# Latest release still has the older version of the current license
Source1:        https://raw.githubusercontent.com/RDFLib/OWL-RL/master/LICENSE.txt

BuildArch:      noarch

%description %_description

%package -n python3-owl_rl
Summary:        %{summary}
BuildRequires:  python3-devel
BuildRequires:  %{py3_dist setuptools}
BuildRequires:  %{py3_dist rdflib}
BuildRequires:  %{py3_dist rdflib-jsonld}

%if %{with tests}
BuildRequires:  %{py3_dist pytest}
BuildRequires:  %{py3_dist lxml}
BuildRequires:  %{py3_dist pyyaml}
%endif

%py_provides python3-owl_rl
Obsoletes:		python3-owlrl <= 5.2.1-3


%description -n python3-owl_rl %_description

%package doc
Summary:        %{summary}

BuildRequires:  %{py3_dist sphinx}
BuildRequires:  %{py3_dist sphinx_rtd_theme}

%description doc %_description

%prep
%autosetup -n OWL-RL-%{version}
rm -rf %{pypi_name}.egg-info
find . -type f -name "*.py" -exec sed -i '/^#![  ]*\/usr\/bin\/env.*$/ d' {} 2>/dev/null ';'

# Remove unnecessary shebang from the file
sed -i '1d' owlrl/OWLRL.py

# Remove pathlib from install_requires from setup.py
sed -i -e 's/, "pathlib"//g' setup.py

# Replace the license with the updated license
# https://github.com/RDFLib/OWL-RL/commit/d1ab5e19ed1e537b06a4dbad50cc51c5d52db889
cp %{SOURCE1} ./

%build
%py3_build

# Build documentation
pushd docs
PYTHONPATH=. sphinx-build-3 source html
rm -rvf html/.buildinfo
rm -rvf html/.doctrees
popd

%install
%py3_install

%check
%if %{with tests}
# test_version_converter needs an internet connection, therefore disabled
%pytest -k 'not cls_maxqc1' \
    --deselect test/test_version_converter.py
%endif

%files -n python3-owl_rl
%doc README.rst
%license LICENSE.txt
%{python3_sitelib}/%{pypi_name}/
%{python3_sitelib}/owlrl-%{version}-py%{python3_version}.egg-info/
%{_bindir}/owlrl
%{_bindir}/RDFConvertService

%files doc
%license LICENSE.txt
%doc docs/html

%changelog
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 5.2.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Thu Jun 17 2021 Aniket Pradhan <major AT fedoraproject DOT org> - 5.2.1-5
- Fix Obsoletes version

* Thu Jun 17 2021 Aniket Pradhan <major AT fedoraproject DOT org> - 5.2.1-4
- Fix subpackage name

* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 5.2.1-3
- Rebuilt for Python 3.10

* Wed May 26 2021 Aniket Pradhan <major AT fedoraproject DOT org> - 5.2.1-2
- Fix description

* Mon May 10 2021 Aniket Pradhan <major AT fedoraproject DOT org> - 5.2.1-1
- Initial build