python-db/python-db.spec

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

mercurial