python-db.spec 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. ##
  2. ## python-db.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ## Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
  5. ##
  6. ## Permission to use, copy, modify, and distribute this software for
  7. ## any purpose with or without fee is hereby granted, provided that
  8. ## the above copyright notice and this permission notice appear in all
  9. ## copies.
  10. ##
  11. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  12. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  13. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  14. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  15. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  17. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  18. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  19. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  20. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  21. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  22. ## SUCH DAMAGE.
  23. ##
  24. # FIXME: rse: Oracle module was blindly packaged
  25. # package version
  26. %define V_python 2.5
  27. %define V_pysqlite_major 2.4
  28. %define V_pysqlite 2.4.0
  29. %define V_psycopg2 2.0.6
  30. %define V_dcoracle2 1.2
  31. %define V_mysql_python 1.2.2c1
  32. %define V_cx_oracle 4.3.3
  33. # package information
  34. Name: python-db
  35. Summary: Python DB-API 2.0 Modules
  36. URL: http://www.python.org/
  37. Vendor: Python Community
  38. Packager: OpenPKG Foundation e.V.
  39. Distribution: OpenPKG Community
  40. Class: EVAL
  41. Group: Language
  42. License: GPL
  43. Version: %{V_python}
  44. Release: 20071126
  45. # package options
  46. %option with_sqlite yes
  47. %option with_pgsql no
  48. %option with_mysql no
  49. %option with_oracle no
  50. # list of sources
  51. Source0: http://initd.org/pub/software/pysqlite/releases/%{V_pysqlite_major}/%{V_pysqlite}/pysqlite-%{V_pysqlite}.tar.gz
  52. Source1: http://initd.org/pub/software/psycopg/psycopg2-%{V_psycopg2}.tar.gz
  53. Source2: http://www.zope.org/Members/matt/dco2/%{V_dcoracle2}/DCOracle2-%{V_dcoracle2}.tgz
  54. Source3: http://switch.dl.sourceforge.net/mysql-python/MySQL-python-%{V_mysql_python}.tar.gz
  55. Source4: http://switch.dl.sourceforge.net/cx-oracle/cx_Oracle-%{V_cx_oracle}.tar.gz
  56. Patch0: python-db.patch
  57. # build information
  58. Prefix: %{l_prefix}
  59. BuildRoot: %{l_buildroot}
  60. BuildPreReq: OpenPKG, openpkg >= 20040130, python >= %{V_python}
  61. PreReq: OpenPKG, openpkg >= 20040130, python >= %{V_python}
  62. %if "%{with_sqlite}" == "yes"
  63. BuildPreReq: sqlite
  64. PreReq: sqlite
  65. %endif
  66. %if "%{with_pgsql}" == "yes"
  67. BuildPreReq: postgresql
  68. PreReq: postgresql
  69. %endif
  70. %if "%{with_mysql}" == "yes"
  71. BuildPreReq: mysql
  72. PreReq: mysql
  73. %endif
  74. %if "%{with_oracle}" == "yes"
  75. BuildPreReq: oracle
  76. PreReq: oracle
  77. %endif
  78. AutoReq: no
  79. AutoReqProv: no
  80. %description
  81. This packages provides Python DB-API 2.0 compliant bindings to
  82. various RDBMS. It currently supports SQLite, PostgreSQL, MySQL and
  83. Oracle.
  84. %track
  85. prog python-db:pysqlite = {
  86. version = %{V_pysqlite}
  87. url = http://initd.org/pub/software/pysqlite/releases/
  88. regex = (\d+\.\d+)/
  89. url = http://initd.org/pub/software/pysqlite/releases/__NEWVER1__/
  90. regex = (\d+\.\d+\.\d+)/
  91. url = http://initd.org/pub/software/pysqlite/releases/__NEWVER1__/__NEWVER2__/
  92. regex = pysqlite-(__VER__)\.tar\.gz
  93. }
  94. prog python-db:psycopg2 = {
  95. version = %{V_psycopg2}
  96. url = http://initd.org/pub/software/psycopg/
  97. regex = psycopg2-(__VER__)\.tar\.gz
  98. }
  99. prog python-db:mysql-python = {
  100. version = %{V_mysql_python}
  101. url = http://prdownloads.sourceforge.net/mysql-python/
  102. regex = MySQL-python-(__VER__)\.tar\.gz
  103. }
  104. prog python-db:dcoracle2 = {
  105. version = %{V_dcoracle2}
  106. url = http://www.zope.org/Members/matt/dco2/
  107. regex = DCOracle2-(\d+\.[\d\.]+)\.tgz
  108. }
  109. prog python-db:cx_oracle = {
  110. version = %{V_cx_oracle}
  111. url = http://prdownloads.sourceforge.net/cx-oracle/
  112. regex = cx_Oracle-(__VER__)\.tar\.gz
  113. }
  114. %prep
  115. %setup -q -c
  116. %setup -q -T -D -a 1
  117. %setup -q -T -D -a 2
  118. %setup -q -T -D -a 3
  119. %setup -q -T -D -a 4
  120. %patch -p0
  121. %build
  122. %if "%{with_sqlite}" == "yes"
  123. ( cd pysqlite-%{V_pysqlite}
  124. %{l_shtool} subst \
  125. -e 's;^\([ »··]*include_dirs = \[\)\([^\]]*\).*$;\1"%{l_prefix}/include"\2;' \
  126. -e 's;^\([ »··]*library_dirs = \[\)\([^\]]*\).*$;\1"%{l_prefix}/lib"\2;' \
  127. setup.py
  128. %{l_prefix}/bin/python setup.py build
  129. ) || exit $?
  130. %endif
  131. %if "%{with_pgsql}" == "yes"
  132. ( cd psycopg2-%{V_psycopg2}
  133. %{l_prefix}/bin/python setup.py build
  134. ) || exit $?
  135. %endif
  136. %if "%{with_mysql}" == "yes"
  137. ( cd MySQL-python-%{V_mysql_python}
  138. %{l_prefix}/bin/python setup.py build
  139. ) || exit $?
  140. %endif
  141. %if "%{with_oracle}" == "yes"
  142. ( cd DCOracle2
  143. %{l_shtool} subst \
  144. -e 's;^\(PYTHON=\).*$;\1 %{l_prefix}/bin/python;' \
  145. Makefile
  146. ORACLE_HOME="`%{l_rc} --query oracle_home`"
  147. export ORACLE_HOME
  148. %{l_prefix}/bin/python setup.py build
  149. MAKE="%{l_make}" %{l_make} %{l_mflags -O} DCOracle2/dco2.so
  150. ) || exit $?
  151. ( cd cx_Oracle-%{V_cx_oracle}
  152. %{l_shtool} subst \
  153. -e 's;^\(PYTHON=\).*$;\1 %{l_prefix}/bin/python;' \
  154. Makefile
  155. ORACLE_HOME="`%{l_rc} --query oracle_home`"
  156. export ORACLE_HOME
  157. %{l_prefix}/bin/python setup.py build
  158. ) || exit $?
  159. %endif
  160. %install
  161. rm -rf $RPM_BUILD_ROOT
  162. %{l_shtool} mkdir -f -p -m 755 \
  163. $RPM_BUILD_ROOT%{l_prefix}
  164. %if "%{with_sqlite}" == "yes"
  165. ( cd pysqlite-%{V_pysqlite}
  166. %{l_prefix}/bin/python setup.py install \
  167. --skip-build \
  168. --root=$RPM_BUILD_ROOT \
  169. --prefix=%{l_prefix}
  170. rm -rf $RPM_BUILD_ROOT%{l_prefix}/pysqlite2-doc
  171. ) || exit $?
  172. %endif
  173. %if "%{with_pgsql}" == "yes"
  174. ( cd psycopg2-%{V_psycopg2}
  175. %{l_prefix}/bin/python setup.py install \
  176. --skip-build \
  177. --root=$RPM_BUILD_ROOT \
  178. --prefix=%{l_prefix}
  179. ) || exit $?
  180. %endif
  181. %if "%{with_mysql}" == "yes"
  182. ( cd MySQL-python-%{V_mysql_python}
  183. %{l_prefix}/bin/python setup.py install \
  184. --skip-build \
  185. --root=$RPM_BUILD_ROOT \
  186. --prefix=%{l_prefix}
  187. ) || exit $?
  188. %endif
  189. %if "%{with_oracle}" == "yes"
  190. ( cd DCOracle2
  191. ORACLE_HOME="`%{l_rc} --query oracle_home`"
  192. export ORACLE_HOME
  193. %{l_prefix}/bin/python setup.py install \
  194. --skip-build \
  195. --root=$RPM_BUILD_ROOT \
  196. --prefix=%{l_prefix}
  197. ) || exit $?
  198. ( cd cx_Oracle-%{V_cx_oracle}
  199. ORACLE_HOME="`%{l_rc} --query oracle_home`"
  200. export ORACLE_HOME
  201. %{l_prefix}/bin/python setup.py install \
  202. --skip-build \
  203. --root=$RPM_BUILD_ROOT \
  204. --prefix=%{l_prefix}
  205. ) || exit $?
  206. %endif
  207. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
  208. %files -f files
  209. %clean
  210. rm -rf $RPM_BUILD_ROOT