14
0
2021-07-08 10:08:45 +00:00
committed by Git OBS Bridge
parent 559ab08906
commit 13fc15ad99
4 changed files with 155 additions and 35 deletions

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-sortinghat
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -12,39 +12,50 @@
# 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/
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define binaries stackalytics2sh mozilla2sh mailmap2sh grimoirelab2sh gitdm2sh eclipse2sh sortinghat sh2mg mg2sh
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%bcond_without test
%define skip_python2 1
%define skip_python36 1
Name: python-sortinghat
Version: 0.4.3
Version: 0.7.15
Release: 0
License: GPL-3.0
Summary: A tool to manage identities
Url: https://github.com/grimoirelab/sortinghat
License: GPL-3.0-only
Group: Development/Languages/Python
Source: https://files.pythonhosted.org/packages/source/s/sortinghat/sortinghat-%{version}.tar.gz
BuildRequires: python-rpm-macros
BuildRequires: %{python_module devel}
URL: https://github.com/grimoirelab/sortinghat
Source0: https://files.pythonhosted.org/packages/source/s/sortinghat/sortinghat-%{version}.tar.gz
BuildRequires: %{python_module setuptools}
%if %{with test}
BuildRequires: %{python_module Jinja2}
BuildRequires: %{python_module pandas >= 0.17}
BuildRequires: %{python_module PyMySQL}
BuildRequires: %{python_module python-dateutil >= 2.6.0}
BuildRequires: %{python_module PyYAML >= 3.12}
BuildRequires: %{python_module SQLAlchemy >= 1.0.0}
%endif
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-Jinja2
Requires: python-pandas >= 0.17
Requires: python-PyMySQL
Requires: python-python-dateutil >= 2.6.0
Requires: python-PyMySQL >= 0.7.0
Requires: python-PyYAML >= 3.12
Requires: python-SQLAlchemy >= 1.0.0
Requires: python-SQLAlchemy >= 1.2
Requires: python-pandas >= 0.18.1
Requires: python-python-dateutil >= 2.6.0
Requires: python-requests >= 2.9
Requires: python-urllib3 >= 1.22
Requires(post): update-alternatives
Requires(postun):update-alternatives
BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module Jinja2}
BuildRequires: %{python_module PyMySQL >= 0.7.0}
BuildRequires: %{python_module PyYAML >= 3.12}
BuildRequires: %{python_module SQLAlchemy >= 1.2}
BuildRequires: %{python_module httpretty >= 0.9.5}
BuildRequires: %{python_module mock}
BuildRequires: %{python_module pandas >= 0.17}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module python-dateutil >= 2.6.0}
BuildRequires: %{python_module requests >= 2.9}
BuildRequires: mariadb-rpm-macros
# /SECTION
%python_subpackages
%description
@@ -73,26 +84,73 @@ to store the identities obtained into its database, and later merge them
into unique identities (and maybe affiliate them).
%prep
%setup -q -n sortinghat-%{version}
%autosetup -p1 -n sortinghat-%{version}
sed -i -e "s/\('pandoc'\|'wheel',\)//" -e 's/==/>=/' setup.py
%build
%python_build
%install
%python_install
for b in %{binaries}; do
%python_clone -a %{buildroot}%{_bindir}/$b
done
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
exit_code=0
user=auth_db_user
pass=auth_db_pass
port=63306
dbname=testhat
run_dir=/tmp/mysql
#
# start the mariadb server
#
%mysql_testserver_start -u $user -p $pass -t $port -d $dbname
#
# running the test
#
# this is read by TestDatabaseCaseBase.setUpClass
cat << EOF > tests/tests.conf
[Database]
name=$dbname
host=127.0.0.1
port=$port
user=$user
password=$pass
create=False
EOF
sed -i -e "s/'3306'/self.kwargs['port']/" tests/test_cmd_init.py
%pyunittest discover -b -v || exit_code=1
#
# stopping mariadb
#
%mysql_testserver_stop
exit $exit_code
%post
for b in %{binaries}; do
%python_install_alternative $b
done
%postun
for b in %{binaries}; do
%python_uninstall_alternative stackalytics2sh
done
%files %{python_files}
%doc NEWS README.md
%python3_only %{_bindir}/mg2sh
%python3_only %{_bindir}/sh2mg
%python3_only %{_bindir}/sortinghat
%python3_only %{_bindir}/eclipse2sh
%python3_only %{_bindir}/gitdm2sh
%python3_only %{_bindir}/grimoirelab2sh
%python3_only %{_bindir}/mailmap2sh
%python3_only %{_bindir}/mozilla2sh
%python3_only %{_bindir}/stackalytics2sh
%python_alternative %{_bindir}/mg2sh
%python_alternative %{_bindir}/sh2mg
%python_alternative %{_bindir}/sortinghat
%python_alternative %{_bindir}/eclipse2sh
%python_alternative %{_bindir}/gitdm2sh
%python_alternative %{_bindir}/grimoirelab2sh
%python_alternative %{_bindir}/mailmap2sh
%python_alternative %{_bindir}/mozilla2sh
%python_alternative %{_bindir}/stackalytics2sh
%{python_sitelib}/*
%changelog