|
|
1d88842 |
%global srcname asyncpg
|
|
|
1d88842 |
|
|
|
1d88842 |
Name: python-%{srcname}
|
|
|
1d88842 |
Summary: A fast PostgreSQL Database Client Library for Python/asyncio
|
|
|
1d88842 |
Version: 0.22.0
|
|
|
1d88842 |
Release: 2%{?dist}
|
|
|
1d88842 |
|
|
|
1d88842 |
License: ASL 2.0
|
|
|
1d88842 |
URL: https://github.com/MagicStack/%{srcname}
|
|
|
1d88842 |
Source0: %{pypi_source}
|
|
|
1d88842 |
# Temporary workaround; see https://github.com/MagicStack/asyncpg/pull/708.
|
|
|
1d88842 |
Source1: https://raw.githubusercontent.com/MagicStack/%{srcname}/v%{version}/docs/Makefile
|
|
|
1d88842 |
Source2: https://raw.githubusercontent.com/MagicStack/%{srcname}/v%{version}/docs/_static/theme_overrides.css
|
|
|
1d88842 |
|
|
|
1d88842 |
BuildRequires: gcc
|
|
|
1d88842 |
BuildRequires: python3-devel
|
|
|
1d88842 |
BuildRequires: python3dist(setuptools)
|
|
|
1d88842 |
BuildRequires: pyproject-rpm-macros
|
|
|
1d88842 |
BuildRequires: python3-docs
|
|
|
1d88842 |
|
|
|
1d88842 |
BuildRequires: make
|
|
|
1d88842 |
|
|
|
1d88842 |
# For tests:
|
|
|
1d88842 |
#
|
|
|
1d88842 |
# For pg_config binary
|
|
|
1d88842 |
BuildRequires: libpq-devel
|
|
|
1d88842 |
# For pg_ctl binary
|
|
|
1d88842 |
BuildRequires: postgresql-server
|
|
|
1d88842 |
# For citext extension
|
|
|
1d88842 |
BuildRequires: postgresql-contrib
|
|
|
1d88842 |
|
|
|
1d88842 |
# Note that asyncpg/pgproto comes from a git submodule referencing a separate
|
|
|
1d88842 |
# project, https://github.com/MagicStack/py-pgproto. However, we do not treat
|
|
|
1d88842 |
# it as a bundled dependency because it contains only sources; it has no build
|
|
|
1d88842 |
# system and is not designed for separate installation; and it is managed as a
|
|
|
1d88842 |
# part of the asyncpg package, as evidenced by the comment “This module is part
|
|
|
1d88842 |
# of asyncpg” in the file headers.
|
|
|
1d88842 |
|
|
|
1d88842 |
%global common_description %{expand:
|
|
|
1d88842 |
asyncpg is a database interface library designed specifically for PostgreSQL
|
|
|
1d88842 |
and Python/asyncio. asyncpg is an efficient, clean implementation of PostgreSQL
|
|
|
1d88842 |
server binary protocol for use with Python’s asyncio framework. You can read
|
|
|
1d88842 |
more about asyncpg in an introductory blog post
|
|
|
1d88842 |
http://magic.io/blog/asyncpg-1m-rows-from-postgres-to-python/.}
|
|
|
1d88842 |
|
|
|
1d88842 |
%description %{common_description}
|
|
|
1d88842 |
|
|
|
1d88842 |
|
|
|
1d88842 |
%generate_buildrequires
|
|
|
1d88842 |
%pyproject_buildrequires -x dev
|
|
|
1d88842 |
|
|
|
1d88842 |
|
|
|
1d88842 |
%package -n python3-%{srcname}
|
|
|
1d88842 |
Summary: %{summary}
|
|
|
1d88842 |
|
|
|
1d88842 |
Requires: python3-docs
|
|
|
1d88842 |
|
|
|
1d88842 |
|
|
|
1d88842 |
%description -n python3-%{srcname} %{common_description}
|
|
|
1d88842 |
|
|
|
1d88842 |
|
|
|
1d88842 |
%package doc
|
|
|
1d88842 |
Summary: Documentation for %{name}
|
|
|
1d88842 |
|
|
|
1d88842 |
BuildArch: noarch
|
|
|
1d88842 |
|
|
|
1d88842 |
%description doc %{common_description}
|
|
|
1d88842 |
|
|
|
1d88842 |
|
|
|
1d88842 |
%prep
|
|
|
1d88842 |
%autosetup -n %{srcname}-%{version}
|
|
|
1d88842 |
rm -rvf %{srcname}.egg-info
|
|
|
1d88842 |
|
|
|
1d88842 |
# Remove pre-generated C sources from Cython to ensure they are re-generated
|
|
|
1d88842 |
# and not used in the build. Note that recordobj.c is not a generated source,
|
|
|
1d88842 |
# and must not be removed!
|
|
|
1d88842 |
find %{srcname} -type f -name '*.c' ! -name 'recordobj.c' -print -delete
|
|
|
1d88842 |
|
|
|
1d88842 |
# Loosen pinned versions in setup.py
|
|
|
1d88842 |
sed -r -i 's/~=/>=/g' setup.py
|
|
|
1d88842 |
|
|
|
1d88842 |
cp -p '%{SOURCE1}' docs/
|
|
|
1d88842 |
mkdir -p docs/_static
|
|
|
1d88842 |
cp -p '%{SOURCE2}' docs/_static/
|
|
|
1d88842 |
|
|
|
1d88842 |
# Use local inventory in intersphinx mapping:
|
|
|
1d88842 |
sed -r -i 's|https://docs.python.org/3|/%{_docdir}/python3-docs/html|' \
|
|
|
1d88842 |
docs/conf.py
|
|
|
1d88842 |
|
|
|
1d88842 |
|
|
|
1d88842 |
%build
|
|
|
1d88842 |
%set_build_flags
|
|
|
1d88842 |
%py3_build
|
|
|
1d88842 |
|
|
|
1d88842 |
# Temporary local installation so we can import the Cython extension module to
|
|
|
1d88842 |
# build documentation:
|
|
|
1d88842 |
PYROOT="${PWD}/%{_vpath_builddir}/pyroot"
|
|
|
1d88842 |
%{__python3} %{py_setup} %{?py_setup_args} install \
|
|
|
1d88842 |
-O1 --skip-build --root "${PYROOT}"
|
|
|
1d88842 |
export PYTHONPATH="${PYROOT}%{python3_sitearch}"
|
|
|
1d88842 |
|
|
|
1d88842 |
%make_build -C docs html \
|
|
|
1d88842 |
SPHINXBUILD='sphinx-build' \
|
|
|
1d88842 |
SPHINXOPTS='%{?_smp_mflags}'
|
|
|
1d88842 |
rm -vf docs/_build/html/.buildinfo docs/_build/html/.nojekyll
|
|
|
1d88842 |
|
|
|
1d88842 |
|
|
|
1d88842 |
%install
|
|
|
1d88842 |
%py3_install
|
|
|
1d88842 |
# The Cython implementation files (.pyx) and Cython-generated C sources (.c)
|
|
|
1d88842 |
# are included in the installed package. These are definitely not needed.
|
|
|
1d88842 |
#
|
|
|
1d88842 |
# The C header files (.h) and Cython definition files (.pxd) would be needed to
|
|
|
1d88842 |
# compile Cython extension code using the internal APIs of the package. The
|
|
|
1d88842 |
# upstream documentation does not indicate that this is an intended use, so we
|
|
|
1d88842 |
# do not ship them. If we did, we would need to put them in a new subpackage
|
|
|
1d88842 |
# called python3-%%{srcname}-devel.
|
|
|
1d88842 |
find %{buildroot}%{python3_sitearch} -type f \( \
|
|
|
1d88842 |
-name '*.pyx' -o -name '*.c' \
|
|
|
1d88842 |
-o -name '*.pxd' -o -name '*.h' \
|
|
|
1d88842 |
\) -print -delete
|
|
|
1d88842 |
|
|
|
1d88842 |
|
|
|
1d88842 |
%check
|
|
|
1d88842 |
# It is not clear why the tests always import asyncpg as ../asyncpg/__init__.py
|
|
|
1d88842 |
# even if we set PYTHONPATH to the installed sitearch directory. This
|
|
|
1d88842 |
# workaround is ugly, but there is nothing actually wrong with it, as the
|
|
|
1d88842 |
# install is already done by the time the check section runs:
|
|
|
1d88842 |
rm -rf %{srcname}
|
|
|
1d88842 |
ln -s %{buildroot}%{python3_sitearch}/%{srcname}/
|
|
|
1d88842 |
|
|
|
1d88842 |
# Do not run flake8 code style tests (which may fail)
|
|
|
1d88842 |
k='not TestFlake8'
|
|
|
1d88842 |
|
|
|
1d88842 |
%pytest -k "${k}"
|
|
|
1d88842 |
|
|
|
1d88842 |
|
|
|
1d88842 |
%files -n python3-%{srcname}
|
|
|
1d88842 |
%license LICENSE
|
|
|
1d88842 |
%{python3_sitearch}/%{srcname}
|
|
|
1d88842 |
%{python3_sitearch}/%{srcname}-%{version}-py%{python3_version}.egg-info
|
|
|
1d88842 |
|
|
|
1d88842 |
|
|
|
1d88842 |
%files doc
|
|
|
1d88842 |
%license LICENSE
|
|
|
1d88842 |
%doc README.rst
|
|
|
1d88842 |
%doc docs/_build/html
|
|
|
1d88842 |
|
|
|
1d88842 |
|
|
|
1d88842 |
%changelog
|
|
|
1d88842 |
* Wed Mar 03 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 0.22.0-2
|
|
|
1d88842 |
- Fix intersphinx inventory path
|
|
|
1d88842 |
|
|
|
1d88842 |
* Tue Mar 02 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 0.22.0-1
|
|
|
1d88842 |
- Initial package
|