ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/python.spec
(Generate patch)

Comparing COMP/CMSDIST/python.spec (file contents):
Revision 1.78 by eulisse, Wed Nov 2 14:15:50 2011 UTC vs.
Revision 1.97 by davidlt, Thu Sep 6 13:42:19 2012 UTC

# Line 1 | Line 1
1 < ### RPM external python 2.6.4
1 > ### RPM external python 2.7.3
2   ## INITENV +PATH PATH %i/bin
3   ## INITENV +PATH LD_LIBRARY_PATH %i/lib
4   ## INITENV SETV PYTHON_LIB_SITE_PACKAGES lib/python%{python_major_version}/site-packages
5 + ## INITENV SETV PYTHONHASHSEED random
6   # OS X patches and build fudging stolen from fink
7   %{expand:%%define python_major_version %(echo %realversion | cut -d. -f1,2)}
8   %define online %(case %cmsplatf in (*onl_*_*) echo true;; (*) echo false;; esac)
9  
10 < Requires: expat bz2lib db4 gdbm
10 > Requires: expat bz2lib db4 gdbm openssl
11  
12   %if "%online" != "true"
13 < Requires: zlib openssl sqlite
13 > Requires: zlib sqlite
14   %endif
15  
16   # FIXME: readline, crypt
17   # FIXME: gmp, panel, tk/tcl, x11
18  
19   Source0: http://www.python.org/ftp/%n/%realversion/Python-%realversion.tgz
20 < Patch0: python-2.6.4-dont-detect-dbm
21 < Patch1: python-2.6.4-fix-macosx-relocation
20 > Patch0: python-2.7.3-dont-detect-dbm
21 > Patch1: python-fix-macosx-relocation
22 > Patch2: python-2.7.3-fix-pyport
23 > Patch3: python-2.7.3-ssl-fragment
24  
25   %prep
26   %setup -n Python-%realversion
# Line 26 | Line 29 | find . -type f | while read f; do
29      perl -p -i -e "s|#!.*/usr/local/bin/python|#!/usr/bin/env python|" $f
30    else :; fi
31   done
29
30 case %cmsplatf in
31  osx*)
32        sed 's|@PREFIX@|%i|g' < %_sourcedir/python-osx | patch -p1
33  ;;
34 esac
32   %patch0 -p1
33 < %patch1 -p1
33 > %patch1 -p0
34 >
35 > %ifos darwin
36 > %patch2 -p1
37 > %endif
38 >
39 > %patch3 -p1
40  
41   %build
42   # Python is awkward about passing other include or library directories
# Line 51 | Line 54 | esac
54   mkdir -p %i/include %i/lib %i/bin
55  
56   %if "%online" != "true"
57 < %define extradirs $ZLIB_ROOT $OPENSSL_ROOT $SQLITE_ROOT
57 > %define extradirs $ZLIB_ROOT $SQLITE_ROOT
58   %else
59   %define extradirs %{nil}
60   %endif
# Line 62 | Line 65 | dirs="$EXPAT_ROOT $BZ2LIB_ROOT $NCURSES_
65   # location of DB4, this was needed to avoid having it picked up from the system.
66   export DB4_ROOT
67  
68 + # Python's configure parses LDFLAGS and CPPFLAGS to look for aditional library and include directories
69   echo $dirs
70 + LDFLAGS=""
71 + CPPFLAGS=""
72   for d in $dirs; do
73 <  for f in $d/include/*; do
74 <    [ -e $f ] || continue
69 <    rm -f %i/include/$(basename $f)
70 <    ln -s $f %i/include
71 <  done
72 <  for f in $d/lib/*; do
73 <    [ -e $f ] || continue
74 <    rm -f %i/lib/$(basename $f)
75 <    ln -s $f %i/lib
76 <  done
73 >  LDFLAGS="$LDFLAGS -L $d/lib"
74 >  CPPFLAGS="$CPPFLAGS -I $d/include"
75   done
76 + export LDFLAGS
77 + export CPPFLAGS
78  
79   additionalConfigureOptions=""
80   case %cmsplatf in
# Line 83 | Line 83 | case %cmsplatf in
83      ;;
84   esac
85  
86 < ./configure --prefix=%i $additionalConfigureOptions --enable-shared \
87 <            --without-tkinter --disable-tkinter
86 > # Bugfix for dbm package. Use ndbm.h header and gdbm compatibility layer.
87 > sed -ibak "s/ndbm_libs = \[\]/ndbm_libs = ['gdbm', 'gdbm_compat']/" setup.py
88 >
89 > ./configure --prefix=%i $additionalConfigureOptions --enable-shared
90 >
91 > # Modify pyconfig.h to match macros from GLIBC features.h on Linux machines.
92 > # _POSIX_C_SOURCE and _XOPEN_SOURCE macros are not identical anymore
93 > # starting GLIBC 2.10.1. Python.h is not included before standard headers
94 > # in CMSSW and pyconfig.h is not smart enough to detect already defined
95 > # macros on Linux. The following problem does not exists on BSD machines as
96 > # cdefs.h does not define these macros.
97 > case %cmsplatf in
98 >  slc6*)
99 >    rm -f cms_configtest.cpp
100 >    cat <<CMS_EOF > cms_configtest.cpp
101 > #include <features.h>
102 >
103 > int main() {
104 >  return 0;
105 > }
106 > CMS_EOF
107 >
108 >    FEATURES=$(g++ -dM -E -DGNU_GCC=1 -D_GNU_SOURCE=1 -D_DARWIN_SOURCE=1 cms_configtest.cpp \
109 >      | grep -E '_POSIX_C_SOURCE |_XOPEN_SOURCE ')
110 >    rm -f cms_configtest.cpp a.out
111 >
112 >    POSIX_C_SOURCE=$(echo "${FEATURES}" | grep _POSIX_C_SOURCE | cut -d ' ' -f 3)
113 >    XOPEN_SOURCE=$(echo "${FEATURES}" | grep _XOPEN_SOURCE | cut -d ' ' -f 3)
114 >
115 >    sed -ibak "s/\(#define _POSIX_C_SOURCE \)\(.*\)/\1${POSIX_C_SOURCE}/g" pyconfig.h
116 >    sed -ibak "s/\(#define _XOPEN_SOURCE \)\(.*\)/\1${XOPEN_SOURCE}/g" pyconfig.h
117 >  ;;
118 > esac
119  
120   # The following is a kludge around the fact that the /usr/lib/libreadline.so
121   # symlink (for 32-bit lib) is missing on the 64bit machines
# Line 94 | Line 125 | case %cmsplatf in
125      ln -s /usr/lib/libreadline.so.4.3 %{i}/lib/libreadline.so
126    ;;
127   esac
128 +
129   make %makeprocesses
130  
131   %install
# Line 124 | Line 156 | case %cmsplatf in
156    ;;
157   esac
158  
159 < perl -p -i -e "s|^#!.*python|#!/usr/bin/env python|" %{i}/bin/idle \
160 <                    %{i}/bin/pydoc \
161 <                    %{i}/bin/python-config \
162 <                    %{i}/bin/2to3 \
163 <                    %{i}/bin/python2.6-config \
164 <                    %{i}/bin/smtpd.py \
133 <                    %{i}/lib/python2.6/bsddb/dbshelve.py \
134 <                    %{i}/lib/python2.6/test/test_bz2.py \
135 <                    %{i}/lib/python2.6/test/test_largefile.py \
136 <                    %{i}/lib/python2.6/test/test_optparse.py
159 > perl -p -i -e "s|^#!.*python|#!/usr/bin/env python|" %{i}/bin/idle \
160 >                     %{i}/bin/pydoc \
161 >                     %{i}/bin/python-config \
162 >                     %{i}/bin/2to3 \
163 >                     %{i}/bin/python2.7-config \
164 >                     %{i}/bin/smtpd.py
165  
166   find %{i}/lib -maxdepth 1 -mindepth 1 ! -name '*python*' -exec rm {} \;
167   find %{i}/include -maxdepth 1 -mindepth 1 ! -name '*python*' -exec rm {} \;
# Line 149 | Line 177 | done
177   find %{i}/lib -type f -name "_tkinter.so" -exec rm {} \;
178  
179   # Remove documentation, examples and test files.
180 < %define drop_files %i/share %{i}/lib/python%{pythonv}/test
180 > %define drop_files { %i/share %{i}/lib/python%{pythonv}/test \
181 >                   %{i}/lib/python%{pythonv}/distutils/tests \
182 >                   %{i}/lib/python%{pythonv}/json/tests \
183 >                   %{i}/lib/python%{pythonv}/ctypes/test \
184 >                   %{i}/lib/python%{pythonv}/sqlite3/test \
185 >                   %{i}/lib/python%{pythonv}/bsddb/test \
186 >                   %{i}/lib/python%{pythonv}/email/test \
187 >                   %{i}/lib/python%{pythonv}/lib2to3/tests }
188  
189   # Remove .pyo files
190   find %i -name '*.pyo' -exec rm {} \;
# Line 167 | Line 202 | for tool in $(echo %{requiredtools} | se
202   done
203  
204   %post
205 < %{relocateConfig}lib/python2.6/config/Makefile
205 > %{relocateConfig}lib/python2.7/config/Makefile
206   %{relocateConfig}etc/profile.d/dependencies-setup.*sh

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines