python-db/python-db.spec

Mon, 28 Jan 2013 17:37:18 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 28 Jan 2013 17:37:18 +0100
changeset 758
a2c6460cfb16
parent 313
fc0449ec63bb
permissions
-rw-r--r--

Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.

     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 ##
    24 #   package version
    25 %define       V_python         2.7
    26 %define       V_pysqlite       2.6.3
    27 %define       V_psycopg2       2.4
    28 %define       V_psycopg_maj    2-4
    29 %define       V_mysql_python   1.2.3
    30 %define       V_cx_oracle      5.1
    31 %define       V_sqlobject      0.15.1
    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:      20110322
    46 #   package options
    47 %option       with_sqlite     yes
    48 %option       with_pgsql      no
    49 %option       with_mysql      no
    50 %option       with_oracle     no
    52 #   list of sources
    53 Source0:      http://pysqlite.googlecode.com/files/pysqlite-%{V_pysqlite}.tar.gz
    54 Source1:      http://www.psycopg.org/psycopg/tarballs/PSYCOPG-%{V_psycopg_maj}/psycopg2-%{V_psycopg2}.tar.gz
    55 Source2:      http://switch.dl.sourceforge.net/mysql-python/MySQL-python-%{V_mysql_python}.tar.gz
    56 Source3:      http://switch.dl.sourceforge.net/cx-oracle/cx_Oracle-%{V_cx_oracle}.tar.gz
    57 Source4:      http://pypi.python.org/packages/source/S/SQLObject/SQLObject-%{V_sqlobject}.tar.gz
    58 Patch0:       python-db.patch
    60 #   build information
    61 Prefix:       %{l_prefix}
    62 BuildRoot:    %{l_buildroot}
    63 BuildPreReq:  OpenPKG, openpkg >= 20060823, python >= %{V_python}
    64 PreReq:       OpenPKG, openpkg >= 20060823, 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 AutoReq:      no
    83 AutoReqProv:  no
    85 %description
    86     This packages provides Python DB-API 2.0 compliant bindings to
    87     various RDBMS. It currently supports SQLite, PostgreSQL, MySQL and
    88     Oracle.
    90 %track
    91     prog python-db:pysqlite = {
    92         version   = %{V_pysqlite}
    93         url       = http://initd.org/pub/software/pysqlite/releases/
    94         regex     = (\d+\.\d+)/
    95         url       = http://initd.org/pub/software/pysqlite/releases/__NEWVER1__/
    96         regex     = (\d+\.\d+\.\d+)/
    97         url       = http://initd.org/pub/software/pysqlite/releases/__NEWVER1__/__NEWVER2__/
    98         regex     = pysqlite-(__VER__)\.tar\.gz
    99     }
   100     prog python-db:psycopg2 = {
   101         version   = %{V_psycopg2}
   102         url       = http://initd.org/pub/software/psycopg/
   103         regex     = psycopg2-(__VER__)\.tar\.gz
   104     }
   105     prog python-db:mysql-python = {
   106         version   = %{V_mysql_python}
   107         url       = http://sourceforge.net/projects/mysql-python/files/
   108         regex     = MySQL-python-(__VER__)\.tar\.gz
   109     }
   110     prog python-db:cx_oracle = {
   111         version   = %{V_cx_oracle}
   112         url       = http://sourceforge.net/projects/cx-oracle/files/
   113         regex     = cx_Oracle-(__VER__)\.tar\.gz
   114     }
   115     prog python-db:sqlobject = {
   116         version   = %{V_sqlobject}
   117         url       = http://pypi.python.org/pypi/SQLObject
   118         regex     = pypi/SQLObject/(__VER__)
   119     }
   121 %prep
   122     %setup -q -c
   123     %setup -q -T -D -a 1
   124     %setup -q -T -D -a 2
   125     %setup -q -T -D -a 3
   126     %setup -q -T -D -a 4
   127     %patch -p0
   129 %build
   130 %if "%{with_sqlite}" == "yes"
   131     ( cd pysqlite-%{V_pysqlite}
   132       %{l_shtool} subst \
   133           -e 's;^\([ »··]*include_dirs = \[\)\([^\]]*\).*$;\1"%{l_prefix}/include"\2;' \
   134           -e 's;^\([ »··]*library_dirs = \[\)\([^\]]*\).*$;\1"%{l_prefix}/lib"\2;' \
   135           setup.py
   136       %{l_prefix}/bin/python setup.py build
   137     ) || exit $?
   138 %endif
   139 %if "%{with_pgsql}" == "yes"
   140     ( cd psycopg2-%{V_psycopg2}
   141       %{l_prefix}/bin/python setup.py build
   142     ) || exit $?
   143 %endif
   144 %if "%{with_mysql}" == "yes"
   145     ( cd MySQL-python-%{V_mysql_python}
   146       %{l_prefix}/bin/python setup.py build
   147     ) || exit $?
   148 %endif
   149 %if "%{with_oracle}" == "yes"
   150     ( cd cx_Oracle-%{V_cx_oracle}
   151       %{l_shtool} subst \
   152           -e 's;^\(PYTHON=\).*$;\1 %{l_prefix}/bin/python;' \
   153           Makefile
   154       ORACLE_HOME="`%{l_rc} --query oracle_home`"
   155       export ORACLE_HOME
   156       %{l_prefix}/bin/python setup.py build
   157     ) || exit $?
   158 %endif
   159     ( cd SQLObject-%{V_sqlobject}
   160       %{l_prefix}/bin/python setup.py build
   161     ) || exit $?
   163 %install
   164     rm -rf $RPM_BUILD_ROOT
   165     %{l_shtool} mkdir -f -p -m 755 \
   166         $RPM_BUILD_ROOT%{l_prefix}
   167 %if "%{with_sqlite}" == "yes"
   168     ( cd pysqlite-%{V_pysqlite}
   169       %{l_prefix}/bin/python setup.py install \
   170           --skip-build \
   171           --root=$RPM_BUILD_ROOT \
   172           --prefix=%{l_prefix}
   173       rm -rf $RPM_BUILD_ROOT%{l_prefix}/pysqlite2-doc
   174     ) || exit $?
   175 %endif
   176 %if "%{with_pgsql}" == "yes"
   177     ( cd psycopg2-%{V_psycopg2}
   178       %{l_prefix}/bin/python setup.py install \
   179           --skip-build \
   180           --root=$RPM_BUILD_ROOT \
   181           --prefix=%{l_prefix}
   182     ) || exit $?
   183 %endif
   184 %if "%{with_mysql}" == "yes"
   185     ( cd MySQL-python-%{V_mysql_python}
   186       %{l_prefix}/bin/python setup.py install \
   187           --skip-build \
   188           --root=$RPM_BUILD_ROOT \
   189           --prefix=%{l_prefix}
   190     ) || exit $?
   191 %endif
   192 %if "%{with_oracle}" == "yes"
   193     ( cd cx_Oracle-%{V_cx_oracle}
   194       ORACLE_HOME="`%{l_rc} --query oracle_home`"
   195       export ORACLE_HOME
   196       %{l_prefix}/bin/python setup.py install \
   197           --skip-build \
   198           --root=$RPM_BUILD_ROOT \
   199           --prefix=%{l_prefix}
   200     ) || exit $?
   201 %endif
   202     ( cd SQLObject-%{V_sqlobject}
   203       %{l_prefix}/bin/python setup.py install \
   204           --skip-build \
   205           --root=$RPM_BUILD_ROOT \
   206           --prefix=%{l_prefix}
   207     ) || exit $?
   208     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
   210 %files -f files
   212 %clean
   213     rm -rf $RPM_BUILD_ROOT

mercurial