The attached python.patch file and patch to the python.spec file bring
python up to date with the 2.4.1 release as well as adding several options,
dependencies, and a few tweaks to get various modules to build properly on
a SuSE 9.2 Professional system running OpenPKG Release 2.3 (mostly with
some CURRENT thrown in for good measure :-).

The python.patch file is basically stripped of all the hacks to make
python-2.4 work (more or less) with the Berkeley DB.

I spent several hours tonight hacking in options to the spec file to
specify various optional modules and their associated dependencies.  There
were also some tweaks to the %build section to get modules to build
properly that were failing during the old build process (the dbm and
localle options).

I added the dependencies mostly because The Python build process doesn't
say much about failed extension builds so one may well not get all the
modules expected.  I set the defaults for all these modules to "yes" so the
behaviour should be unchanged on a build where all the required packages
are installed.

One suggestion that I would like to make is that all the ``%{l_shtool}
subst'' things be done in the %build section, not in %prep.  This makes it
a bit easier to create new patch files, and I think is somewhat more
logical as the %prep should be loading source files and applying patches
while %build does the heavy lifting.

The source rpm is available at:

ftp://ftp.celestial.com/private/ftp.openpkg.org/release/2.3/SRC/python-2.4.1-20050416.src.rpm

Bill
--
INTERNET:   [EMAIL PROTECTED]  Bill Campbell; Celestial Software LLC
UUCP:               camco!bill  PO Box 820; 6641 E. Mercer Way
FAX:            (206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676
URL: http://www.celestial.com/

``Liberals love to say things like, 'We're just asking everyone to pay
their fair share.' But government is not about asking. It is about telling.
The difference is fundamental. It is the difference between making love and
being raped, between working for a living and being a slave.''
    Dr. Thomas Sowell, Forbes, July 1994
Index: Include/pyport.h
--- Include/pyport.h.orig       2004-06-05 18:34:53.146935009 +0200
+++ Include/pyport.h    2004-06-05 18:34:58.681503403 +0200
@@ -238,8 +238,12 @@
  * config to #define Py_HUGE_VAL to something that works on your platform.
  */
 #ifndef Py_HUGE_VAL
+#if defined (__SVR4) && defined (__sun)
+#define Py_HUGE_VAL HUGE
+#else
 #define Py_HUGE_VAL HUGE_VAL
 #endif
+#endif
 
 /* Py_OVERFLOWED(X)
  * Return 1 iff a libm function overflowed.  Set errno to 0 before calling
Index: python.spec
===================================================================
RCS file: /v/openpkg/cvs/openpkg-src/python/python.spec,v
retrieving revision 1.60
diff -u -d -a -u -r1.60 python.spec
--- python.spec 24 Mar 2005 11:20:07 -0000      1.60
+++ python.spec 17 Apr 2005 05:12:42 -0000
@@ -32,8 +32,19 @@
 Class:        BASE
 Group:        Language
 License:      GPL
-Version:      2.4
-Release:      20050311
+Version:      2.4.1
+Release:      20050416
+
+#   package options
+%option       with_readline             yes
+%option       with_bsdb                 yes
+%option       with_dbm                  yes
+%option       with_curses               yes
+%option       with_bzip2                yes
+%option       with_xml                  yes
+%option       with_tkinter              yes
+%option       with_locale               yes
+%option       with_ssl                  yes
 
 #   list of sources
 Source0:      
ftp://ftp.python.org/pub/python/%{version}/Python-%{version}.tar.bz2
@@ -42,10 +53,50 @@
 #   build information
 Prefix:       %{l_prefix}
 BuildRoot:    %{l_buildroot}
-BuildPreReq:  OpenPKG, openpkg >= 20040130, gcc
-PreReq:       OpenPKG, openpkg >= 20040130, gcc
+BuildPreReq:  OpenPKG, openpkg >= 2.3.0, gcc
+PreReq:       OpenPKG, openpkg >= 2.3.0, gcc
 BuildPreReq:  zlib
 PreReq:       zlib
+%if "%{with_readline}" == "yes"
+BuildPreReq:  readline
+PreReq:       readline
+%endif
+%if "%{with_bsdb}" == "yes"
+BuildPreReq:  db
+PreReq:       db
+%endif
+%if "%{with_bsdb}" == "yes"
+BuildPreReq:  db
+PreReq:       db
+%endif
+%if "%{with_dbm}" == "yes"
+BuildPreReq:  gdbm::with_ndbm = yes
+PreReq:       gdbm::with_ndbm = yes
+%endif
+%if "%{with_curses}" == "yes"
+BuildPreReq:  ncurses
+PreReq:       ncurses
+%endif
+%if "%{with_bzip2}" == "yes"
+BuildPreReq:  bzip2
+PreReq:       bzip2
+%endif
+%if "%{with_xml}" == "yes"
+BuildPreReq:  expat
+PreReq:       expat
+%endif
+%if "%{with_tkinter}" == "yes"
+BuildPreReq:  tcl
+PreReq:       tcl
+%endif
+%if "%{with_locale}" == "yes"
+BuildPreReq:  gettext, libiconv
+PreReq:       gettext, libiconv
+%endif
+%if "%{with_ssl}" == "yes"
+BuildPreReq:  openssl
+PreReq:       openssl
+%endif
 AutoReq:      no
 AutoReqProv:  no
 
@@ -101,12 +152,27 @@
         Lib/distutils/command/install.py
 
 %build
+       libs=''
+       # create empty cache file
+       > config.cache
+%if "%{with_dbm}" == "yes"
+       libs="$libs -lndbm -lgdbm"
+%endif
+%if "%{with_locale}" == "yes"
+       echo 'ac_cv_lib_intl_textdomain=yes' >> config.cache
+       # add iconv to locale_libs in setup.py
+       %{l_shtool} subst -s \
+               -e 's/locale_libs =.*intl.*/locale_libs = ["intl", "iconv"]/' \
+               setup.py
+%endif
+
     CC="%{l_cc}" \
     CXX="%{l_cxx}" \
     CFLAGS="%{l_cflags -O}" \
     CXXFLAGS="%{l_cxxflags -O}" \
-    LDFLAGS="%{l_ldflags}" \
+    LDFLAGS="%{l_ldflags} $libs" \
     ./configure \
+               --cache-file=./config.cache \
         --prefix=%{l_prefix}
     %{l_make} %{l_mflags}
 

Reply via email to