File python-SQLObject.spec of Package python-SQLObject

#
# spec file for package python-SQLObject
#
# Copyright (c) 2020 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#


%define         tarname sqlobject
%define         oldpython python
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name:           python-SQLObject
Version:        3.8.0
Release:        0
Summary:        Object-Relational Manager, aka database wrapper
License:        LGPL-3.0-or-later
Group:          Development/Languages/Python
URL:            http://sqlobject.org/
Source:         https://github.com/sqlobject/sqlobject/archive/%{tarname}-%{version}.tar.gz
BuildRequires:  %{python_module FormEncode >= 1.3.1}
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module setuptools}
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
Requires:       python-PyDispatcher >= 2.0.4
Requires:       python-FormEncode >= 1.3.1
Requires(post):   update-alternatives
Requires(postun): update-alternatives
%ifpython2
Provides:       %{oldpython}-sqlobject = %{version}
Obsoletes:      %{oldpython}-sqlobject < %{version}
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
%python_subpackages

%description
SQLObject is a popular *Object Relational Manager* for providing an
object interface to your database, with tables as classes, rows as
instances, and columns as attributes.

SQLObject includes a Python-object-based query language that makes SQL
more abstract, and provides substantial database independence for
applications.

Supports MySQL, PostgreSQL, SQLite, Firebird, Sybase, MSSQL and MaxDB (SAPDB).

%prep
%setup -q -n %{tarname}-%{version}
sed -i "s|#!%{_bindir}/env.*||g" sqlobject/manager/command.py     # Fix non-executable script
sed -i "s|%{_bindir}/env python|%{_bindir}/python|g" docs/test.py # not use env 
sed -i "s|||g" docs/presentation-2004-11/ui/print.css           # no DOS
find . -name ".gitignore" -delete                                 # not needed

%build
%python_build

%install
%python_install
%python_clone -a %{buildroot}%{_bindir}/sqlobject-admin
%python_clone -a %{buildroot}%{_bindir}/sqlobject-convertOldURI

%python_expand %fdupes %{buildroot}%{$python_sitelib}

%post
%{python_install_alternative   sqlobject-admin sqlobject-convertOldURI}

%postun
%{python_uninstall_alternative sqlobject-admin sqlobject-convertOldURI}

%files %{python_files}
%defattr(-,root,root)
%doc ANNOUNCE.rst docs README.rst
%license LICENSE
%{_bindir}/sqlobject-*%{python_bin_suffix}
%python_alternative %{_bindir}/sqlobject-admin
%python_alternative %{_bindir}/sqlobject-convertOldURI
%{python_sitelib}/*

%changelog
openSUSE Build Service is sponsored by