michael@313: ## michael@313: ## python-db.spec -- OpenPKG RPM Package Specification michael@313: ## Copyright (c) 2000-2010 OpenPKG Foundation e.V. michael@313: ## michael@313: ## Permission to use, copy, modify, and distribute this software for michael@313: ## any purpose with or without fee is hereby granted, provided that michael@313: ## the above copyright notice and this permission notice appear in all michael@313: ## copies. michael@313: ## michael@313: ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED michael@313: ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF michael@313: ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. michael@313: ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR michael@313: ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, michael@313: ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT michael@313: ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF michael@313: ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND michael@313: ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, michael@313: ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT michael@313: ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF michael@313: ## SUCH DAMAGE. michael@313: ## michael@313: michael@313: # package version michael@314: %define V_python 2.7 michael@314: %define V_pysqlite 2.6.3 michael@314: %define V_psycopg2 2.4 michael@314: %define V_psycopg_maj 2-4 michael@314: %define V_mysql_python 1.2.3 michael@314: %define V_cx_oracle 5.1 michael@314: %define V_sqlobject 0.15.1 michael@313: michael@313: # package information michael@313: Name: python-db michael@313: Summary: Python DB-API 2.0 Modules michael@313: URL: http://www.python.org/ michael@313: Vendor: Python Community michael@313: Packager: OpenPKG Foundation e.V. michael@313: Distribution: OpenPKG Community michael@313: Class: EVAL michael@313: Group: Language michael@313: License: GPL michael@313: Version: %{V_python} michael@314: Release: 20110322 michael@313: michael@313: # package options michael@313: %option with_sqlite yes michael@313: %option with_pgsql no michael@313: %option with_mysql no michael@313: %option with_oracle no michael@313: michael@313: # list of sources michael@314: Source0: http://pysqlite.googlecode.com/files/pysqlite-%{V_pysqlite}.tar.gz michael@314: Source1: http://www.psycopg.org/psycopg/tarballs/PSYCOPG-%{V_psycopg_maj}/psycopg2-%{V_psycopg2}.tar.gz michael@313: Source2: http://switch.dl.sourceforge.net/mysql-python/MySQL-python-%{V_mysql_python}.tar.gz michael@313: Source3: http://switch.dl.sourceforge.net/cx-oracle/cx_Oracle-%{V_cx_oracle}.tar.gz michael@313: Source4: http://pypi.python.org/packages/source/S/SQLObject/SQLObject-%{V_sqlobject}.tar.gz michael@313: Patch0: python-db.patch michael@313: michael@313: # build information michael@314: Prefix: %{l_prefix} michael@314: BuildRoot: %{l_buildroot} michael@314: BuildPreReq: OpenPKG, openpkg >= 20060823, python >= %{V_python} michael@314: PreReq: OpenPKG, openpkg >= 20060823, python >= %{V_python} michael@313: BuildPreReq: python-setup michael@313: %if "%{with_sqlite}" == "yes" michael@313: BuildPreReq: sqlite michael@313: PreReq: sqlite michael@313: %endif michael@313: %if "%{with_pgsql}" == "yes" michael@313: BuildPreReq: postgresql michael@313: PreReq: postgresql michael@313: %endif michael@313: %if "%{with_mysql}" == "yes" michael@313: BuildPreReq: mysql michael@313: PreReq: mysql michael@313: %endif michael@313: %if "%{with_oracle}" == "yes" michael@313: BuildPreReq: oracle michael@313: PreReq: oracle michael@313: %endif michael@314: AutoReq: no michael@314: AutoReqProv: no michael@313: michael@313: %description michael@313: This packages provides Python DB-API 2.0 compliant bindings to michael@313: various RDBMS. It currently supports SQLite, PostgreSQL, MySQL and michael@313: Oracle. michael@313: michael@313: %track michael@313: prog python-db:pysqlite = { michael@313: version = %{V_pysqlite} michael@313: url = http://initd.org/pub/software/pysqlite/releases/ michael@313: regex = (\d+\.\d+)/ michael@313: url = http://initd.org/pub/software/pysqlite/releases/__NEWVER1__/ michael@313: regex = (\d+\.\d+\.\d+)/ michael@313: url = http://initd.org/pub/software/pysqlite/releases/__NEWVER1__/__NEWVER2__/ michael@313: regex = pysqlite-(__VER__)\.tar\.gz michael@313: } michael@313: prog python-db:psycopg2 = { michael@313: version = %{V_psycopg2} michael@313: url = http://initd.org/pub/software/psycopg/ michael@313: regex = psycopg2-(__VER__)\.tar\.gz michael@313: } michael@313: prog python-db:mysql-python = { michael@313: version = %{V_mysql_python} michael@313: url = http://sourceforge.net/projects/mysql-python/files/ michael@313: regex = MySQL-python-(__VER__)\.tar\.gz michael@313: } michael@313: prog python-db:cx_oracle = { michael@313: version = %{V_cx_oracle} michael@313: url = http://sourceforge.net/projects/cx-oracle/files/ michael@313: regex = cx_Oracle-(__VER__)\.tar\.gz michael@313: } michael@313: prog python-db:sqlobject = { michael@313: version = %{V_sqlobject} michael@313: url = http://pypi.python.org/pypi/SQLObject michael@313: regex = pypi/SQLObject/(__VER__) michael@313: } michael@313: michael@313: %prep michael@313: %setup -q -c michael@313: %setup -q -T -D -a 1 michael@313: %setup -q -T -D -a 2 michael@313: %setup -q -T -D -a 3 michael@313: %setup -q -T -D -a 4 michael@313: %patch -p0 michael@313: michael@313: %build michael@313: %if "%{with_sqlite}" == "yes" michael@313: ( cd pysqlite-%{V_pysqlite} michael@313: %{l_shtool} subst \ michael@313: -e 's;^\([ »··]*include_dirs = \[\)\([^\]]*\).*$;\1"%{l_prefix}/include"\2;' \ michael@313: -e 's;^\([ »··]*library_dirs = \[\)\([^\]]*\).*$;\1"%{l_prefix}/lib"\2;' \ michael@313: setup.py michael@313: %{l_prefix}/bin/python setup.py build michael@313: ) || exit $? michael@313: %endif michael@313: %if "%{with_pgsql}" == "yes" michael@313: ( cd psycopg2-%{V_psycopg2} michael@313: %{l_prefix}/bin/python setup.py build michael@313: ) || exit $? michael@313: %endif michael@313: %if "%{with_mysql}" == "yes" michael@313: ( cd MySQL-python-%{V_mysql_python} michael@313: %{l_prefix}/bin/python setup.py build michael@313: ) || exit $? michael@313: %endif michael@313: %if "%{with_oracle}" == "yes" michael@313: ( cd cx_Oracle-%{V_cx_oracle} michael@313: %{l_shtool} subst \ michael@313: -e 's;^\(PYTHON=\).*$;\1 %{l_prefix}/bin/python;' \ michael@313: Makefile michael@313: ORACLE_HOME="`%{l_rc} --query oracle_home`" michael@313: export ORACLE_HOME michael@313: %{l_prefix}/bin/python setup.py build michael@313: ) || exit $? michael@313: %endif michael@313: ( cd SQLObject-%{V_sqlobject} michael@313: %{l_prefix}/bin/python setup.py build michael@313: ) || exit $? michael@313: michael@313: %install michael@314: rm -rf $RPM_BUILD_ROOT michael@313: %{l_shtool} mkdir -f -p -m 755 \ michael@313: $RPM_BUILD_ROOT%{l_prefix} michael@313: %if "%{with_sqlite}" == "yes" michael@313: ( cd pysqlite-%{V_pysqlite} michael@313: %{l_prefix}/bin/python setup.py install \ michael@313: --skip-build \ michael@313: --root=$RPM_BUILD_ROOT \ michael@313: --prefix=%{l_prefix} michael@313: rm -rf $RPM_BUILD_ROOT%{l_prefix}/pysqlite2-doc michael@313: ) || exit $? michael@313: %endif michael@313: %if "%{with_pgsql}" == "yes" michael@313: ( cd psycopg2-%{V_psycopg2} michael@313: %{l_prefix}/bin/python setup.py install \ michael@313: --skip-build \ michael@313: --root=$RPM_BUILD_ROOT \ michael@313: --prefix=%{l_prefix} michael@313: ) || exit $? michael@313: %endif michael@313: %if "%{with_mysql}" == "yes" michael@313: ( cd MySQL-python-%{V_mysql_python} michael@313: %{l_prefix}/bin/python setup.py install \ michael@313: --skip-build \ michael@313: --root=$RPM_BUILD_ROOT \ michael@313: --prefix=%{l_prefix} michael@313: ) || exit $? michael@313: %endif michael@313: %if "%{with_oracle}" == "yes" michael@313: ( cd cx_Oracle-%{V_cx_oracle} michael@313: ORACLE_HOME="`%{l_rc} --query oracle_home`" michael@313: export ORACLE_HOME michael@313: %{l_prefix}/bin/python setup.py install \ michael@313: --skip-build \ michael@313: --root=$RPM_BUILD_ROOT \ michael@313: --prefix=%{l_prefix} michael@313: ) || exit $? michael@313: %endif michael@313: ( cd SQLObject-%{V_sqlobject} michael@313: %{l_prefix}/bin/python setup.py install \ michael@313: --skip-build \ michael@313: --root=$RPM_BUILD_ROOT \ michael@313: --prefix=%{l_prefix} michael@313: ) || exit $? michael@313: %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} michael@313: michael@313: %files -f files michael@313: michael@313: %clean michael@314: rm -rf $RPM_BUILD_ROOT michael@313: