python-db.spec 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. ##
  2. ## python-db.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2006 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ## Copyright (c) 2000-2006 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.4
  27. %define V_pysqlite_major 2.1
  28. %define V_pysqlite 2.1.3
  29. %define V_psycopg2 2.0b8
  30. %define V_dcoracle2 1.2
  31. %define V_mysql_python 1.2.1c7
  32. # package information
  33. Name: python-db
  34. Summary: Python DB-API 2.0 Modules
  35. URL: http://www.python.org/
  36. Vendor: Python Community
  37. Packager: OpenPKG
  38. Distribution: OpenPKG
  39. Class: EVAL
  40. Group: Language
  41. License: GPL
  42. Version: %{V_python}
  43. Release: 20060307
  44. # package options
  45. %option with_sqlite yes
  46. %option with_pgsql no
  47. %option with_mysql no
  48. %option with_oracle no
  49. # list of sources
  50. Source0: http://initd.org/pub/software/pysqlite/releases/%{V_pysqlite_major}/%{V_pysqlite}/pysqlite-%{V_pysqlite}.tar.gz
  51. Source1: http://initd.org/pub/software/psycopg/psycopg2-%{V_psycopg2}.tar.gz
  52. Source2: http://www.zope.org/Members/matt/dco2/%{V_dcoracle2}/DCOracle2-%{V_dcoracle2}.tgz
  53. Source3: http://osdn.dl.sourceforge.net/mysql-python/MySQL-python-%{V_mysql_python}.tar.gz
  54. Patch0: python-db.patch
  55. # build information
  56. Prefix: %{l_prefix}
  57. BuildRoot: %{l_buildroot}
  58. BuildPreReq: OpenPKG, openpkg >= 20040130, python
  59. PreReq: OpenPKG, openpkg >= 20040130, python
  60. %if "%{with_sqlite}" == "yes"
  61. BuildPreReq: sqlite
  62. PreReq: sqlite
  63. %endif
  64. %if "%{with_pgsql}" == "yes"
  65. BuildPreReq: postgresql
  66. PreReq: postgresql
  67. %endif
  68. %if "%{with_mysql}" == "yes"
  69. BuildPreReq: mysql
  70. PreReq: mysql
  71. %endif
  72. %if "%{with_oracle}" == "yes"
  73. BuildPreReq: oracle
  74. PreReq: oracle
  75. %endif
  76. AutoReq: no
  77. AutoReqProv: no
  78. %description
  79. This packages provides Python DB-API 2.0 compliant bindings to
  80. various RDBMS. It currently supports SQLite, PostgreSQL, MySQL and
  81. Oracle.
  82. %track
  83. prog python-db:pysqlite = {
  84. version = %{V_pysqlite}
  85. url = http://initd.org/pub/software/pysqlite/releases/
  86. regex = (\d+\.\d+)/
  87. url = http://initd.org/pub/software/pysqlite/releases/__NEWVER1__/
  88. regex = (\d+\.\d+\.\d+)/
  89. url = http://initd.org/pub/software/pysqlite/releases/__NEWVER1__/__NEWVER2__/
  90. regex = pysqlite-(__VER__)\.tar\.gz
  91. }
  92. prog python-db:psycopg2 = {
  93. version = %{V_psycopg2}
  94. url = http://initd.org/pub/software/psycopg/
  95. regex = psycopg2-(__VER__)\.tar\.gz
  96. }
  97. prog python-db:mysql-python = {
  98. version = %{V_mysql_python}
  99. url = http://prdownloads.sourceforge.net/mysql-python/
  100. regex = MySQL-python-(__VER__)\.tar\.gz
  101. }
  102. prog python-db:dcoracle2 = {
  103. version = %{V_dcoracle2}
  104. url = http://www.zope.org/Members/matt/dco2/
  105. regex = DCOracle2-(\d+\.[\d\.]+)\.tgz
  106. }
  107. %prep
  108. %setup -q -c
  109. %setup -q -T -D -a 1
  110. %setup -q -T -D -a 2
  111. %setup -q -T -D -a 3
  112. %patch -p0
  113. %build
  114. %if "%{with_sqlite}" == "yes"
  115. ( cd pysqlite-%{V_pysqlite}
  116. %{l_shtool} subst \
  117. -e 's;/usr/local/include;%{l_prefix}/include;' \
  118. -e 's;/usr/local/lib;%{l_prefix}/lib;' \
  119. setup.cfg
  120. %{l_prefix}/bin/python setup.py build
  121. ) || exit $?
  122. %endif
  123. %if "%{with_pgsql}" == "yes"
  124. ( cd psycopg2-%{V_psycopg2}
  125. %{l_prefix}/bin/python setup.py build
  126. ) || exit $?
  127. %endif
  128. %if "%{with_mysql}" == "yes"
  129. ( cd MySQL-python-%{V_mysql_python}
  130. %{l_prefix}/bin/python setup.py build
  131. ) || exit $?
  132. %endif
  133. %if "%{with_oracle}" == "yes"
  134. ( cd DCOracle2-%{V_dcoracle2}
  135. %{l_shtool} subst \
  136. -e 's;^\(PYTHON=\).*$;\1 %{l_prefix}/bin/python;' \
  137. Makefile
  138. ORACLE_HOME="`%{l_rc} --query oracle_home`"
  139. export ORACLE_HOME
  140. %{l_prefix}/bin/python setup.py build
  141. MAKE="%{l_make}" %{l_make} %{l_mflags -O} DCOracle2/dco2.so
  142. ) || exit $?
  143. %endif
  144. %install
  145. rm -rf $RPM_BUILD_ROOT
  146. %{l_shtool} mkdir -f -p -m 755 \
  147. $RPM_BUILD_ROOT%{l_prefix}
  148. %if "%{with_sqlite}" == "yes"
  149. ( cd pysqlite-%{V_pysqlite}
  150. %{l_prefix}/bin/python setup.py install \
  151. --skip-build \
  152. --root=$RPM_BUILD_ROOT \
  153. --prefix=%{l_prefix}
  154. rm -rf $RPM_BUILD_ROOT%{l_prefix}/pysqlite2-doc
  155. ) || exit $?
  156. %endif
  157. %if "%{with_pgsql}" == "yes"
  158. ( cd psycopg2-%{V_psycopg2}
  159. %{l_prefix}/bin/python setup.py install \
  160. --skip-build \
  161. --root=$RPM_BUILD_ROOT \
  162. --prefix=%{l_prefix}
  163. ) || exit $?
  164. %endif
  165. %if "%{with_mysql}" == "yes"
  166. ( cd MySQL-python-%{V_mysql_python}
  167. %{l_prefix}/bin/python setup.py install \
  168. --skip-build \
  169. --root=$RPM_BUILD_ROOT \
  170. --prefix=%{l_prefix}
  171. ) || exit $?
  172. %endif
  173. %if "%{with_oracle}" == "yes"
  174. ( cd DCOracle2-%{V_dcoracle2}
  175. ORACLE_HOME="`%{l_rc} --query oracle_home`"
  176. export ORACLE_HOME
  177. %{l_prefix}/bin/python setup.py install \
  178. --skip-build \
  179. --root=$RPM_BUILD_ROOT \
  180. --prefix=%{l_prefix}
  181. ) || exit $?
  182. %endif
  183. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
  184. %files -f files
  185. %clean
  186. rm -rf $RPM_BUILD_ROOT