1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/python-db/python-db.spec Tue Mar 22 19:33:14 2011 +0100 1.3 @@ -0,0 +1,210 @@ 1.4 +## 1.5 +## python-db.spec -- OpenPKG RPM Package Specification 1.6 +## Copyright (c) 2000-2010 OpenPKG Foundation e.V. <http://openpkg.net/> 1.7 +## 1.8 +## Permission to use, copy, modify, and distribute this software for 1.9 +## any purpose with or without fee is hereby granted, provided that 1.10 +## the above copyright notice and this permission notice appear in all 1.11 +## copies. 1.12 +## 1.13 +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 1.14 +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 1.15 +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1.16 +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR 1.17 +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 1.18 +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 1.19 +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 1.20 +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 1.21 +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 1.22 +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 1.23 +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 1.24 +## SUCH DAMAGE. 1.25 +## 1.26 + 1.27 +# FIXME: rse: Oracle module was blindly packaged 1.28 + 1.29 +# package version 1.30 +%define V_python 2.5 1.31 +%define V_pysqlite_major 2.4 1.32 +%define V_pysqlite 2.4.1 1.33 +%define V_psycopg2 2.0.14 1.34 +%define V_mysql_python 1.2.3c1 1.35 +%define V_cx_oracle 5.0.3 1.36 +%define V_sqlobject 0.12.4 1.37 + 1.38 +# package information 1.39 +Name: python-db 1.40 +Summary: Python DB-API 2.0 Modules 1.41 +URL: http://www.python.org/ 1.42 +Vendor: Python Community 1.43 +Packager: OpenPKG Foundation e.V. 1.44 +Distribution: OpenPKG Community 1.45 +Class: EVAL 1.46 +Group: Language 1.47 +License: GPL 1.48 +Version: %{V_python} 1.49 +Release: 20100506 1.50 + 1.51 +# package options 1.52 +%option with_sqlite yes 1.53 +%option with_pgsql no 1.54 +%option with_mysql no 1.55 +%option with_oracle no 1.56 + 1.57 +# list of sources 1.58 +Source0: http://initd.org/pub/software/pysqlite/releases/%{V_pysqlite_major}/%{V_pysqlite}/pysqlite-%{V_pysqlite}.tar.gz 1.59 +Source1: http://initd.org/pub/software/psycopg/psycopg2-%{V_psycopg2}.tar.gz 1.60 +Source2: http://switch.dl.sourceforge.net/mysql-python/MySQL-python-%{V_mysql_python}.tar.gz 1.61 +Source3: http://switch.dl.sourceforge.net/cx-oracle/cx_Oracle-%{V_cx_oracle}.tar.gz 1.62 +Source4: http://pypi.python.org/packages/source/S/SQLObject/SQLObject-%{V_sqlobject}.tar.gz 1.63 +Patch0: python-db.patch 1.64 + 1.65 +# build information 1.66 +BuildPreReq: OpenPKG, openpkg >= 20100101, python >= %{V_python} 1.67 +PreReq: OpenPKG, openpkg >= 20100101, python >= %{V_python} 1.68 +BuildPreReq: python-setup 1.69 +%if "%{with_sqlite}" == "yes" 1.70 +BuildPreReq: sqlite 1.71 +PreReq: sqlite 1.72 +%endif 1.73 +%if "%{with_pgsql}" == "yes" 1.74 +BuildPreReq: postgresql 1.75 +PreReq: postgresql 1.76 +%endif 1.77 +%if "%{with_mysql}" == "yes" 1.78 +BuildPreReq: mysql 1.79 +PreReq: mysql 1.80 +%endif 1.81 +%if "%{with_oracle}" == "yes" 1.82 +BuildPreReq: oracle 1.83 +PreReq: oracle 1.84 +%endif 1.85 + 1.86 +%description 1.87 + This packages provides Python DB-API 2.0 compliant bindings to 1.88 + various RDBMS. It currently supports SQLite, PostgreSQL, MySQL and 1.89 + Oracle. 1.90 + 1.91 +%track 1.92 + prog python-db:pysqlite = { 1.93 + version = %{V_pysqlite} 1.94 + url = http://initd.org/pub/software/pysqlite/releases/ 1.95 + regex = (\d+\.\d+)/ 1.96 + url = http://initd.org/pub/software/pysqlite/releases/__NEWVER1__/ 1.97 + regex = (\d+\.\d+\.\d+)/ 1.98 + url = http://initd.org/pub/software/pysqlite/releases/__NEWVER1__/__NEWVER2__/ 1.99 + regex = pysqlite-(__VER__)\.tar\.gz 1.100 + } 1.101 + prog python-db:psycopg2 = { 1.102 + version = %{V_psycopg2} 1.103 + url = http://initd.org/pub/software/psycopg/ 1.104 + regex = psycopg2-(__VER__)\.tar\.gz 1.105 + } 1.106 + prog python-db:mysql-python = { 1.107 + version = %{V_mysql_python} 1.108 + url = http://sourceforge.net/projects/mysql-python/files/ 1.109 + regex = MySQL-python-(__VER__)\.tar\.gz 1.110 + } 1.111 + prog python-db:cx_oracle = { 1.112 + version = %{V_cx_oracle} 1.113 + url = http://sourceforge.net/projects/cx-oracle/files/ 1.114 + regex = cx_Oracle-(__VER__)\.tar\.gz 1.115 + } 1.116 + prog python-db:sqlobject = { 1.117 + version = %{V_sqlobject} 1.118 + url = http://pypi.python.org/pypi/SQLObject 1.119 + regex = pypi/SQLObject/(__VER__) 1.120 + } 1.121 + 1.122 +%prep 1.123 + %setup -q -c 1.124 + %setup -q -T -D -a 1 1.125 + %setup -q -T -D -a 2 1.126 + %setup -q -T -D -a 3 1.127 + %setup -q -T -D -a 4 1.128 + %patch -p0 1.129 + 1.130 +%build 1.131 +%if "%{with_sqlite}" == "yes" 1.132 + ( cd pysqlite-%{V_pysqlite} 1.133 + %{l_shtool} subst \ 1.134 + -e 's;^\([ »··]*include_dirs = \[\)\([^\]]*\).*$;\1"%{l_prefix}/include"\2;' \ 1.135 + -e 's;^\([ »··]*library_dirs = \[\)\([^\]]*\).*$;\1"%{l_prefix}/lib"\2;' \ 1.136 + setup.py 1.137 + %{l_prefix}/bin/python setup.py build 1.138 + ) || exit $? 1.139 +%endif 1.140 +%if "%{with_pgsql}" == "yes" 1.141 + ( cd psycopg2-%{V_psycopg2} 1.142 + %{l_prefix}/bin/python setup.py build 1.143 + ) || exit $? 1.144 +%endif 1.145 +%if "%{with_mysql}" == "yes" 1.146 + ( cd MySQL-python-%{V_mysql_python} 1.147 + %{l_prefix}/bin/python setup.py build 1.148 + ) || exit $? 1.149 +%endif 1.150 +%if "%{with_oracle}" == "yes" 1.151 + ( cd cx_Oracle-%{V_cx_oracle} 1.152 + %{l_shtool} subst \ 1.153 + -e 's;^\(PYTHON=\).*$;\1 %{l_prefix}/bin/python;' \ 1.154 + Makefile 1.155 + ORACLE_HOME="`%{l_rc} --query oracle_home`" 1.156 + export ORACLE_HOME 1.157 + %{l_prefix}/bin/python setup.py build 1.158 + ) || exit $? 1.159 +%endif 1.160 + ( cd SQLObject-%{V_sqlobject} 1.161 + %{l_prefix}/bin/python setup.py build 1.162 + ) || exit $? 1.163 + 1.164 +%install 1.165 + %{l_shtool} mkdir -f -p -m 755 \ 1.166 + $RPM_BUILD_ROOT%{l_prefix} 1.167 +%if "%{with_sqlite}" == "yes" 1.168 + ( cd pysqlite-%{V_pysqlite} 1.169 + %{l_prefix}/bin/python setup.py install \ 1.170 + --skip-build \ 1.171 + --root=$RPM_BUILD_ROOT \ 1.172 + --prefix=%{l_prefix} 1.173 + rm -rf $RPM_BUILD_ROOT%{l_prefix}/pysqlite2-doc 1.174 + ) || exit $? 1.175 +%endif 1.176 +%if "%{with_pgsql}" == "yes" 1.177 + ( cd psycopg2-%{V_psycopg2} 1.178 + %{l_prefix}/bin/python setup.py install \ 1.179 + --skip-build \ 1.180 + --root=$RPM_BUILD_ROOT \ 1.181 + --prefix=%{l_prefix} 1.182 + ) || exit $? 1.183 +%endif 1.184 +%if "%{with_mysql}" == "yes" 1.185 + ( cd MySQL-python-%{V_mysql_python} 1.186 + %{l_prefix}/bin/python setup.py install \ 1.187 + --skip-build \ 1.188 + --root=$RPM_BUILD_ROOT \ 1.189 + --prefix=%{l_prefix} 1.190 + ) || exit $? 1.191 +%endif 1.192 +%if "%{with_oracle}" == "yes" 1.193 + ( cd cx_Oracle-%{V_cx_oracle} 1.194 + ORACLE_HOME="`%{l_rc} --query oracle_home`" 1.195 + export ORACLE_HOME 1.196 + %{l_prefix}/bin/python setup.py install \ 1.197 + --skip-build \ 1.198 + --root=$RPM_BUILD_ROOT \ 1.199 + --prefix=%{l_prefix} 1.200 + ) || exit $? 1.201 +%endif 1.202 + ( cd SQLObject-%{V_sqlobject} 1.203 + %{l_prefix}/bin/python setup.py install \ 1.204 + --skip-build \ 1.205 + --root=$RPM_BUILD_ROOT \ 1.206 + --prefix=%{l_prefix} 1.207 + ) || exit $? 1.208 + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} 1.209 + 1.210 +%files -f files 1.211 + 1.212 +%clean 1.213 +