Sophie

Sophie

distrib > Mageia > 9 > armv7hl > media > core-release-src > by-pkgid > a4aea6b3cc5f627b8845c83d5b04fb0b > files > 2

python-pygresql-5.2.3-2.mga9.src.rpm

%global srcname	PyGreSQL
%global module	pygresql
%global pgver	11

# Tests are disabled by default because PostgreSQL must be configured
# properly for the time zone the unit tests expect to pass.
%bcond_with tests

Name:		python-%{module}
Version:	5.2.3
Release:	%mkrel 2
Summary:	A Python client library for PostgreSQL

Group:		Development/Python
URL:		http://www.pygresql.org/
# Author states his intention is to dual license under PostgreSQL or Python
# licenses --- this is not too clear from the current tarball documentation,
# but hopefully will be clearer in future releases.
# The PostgreSQL license is very similar to other MIT licenses, but the OSI
# recognizes it as an independent license, so we do as well.
License:	PostgreSQL or Python
Source0:	%{pypi_source}

BuildRequires:	postgresql-devel >= %{pgver}
BuildRequires:	python3-devel
BuildRequires:  python3-setuptools

%if %{with tests}
BuildRequires:	postgresql-server >= %{pgver}
%endif

%description
PostgreSQL is an advanced Object-Relational database management system.
The PyGreSQL package provides a module for developers to use when writing
Python code for accessing a PostgreSQL database.

%package -n python3-%{module}
Summary:	A Python client library for PostgreSQL
Group:		Development/Python
%{?python_provide:%python_provide python3-%{srcname}}
%{?python_provide:%python_provide python3-%{module}}
Obsoletes:	python3-%{srcname} < 5.1

%description -n python3-%{module}
PostgreSQL is an advanced Object-Relational database management system.
The PyGreSQL package provides a module for developers to use when writing
Python code for accessing a PostgreSQL database.

%prep
%setup -q -n %{srcname}-%{version}

# PyGreSQL releases have execute bits on all files
find -type f -exec chmod 644 {} +

%build
%py3_build

%install
%py3_install

%if %{with tests}
%check
pgdatadir=datadir
pghost=/tmp
pgport=54321
pgdb=unittest

pg_start ()
{
	initdb "$pgdatadir" -U $(id -u -n) \
		--auth-local=peer --auth-host=ident
	pg_ctl -D "$pgdatadir" -l logfile start -o "-k $pghost -p $pgport" -w
}

pg_stop ()
{
	pg_ctl -D "$pgdatadir" stop
}

pg_createdb ()
{
	createdb -h $pghost -p $pgport "$@"
}

pg_start
pg_createdb "$pgdb"
trap pg_stop EXIT

cat > LOCAL_PyGreSQL.py <<EOF
dbname = '$pgdb'
dbhost = '$pghost'
dbport = $pgport
EOF

%{__python3} setup.py test
%endif

%files -n python3-%{module}
%license docs/copyright.rst
%doc docs/*.rst
%{python3_sitearch}/*.so
%{python3_sitearch}/*.py
%{python3_sitearch}/__pycache__/*.py{c,o}
%{python3_sitearch}/*.egg-info


%changelog
* Sat Mar 19 2022 umeabot <umeabot> 5.2.3-2.mga9
+ Revision: 1799275
- Mageia 9 Mass Rebuild

* Tue Feb 22 2022 mrambo3501 <mrambo3501> 5.2.3-1.mga9
+ Revision: 1783181
- version 5.2.3
- fixed Source0
- rebuild for python-3.10

* Mon Apr 19 2021 daviddavid <daviddavid> 5.1-3.mga9
+ Revision: 1717110
- rebuild for python 3.9

* Sun Feb 16 2020 umeabot <umeabot> 5.1-2.mga8
+ Revision: 1533451
- Mageia 8 Mass Rebuild

* Sat Sep 21 2019 wally <wally> 5.1-1.mga8
+ Revision: 1444510
- use lower case src pkg name
- new version 5.1
- drop python2 support

* Mon Jan 07 2019 shlomif <shlomif> 5.0.6-1.mga7
+ Revision: 1350964
- Rebuild for python3 3.7

* Sun Sep 23 2018 umeabot <umeabot> 5.0.4-2.mga7
+ Revision: 1300565
- Mageia 7 Mass Rebuild

* Sat Aug 05 2017 pterjan <pterjan> 5.0.4-1.mga7
+ Revision: 1136978
- Update to 5.0.4 to support python 3.6
- Rebuild for python 3.6

* Sun May 01 2016 ngompa <ngompa> 5.0-3.mga6
+ Revision: 1008475
- imported package python-PyGreSQL