# HG changeset patch # User Michael Schloh von Bennewitz # Date 1300818794 -3600 # Node ID fc0449ec63bb94347f7d8fe53467a5cf8c33b73f # Parent c71ec3f2c0da2ba03d1d825ebd20d41f24af155d Import package vendor original specs for necessary manipulations. diff -r c71ec3f2c0da -r fc0449ec63bb python-db/python-db.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/python-db/python-db.patch Tue Mar 22 19:33:14 2011 +0100 @@ -0,0 +1,29 @@ +Index: psycopg2-2.0.14/psycopg/config.h +--- psycopg2-2.0.14/psycopg/config.h.orig 2009-04-26 14:09:21 +0200 ++++ psycopg2-2.0.14/psycopg/config.h 2009-10-08 22:31:01 +0200 +@@ -140,10 +140,11 @@ + + #if (defined(__FreeBSD__) && __FreeBSD_version < 503000) || (defined(_WIN32) && !defined(__GNUC__)) || defined(__sun__) || defined(sun) + /* what's this, we have no round function either? */ +-static double round(double num) ++static double my_round(double num) + { + return (num >= 0) ? floor(num + 0.5) : ceil(num - 0.5); + } ++#define round(num) my_round(num) + #endif + + /* postgresql < 7.4 does not have PQfreemem */ +Index: psycopg2-2.0.14/setup.py +--- psycopg2-2.0.14/setup.py.orig 2009-10-04 23:37:14 +0200 ++++ psycopg2-2.0.14/setup.py 2009-10-08 23:15:48 +0200 +@@ -203,6 +203,9 @@ + os.path.join(self.get_pg_config("libdir"), "libpq.a")) + else: + self.libraries.append("pq") ++ self.libraries.append("ssl") ++ self.libraries.append("crypto") ++ self.libraries.append("crypt") + + try: + self.library_dirs.append(self.get_pg_config("libdir")) diff -r c71ec3f2c0da -r fc0449ec63bb python-db/python-db.spec --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/python-db/python-db.spec Tue Mar 22 19:33:14 2011 +0100 @@ -0,0 +1,210 @@ +## +## python-db.spec -- OpenPKG RPM Package Specification +## Copyright (c) 2000-2010 OpenPKG Foundation e.V. +## +## 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 2.5 +%define V_pysqlite_major 2.4 +%define V_pysqlite 2.4.1 +%define V_psycopg2 2.0.14 +%define V_mysql_python 1.2.3c1 +%define V_cx_oracle 5.0.3 +%define V_sqlobject 0.12.4 + +# package information +Name: python-db +Summary: Python DB-API 2.0 Modules +URL: http://www.python.org/ +Vendor: Python Community +Packager: OpenPKG Foundation e.V. +Distribution: OpenPKG Community +Class: EVAL +Group: Language +License: GPL +Version: %{V_python} +Release: 20100506 + +# package options +%option with_sqlite yes +%option with_pgsql no +%option with_mysql no +%option with_oracle no + +# list of sources +Source0: http://initd.org/pub/software/pysqlite/releases/%{V_pysqlite_major}/%{V_pysqlite}/pysqlite-%{V_pysqlite}.tar.gz +Source1: http://initd.org/pub/software/psycopg/psycopg2-%{V_psycopg2}.tar.gz +Source2: http://switch.dl.sourceforge.net/mysql-python/MySQL-python-%{V_mysql_python}.tar.gz +Source3: http://switch.dl.sourceforge.net/cx-oracle/cx_Oracle-%{V_cx_oracle}.tar.gz +Source4: http://pypi.python.org/packages/source/S/SQLObject/SQLObject-%{V_sqlobject}.tar.gz +Patch0: python-db.patch + +# build information +BuildPreReq: OpenPKG, openpkg >= 20100101, python >= %{V_python} +PreReq: OpenPKG, openpkg >= 20100101, python >= %{V_python} +BuildPreReq: python-setup +%if "%{with_sqlite}" == "yes" +BuildPreReq: sqlite +PreReq: sqlite +%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:pysqlite = { + version = %{V_pysqlite} + url = http://initd.org/pub/software/pysqlite/releases/ + regex = (\d+\.\d+)/ + url = http://initd.org/pub/software/pysqlite/releases/__NEWVER1__/ + regex = (\d+\.\d+\.\d+)/ + url = http://initd.org/pub/software/pysqlite/releases/__NEWVER1__/__NEWVER2__/ + regex = pysqlite-(__VER__)\.tar\.gz + } + prog python-db:psycopg2 = { + version = %{V_psycopg2} + url = http://initd.org/pub/software/psycopg/ + regex = psycopg2-(__VER__)\.tar\.gz + } + prog python-db:mysql-python = { + version = %{V_mysql_python} + url = http://sourceforge.net/projects/mysql-python/files/ + 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_sqlite}" == "yes" + ( cd pysqlite-%{V_pysqlite} + %{l_shtool} subst \ + -e 's;^\([ »··]*include_dirs = \[\)\([^\]]*\).*$;\1"%{l_prefix}/include"\2;' \ + -e 's;^\([ »··]*library_dirs = \[\)\([^\]]*\).*$;\1"%{l_prefix}/lib"\2;' \ + setup.py + %{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_sqlite}" == "yes" + ( cd pysqlite-%{V_pysqlite} + %{l_prefix}/bin/python setup.py install \ + --skip-build \ + --root=$RPM_BUILD_ROOT \ + --prefix=%{l_prefix} + rm -rf $RPM_BUILD_ROOT%{l_prefix}/pysqlite2-doc + ) || 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 +