You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
206 lines
6.4 KiB
206 lines
6.4 KiB
## |
|
## python-db.spec -- OpenPKG RPM Package Specification |
|
## Copyright (c) 2000-2022 OpenPKG Project <http://openpkg.org/> |
|
## |
|
## Permission to use, copy, modify, and distribute this software for |
|
## any purpose with or without fee is hereby granted, provided that |
|
## the above copyright notice and this permission notice appear in all |
|
## copies. |
|
## |
|
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
|
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
|
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
|
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
|
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
|
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
|
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
|
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
|
## SUCH DAMAGE. |
|
## |
|
|
|
# FIXME: rse: Oracle module was blindly packaged |
|
|
|
# package version |
|
%define V_python 3.10 |
|
%define V_lmdb 1.2.1 |
|
%define V_psycopg2 2.8.6 |
|
%define V_mysql_python 1.2.5 |
|
%define V_cx_oracle 5.1.2 |
|
%define V_sqlobject 3.6.0 |
|
|
|
# package information |
|
Name: python-db |
|
Summary: Python DB-API 2.0 Modules |
|
URL: http://www.python.org/ |
|
Vendor: Python Community |
|
Packager: OpenPKG Project |
|
Distribution: OpenPKG Community |
|
Class: EVAL |
|
Group: Language |
|
License: GPL |
|
Version: %{V_python} |
|
Release: 20211024 |
|
|
|
# package options |
|
%option with_lmdb yes |
|
%option with_pgsql no |
|
%option with_mysql no |
|
%option with_oracle no |
|
|
|
# list of sources |
|
Source0: https://files.pythonhosted.org/packages/source/l/lmdb/lmdb-%{V_lmdb}.tar.gz |
|
Source1: https://files.pythonhosted.org/packages/source/p/psycopg2/psycopg2-%{V_psycopg2}.tar.gz |
|
Source2: https://files.pythonhosted.org/packages/source/M/MySQL-python/MySQL-python-%{V_mysql_python}.zip |
|
Source3: http://download.sourceforge.net/cx-oracle/cx_Oracle-%{V_cx_oracle}.tar.gz |
|
Source4: https://files.pythonhosted.org/packages/source/S/SQLObject/SQLObject-%{V_sqlobject}.tar.gz |
|
Patch0: python-db.patch |
|
|
|
# build information |
|
BuildPreReq: OpenPKG, openpkg >= 20160101, python >= %{V_python} |
|
PreReq: OpenPKG, openpkg >= 20160101, python >= %{V_python} |
|
BuildPreReq: python-setup |
|
%if "%{with_lmdb}" == "yes" |
|
BuildPreReq: lmdb |
|
PreReq: lmdb |
|
%endif |
|
%if "%{with_pgsql}" == "yes" |
|
BuildPreReq: postgresql |
|
PreReq: postgresql |
|
%endif |
|
%if "%{with_mysql}" == "yes" |
|
BuildPreReq: mysql |
|
PreReq: mysql |
|
%endif |
|
%if "%{with_oracle}" == "yes" |
|
BuildPreReq: oracle |
|
PreReq: oracle |
|
%endif |
|
|
|
%description |
|
This packages provides Python DB-API 2.0 compliant bindings to |
|
various RDBMS. It currently supports SQLite, PostgreSQL, MySQL and |
|
Oracle. |
|
|
|
%track |
|
prog python-db:lmdb = { |
|
version = %{V_lmdb} |
|
url = https://pypi.python.org/pypi/lmdb |
|
regex = lmdb-(\d+\.\d+)\.tar\.gz |
|
} |
|
prog python-db:psycopg2 = { |
|
version = %{V_psycopg2} |
|
url = https://pypi.python.org/pypi/psycopg2 |
|
regex = psycopg2-(__VER__)\.tar\.gz |
|
} |
|
prog python-db:mysql-python = { |
|
version = %{V_mysql_python} |
|
url = https://pypi.python.org/pypi/MySQL-python |
|
regex = MySQL-python-(__VER__)\.tar\.gz |
|
} |
|
prog python-db:cx_oracle = { |
|
version = %{V_cx_oracle} |
|
url = http://sourceforge.net/projects/cx-oracle/files/ |
|
regex = cx_Oracle-(__VER__)\.tar\.gz |
|
} |
|
prog python-db:sqlobject = { |
|
version = %{V_sqlobject} |
|
url = http://pypi.python.org/pypi/SQLObject |
|
regex = pypi/SQLObject/(__VER__) |
|
} |
|
|
|
%prep |
|
%setup -q -c |
|
%setup -q -T -D -a 1 |
|
%setup -q -T -D -a 2 |
|
%setup -q -T -D -a 3 |
|
%setup -q -T -D -a 4 |
|
%patch -p0 |
|
|
|
%build |
|
%if "%{with_lmdb}" == "yes" |
|
( cd lmdb-%{V_lmdb} |
|
LMDB_FORCE_SYSTEM=1 \ |
|
LMDB_INCLUDEDIR="%{l_prefix}/include" \ |
|
LMDB_LIBDIR="%{l_prefix}/lib" \ |
|
%{l_prefix}/bin/python setup.py build |
|
) || exit $? |
|
%endif |
|
%if "%{with_pgsql}" == "yes" |
|
( cd psycopg2-%{V_psycopg2} |
|
%{l_prefix}/bin/python setup.py build |
|
) || exit $? |
|
%endif |
|
%if "%{with_mysql}" == "yes" |
|
( cd MySQL-python-%{V_mysql_python} |
|
%{l_prefix}/bin/python setup.py build |
|
) || exit $? |
|
%endif |
|
%if "%{with_oracle}" == "yes" |
|
( cd cx_Oracle-%{V_cx_oracle} |
|
%{l_shtool} subst \ |
|
-e 's;^\(PYTHON=\).*$;\1 %{l_prefix}/bin/python;' \ |
|
Makefile |
|
ORACLE_HOME="`%{l_rc} --query oracle_home`" |
|
export ORACLE_HOME |
|
%{l_prefix}/bin/python setup.py build |
|
) || exit $? |
|
%endif |
|
( cd SQLObject-%{V_sqlobject} |
|
%{l_prefix}/bin/python setup.py build |
|
) || exit $? |
|
|
|
%install |
|
%{l_shtool} mkdir -f -p -m 755 \ |
|
$RPM_BUILD_ROOT%{l_prefix} |
|
%if "%{with_lmdb}" == "yes" |
|
( cd lmdb-%{V_lmdb} |
|
LMDB_FORCE_SYSTEM=1 \ |
|
LMDB_INCLUDEDIR="%{l_prefix}/include" \ |
|
LMDB_LIBDIR="%{l_prefix}/lib" \ |
|
%{l_prefix}/bin/python setup.py install \ |
|
--skip-build \ |
|
--root=$RPM_BUILD_ROOT \ |
|
--prefix=%{l_prefix} |
|
) || exit $? |
|
%endif |
|
%if "%{with_pgsql}" == "yes" |
|
( cd psycopg2-%{V_psycopg2} |
|
%{l_prefix}/bin/python setup.py install \ |
|
--skip-build \ |
|
--root=$RPM_BUILD_ROOT \ |
|
--prefix=%{l_prefix} |
|
) || exit $? |
|
%endif |
|
%if "%{with_mysql}" == "yes" |
|
( cd MySQL-python-%{V_mysql_python} |
|
%{l_prefix}/bin/python setup.py install \ |
|
--skip-build \ |
|
--root=$RPM_BUILD_ROOT \ |
|
--prefix=%{l_prefix} |
|
) || exit $? |
|
%endif |
|
%if "%{with_oracle}" == "yes" |
|
( cd cx_Oracle-%{V_cx_oracle} |
|
ORACLE_HOME="`%{l_rc} --query oracle_home`" |
|
export ORACLE_HOME |
|
%{l_prefix}/bin/python setup.py install \ |
|
--skip-build \ |
|
--root=$RPM_BUILD_ROOT \ |
|
--prefix=%{l_prefix} |
|
) || exit $? |
|
%endif |
|
( cd SQLObject-%{V_sqlobject} |
|
%{l_prefix}/bin/python setup.py install \ |
|
--skip-build \ |
|
--root=$RPM_BUILD_ROOT \ |
|
--prefix=%{l_prefix} |
|
) || exit $? |
|
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} |
|
|
|
%files -f files |
|
|
|
%clean |
|
|
|
|