## ## python-db.spec -- OpenPKG RPM Package Specification ## Copyright (c) 2000-2006 OpenPKG Foundation e.V. ## Copyright (c) 2000-2006 Ralf S. Engelschall ## ## 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.4 %define V_pysqlite_major 2.3 %define V_pysqlite 2.3.2 %define V_psycopg2 2.0.5 %define V_dcoracle2 1.2 %define V_mysql_python 1.2.2b1 %define V_cx_oracle 4.2 # package information Name: python-db Summary: Python DB-API 2.0 Modules URL: http://www.python.org/ Vendor: Python Community Packager: OpenPKG Distribution: OpenPKG Class: EVAL Group: Language License: GPL Version: %{V_python} Release: 20060902 # 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://www.zope.org/Members/matt/dco2/%{V_dcoracle2}/DCOracle2-%{V_dcoracle2}.tgz Source3: http://switch.dl.sourceforge.net/mysql-python/MySQL-python-%{V_mysql_python}.tar.gz Source4: http://switch.dl.sourceforge.net/cx-oracle/cx_Oracle-%{V_cx_oracle}.tar.gz Patch0: python-db.patch # build information Prefix: %{l_prefix} BuildRoot: %{l_buildroot} BuildPreReq: OpenPKG, openpkg >= 20040130, python PreReq: OpenPKG, openpkg >= 20040130, python %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 AutoReq: no AutoReqProv: no %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://prdownloads.sourceforge.net/mysql-python/ regex = MySQL-python-(__VER__)\.tar\.gz } prog python-db:dcoracle2 = { version = %{V_dcoracle2} url = http://www.zope.org/Members/matt/dco2/ regex = DCOracle2-(\d+\.[\d\.]+)\.tgz } prog python-db:cx_oracle = { version = %{V_cx_oracle} url = http://prdownloads.sourceforge.net/cx-oracle/ regex = cx_Oracle-(__VER__)\.tar\.gz } %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;/usr/include;%{l_prefix}/include;' \ -e 's;/usr/lib;%{l_prefix}/lib;' \ setup.cfg %{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 DCOracle2 %{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 MAKE="%{l_make}" %{l_make} %{l_mflags -O} DCOracle2/dco2.so ) || exit $? ( 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 %install rm -rf $RPM_BUILD_ROOT %{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 DCOracle2 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 $? ( 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 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} %files -f files %clean rm -rf $RPM_BUILD_ROOT