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.87 by davidlt, Wed Jun 20 08:54:31 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)
# Line 16 | Line 17 | Requires: zlib openssl sqlite
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
20 < Patch1: python-2.6.4-fix-macosx-relocation
20 > Patch1: python-fix-macosx-relocation
21  
22   %prep
23   %setup -n Python-%realversion
# Line 26 | Line 26 | find . -type f | while read f; do
26      perl -p -i -e "s|#!.*/usr/local/bin/python|#!/usr/bin/env python|" $f
27    else :; fi
28   done
29 <
30 < case %cmsplatf in
31 <  osx*)
32 <        sed 's|@PREFIX@|%i|g' < %_sourcedir/python-osx | patch -p1
33 <  ;;
34 < esac
35 < %patch0 -p1
36 < %patch1 -p1
29 > %patch1 -p0
30  
31   %build
32   # Python is awkward about passing other include or library directories
# Line 62 | Line 55 | dirs="$EXPAT_ROOT $BZ2LIB_ROOT $NCURSES_
55   # location of DB4, this was needed to avoid having it picked up from the system.
56   export DB4_ROOT
57  
58 + # Python's configure parses LDFLAGS and CPPFLAGS to look for aditional library and include directories
59   echo $dirs
60 + LDFLAGS=""
61 + CPPFLAGS=""
62   for d in $dirs; do
63 <  for f in $d/include/*; do
64 <    [ -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
63 >  LDFLAGS="$LDFLAGS -L $d/lib"
64 >  CPPFLAGS="$CPPFLAGS -I $d/include"
65   done
66 + export LDFLAGS
67 + export CPPFLAGS
68  
69   additionalConfigureOptions=""
70   case %cmsplatf in
# Line 83 | Line 73 | case %cmsplatf in
73      ;;
74   esac
75  
76 < ./configure --prefix=%i $additionalConfigureOptions --enable-shared \
77 <            --without-tkinter --disable-tkinter
76 > # Bugfix for dbm package. Use ndbm.h header and gdbm compatibility layer.
77 > sed -ibak "s/ndbm_libs = \[\]/ndbm_libs = ['gdbm', 'gdbm_compat']/" setup.py
78 >
79 > ./configure --prefix=%i $additionalConfigureOptions --enable-shared
80 >
81 > # Modify pyconfig.h to match macros from GLIBC features.h on Linux machines.
82 > # _POSIX_C_SOURCE and _XOPEN_SOURCE macros are not identical anymore
83 > # starting GLIBC 2.10.1. Python.h is not included before standard headers
84 > # in CMSSW and pyconfig.h is not smart enough to detect already defined
85 > # macros on Linux. The following problem does not exists on BSD machines as
86 > # cdefs.h does not define these macros.
87 > case %cmsplatf in
88 >  slc6*)
89 >    rm -f cms_configtest.cpp
90 >    cat <<CMS_EOF > cms_configtest.cpp
91 > #include <features.h>
92 >
93 > int main() {
94 >  return 0;
95 > }
96 > CMS_EOF
97 >
98 >    FEATURES=$(g++ -dM -E -DGNU_GCC=1 -D_GNU_SOURCE=1 -D_DARWIN_SOURCE=1 cms_configtest.cpp \
99 >      | grep -E '_POSIX_C_SOURCE |_XOPEN_SOURCE ')
100 >    rm -f cms_configtest.cpp a.out
101 >
102 >    POSIX_C_SOURCE=$(echo "${FEATURES}" | grep _POSIX_C_SOURCE | cut -d ' ' -f 3)
103 >    XOPEN_SOURCE=$(echo "${FEATURES}" | grep _XOPEN_SOURCE | cut -d ' ' -f 3)
104 >
105 >    sed -ibak "s/\(#define _POSIX_C_SOURCE \)\(.*\)/\1${POSIX_C_SOURCE}/g" pyconfig.h
106 >    sed -ibak "s/\(#define _XOPEN_SOURCE \)\(.*\)/\1${XOPEN_SOURCE}/g" pyconfig.h
107 >  ;;
108 > esac
109  
110   # The following is a kludge around the fact that the /usr/lib/libreadline.so
111   # symlink (for 32-bit lib) is missing on the 64bit machines
# Line 94 | Line 115 | case %cmsplatf in
115      ln -s /usr/lib/libreadline.so.4.3 %{i}/lib/libreadline.so
116    ;;
117   esac
118 +
119   make %makeprocesses
120  
121   %install
# Line 124 | Line 146 | case %cmsplatf in
146    ;;
147   esac
148  
149 < perl -p -i -e "s|^#!.*python|#!/usr/bin/env python|" %{i}/bin/idle \
150 <                    %{i}/bin/pydoc \
151 <                    %{i}/bin/python-config \
152 <                    %{i}/bin/2to3 \
153 <                    %{i}/bin/python2.6-config \
154 <                    %{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
149 > perl -p -i -e "s|^#!.*python|#!/usr/bin/env python|" %{i}/bin/idle \
150 >                     %{i}/bin/pydoc \
151 >                     %{i}/bin/python-config \
152 >                     %{i}/bin/2to3 \
153 >                     %{i}/bin/python2.7-config \
154 >                     %{i}/bin/smtpd.py
155  
156   find %{i}/lib -maxdepth 1 -mindepth 1 ! -name '*python*' -exec rm {} \;
157   find %{i}/include -maxdepth 1 -mindepth 1 ! -name '*python*' -exec rm {} \;
# Line 149 | Line 167 | done
167   find %{i}/lib -type f -name "_tkinter.so" -exec rm {} \;
168  
169   # Remove documentation, examples and test files.
170 < %define drop_files %i/share %{i}/lib/python%{pythonv}/test
170 > %define drop_files { %i/share %{i}/lib/python%{pythonv}/test \
171 >                   %{i}/lib/python%{pythonv}/distutils/tests \
172 >                   %{i}/lib/python%{pythonv}/json/tests \
173 >                   %{i}/lib/python%{pythonv}/ctypes/test \
174 >                   %{i}/lib/python%{pythonv}/sqlite3/test \
175 >                   %{i}/lib/python%{pythonv}/bsddb/test \
176 >                   %{i}/lib/python%{pythonv}/email/test \
177 >                   %{i}/lib/python%{pythonv}/lib2to3/tests }
178  
179   # Remove .pyo files
180   find %i -name '*.pyo' -exec rm {} \;
# Line 167 | Line 192 | for tool in $(echo %{requiredtools} | se
192   done
193  
194   %post
195 < %{relocateConfig}lib/python2.6/config/Makefile
195 > %{relocateConfig}lib/python2.7/config/Makefile
196   %{relocateConfig}etc/profile.d/dependencies-setup.*sh

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines