加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
python-psycopg2.spec 6.40 KB
一键复制 编辑 原始数据 按行查看 历史
zhanliwen 提交于 2020-06-20 13:43 . Update verion to 2.8.5
%bcond_with python2
%bcond_without python3
%bcond_with python2_debug
%bcond_without python3_debug
%bcond_without tests
%global srcname psycopg2
%global sum A PostgreSQL database adapter for Python
%global desc Psycopg is the most popular PostgreSQL adapter for the Python \
programming language. At its core it fully implements the Python DB \
API 2.0 specifications. Several extensions allow access to many of the \
features offered by PostgreSQL.
%global python_runtimes \\\
%{?with_python2:python2} \\\
%{?with_python2_debug:python2-debug} \\\
%{?with_python3:python3} \\\
%{?with_python3_debug:python3-debug}
%{!?with_python2:%{!?with_python3:%{error:one python version needed}}}
Summary: %{sum}
Name: python-%{srcname}
Version: 2.8.5
Release: 1%{?dist}
# The exceptions allow linking to OpenSSL and PostgreSQL's libpq
License: LGPLv3+ with exceptions
Url: http://initd.org/psycopg/
Source0: http://initd.org/psycopg/tarballs/PSYCOPG-2-8/psycopg2-%{version}.tar.gz
%{?with_python2:BuildRequires: python2-devel python2-setuptools}
%{?with_python3:BuildRequires: python3-devel python3-setuptools}
%{?with_python2_debug:BuildRequires: python2-debug}
%{?with_python3_debug:BuildRequires: python3-debug}
BuildRequires: gcc
BuildRequires: pkgconfig(libpq)
# For testsuite
%if %{with tests}
BuildRequires: postgresql-test-rpm-macros
%endif
Conflicts: python-psycopg2-zope < %{version}
%description
%{desc}
%if %{with python2}
%package -n python2-%{srcname}
%{?python_provide:%python_provide python2-%{srcname}}
Summary: %{sum} 2
%description -n python2-%{srcname}
%{desc}
%package -n python2-%{srcname}-tests
Summary: A testsuite for %sum 2
Requires: python2-%srcname = %version-%release
%description -n python2-%{srcname}-tests
%desc
This sub-package delivers set of tests for the adapter.
%endif
%if %{with python2_debug}
%package -n python2-%{srcname}-debug
Summary: A PostgreSQL database adapter for Python 2 (debug build)
Requires: python2-%{srcname} = %{version}-%{release}
%{?python_provide:%python_provide python2-%{srcname}-debug}
%description -n python2-%{srcname}-debug
This is a build of the psycopg PostgreSQL database adapter for the debug
build of Python 2.
%endif
%if %{with python3}
%package -n python3-psycopg2
Summary: %{sum} 3
%{?python_provide:%python_provide python3-%{srcname}}
%description -n python3-psycopg2
%{desc}
%package -n python3-%{srcname}-tests
Summary: A testsuite for %sum 2
Requires: python3-%srcname = %version-%release
%description -n python3-%{srcname}-tests
%desc
This sub-package delivers set of tests for the adapter.
%endif
%if %{with python3_debug}
%package -n python3-psycopg2-debug
Summary: A PostgreSQL database adapter for Python 3 (debug build)
# Require base python 3 package, as we're sharing .py/.pyc files:
Requires: python3-psycopg2 = %{version}-%{release}
%description -n python3-%{srcname}-debug
This is a build of the psycopg PostgreSQL database adapter for the debug
build of Python 3.
%endif
%package doc
Summary: Documentation for psycopg python PostgreSQL database adapter
%{?with_python2:Provides: python2-%{srcname}-doc = %{version}-%{release}}
%{?with_python3:Provides: python3-%{srcname}-doc = %{version}-%{release}}
%description doc
Documentation and example files for the psycopg python PostgreSQL
database adapter.
%prep
%autosetup -p1 -n psycopg2-%{version}
%build
export CFLAGS=${RPM_OPT_FLAGS} LDFLAGS=${RPM_LD_FLAGS}
for python in %{python_runtimes} ; do
$python setup.py build
done
for i in `find doc -iname "*.html"`; do sed -i 's/\r//' $i; done
for i in `find doc -iname "*.css"`; do sed -i 's/\r//' $i; done
rm -f doc/html/.buildinfo
%check
%if %{with tests}
export PGTESTS_LOCALE=C.UTF-8
%postgresql_tests_run
export PSYCOPG2_TESTDB=${PGTESTS_DATABASES##*:}
export PSYCOPG2_TESTDB_HOST=$PGHOST
export PSYCOPG2_TESTDB_PORT=$PGPORT
cmd="import tests; tests.unittest.main(defaultTest='tests.test_suite')"
%if %{with python2}
PYTHONPATH=%buildroot%python2_sitearch %__python2 -c "$cmd" --verbose
%endif
%if %{with python3}
PYTHONPATH=%buildroot%python3_sitearch %__python3 -c "$cmd" --verbose
%endif
%endif
%install
export CFLAGS=${RPM_OPT_FLAGS} LDFLAGS=${RPM_LD_FLAGS}
for python in %{python_runtimes} ; do
$python setup.py install --no-compile --root %{buildroot}
done
# Upstream removed tests from the package so we need to add them manually
%if %{with python2}
cp -r tests/ %{buildroot}%{python2_sitearch}/%{srcname}/tests/
for i in `find %{buildroot}%{python2_sitearch}/%{srcname}/tests/ -iname "*.py"`; do
sed -i 's|#!/usr/bin/env python|#!/usr/bin/python2|' $i
done
%endif
%if %{with python3}
cp -r tests/ %{buildroot}%{python3_sitearch}/%{srcname}/tests/
for i in `find %{buildroot}%{python3_sitearch}/%{srcname}/tests/ -iname "*.py"`; do
sed -i 's|#!/usr/bin/env python|#!/usr/bin/python3|' $i
done
%endif
# This test is skipped on 3.7 and has a syntax error so brp-python-bytecompile would choke on it
%{?with_python3:rm -r %{buildroot}%{python3_sitearch}/%{srcname}/tests/test_async_keyword.py}
%if %{with python2}
%files -n python2-psycopg2
%license LICENSE
%doc AUTHORS NEWS README.rst
%dir %{python2_sitearch}/psycopg2
%{python2_sitearch}/psycopg2/*.py
%{python2_sitearch}/psycopg2/*.pyc
%{python2_sitearch}/psycopg2/_psycopg.so
%{python2_sitearch}/psycopg2/*.pyo
%{python2_sitearch}/psycopg2-%{version}-py2*.egg-info
%files -n python2-%{srcname}-tests
%{python2_sitearch}/psycopg2/tests
%endif
%if %{with python2_debug}
%files -n python2-%{srcname}-debug
%license LICENSE
%{python2_sitearch}/psycopg2/_psycopg_d.so
%endif
%if %{with python3}
%files -n python3-psycopg2
%license LICENSE
%doc AUTHORS NEWS README.rst
%dir %{python3_sitearch}/psycopg2
%{python3_sitearch}/psycopg2/*.py
%{python3_sitearch}/psycopg2/_psycopg.cpython-3?[!d]*.so
%dir %{python3_sitearch}/psycopg2/__pycache__
%{python3_sitearch}/psycopg2/__pycache__/*.py{c,o}
%{python3_sitearch}/psycopg2-%{version}-py3*.egg-info
%files -n python3-%{srcname}-tests
%{python3_sitearch}/psycopg2/tests
%endif
%if %{with python3_debug}
%files -n python3-psycopg2-debug
%license LICENSE
%{python3_sitearch}/psycopg2/_psycopg.cpython-3?d*.so
%endif
%files doc
%license LICENSE
%doc doc
%changelog
* Sat Jun 20 2020 wenzhanli<wenzhanli2@huawei.com> - 2.8.5-1
- Type:enhancement
- ID:NA
- SUG:NA
- DESC: update version 2.7.5 to 2.8.5
* Tue Mar 10 2020 chenli <chenli147@huawei.com> - 2.7.5-3.2
- Fix python2-psycopg2-tests install error
* Wed Feb 12 2020 openEuler Buildteam <buildteam@openeuler.org> - 2.7.5-3.1
- Package init
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化