ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/python.spec
Revision: 1.58
Committed: Sat Nov 14 00:04:28 2009 UTC (15 years, 5 months ago) by elmer
Branch: MAIN
CVS Tags: CMSSW_3_5_7_hltpatch4, apFor357hltp4v0, CMSSW_3_5_8_patch4, apFor358p4v3, apFor358p4v2, apFor358p4v1, apFor358p4v0, CMSSW_3_5_8_patch3, apFor358p3v0, CMSSW_3_5_8_patch2, apFor358p2v0, CMSSW_3_5_8_patch1, apFor358p1v1, apFor358p1v0, CMSSW_3_5_7_onlpatch2_ONLINE, CMSSW_3_5_8, CMSSW_3_5_7_onlpatch1_ONLINE, CMSSW_3_5_7_ONLINE, apFor358v0, CMSSW_3_5_4_onlpatch4_ONLINE, fwFor357online, CMSSW_3_5_7, apFor357v2, apFor357v1, apFor357v0, CMSSW_3_5_6_patch1, for356p1, CMSSW_3_5_4_patch2, CMSSW_3_5_6, for356, for354p2, dsr20100326fwlite355, CMSSW_3_5_5, CMSSW_3_5_4_onlpatch3_ONLINE, apFor355v0, CMSSW_3_5_4_patch1, for354patch1, CMSSW_3_5_4_onlpatch2_ONLINE, CMSSW_3_5_4_onlpatch1_ONLINE, CMSSW_3_5_4_ONLINE, fwFor354onl, CMSSW_3_5_4, apFor354v0, CMSSW_3_5_3_ONLINE, fwFor353onl, CMSSW_3_5_3, CMSSW_3_6_0_pre2, apFor353v0, sm100302a-for35X, sm100302b-for36X, sm100302a-for36X, wmtFor360pre2, fc20100228, pe20100228a-for36X, CMSSW_3_5_2_patch2, apFor352p2v0, CMSSW_3_5_2_patch1, apFor352p1v0, fwFor352onl, CMSSW_3_5_1_onlpatch1_ONLINE, CMSSW_3_6_0_pre1, pe20100223c-for36X, pe20100223b-for36X, pe20100223a-for36X, CMSSW_3_5_2, apFor352v0, apFor351p2v0, CMSSW_3_5_1_patch1, for351patch1, CMSSW_3_5_1_ONLINE, dsr20100216fwlite350, CMSSW_3_5_1, pe20100216b-for36Xmin, pe20100216a-for36X, apFor351v0, ge20100215-rootqt-r522, ge20100215-rootqt-pre5r526, CMSSW_3_5_0_pre5r526, ge20100212-boost, ge20100112-boost, dsr20100209fwlite342, CMSSW_3_5_0_patch1, CMSSW_3_4_2_patch1, for350patch1, for342patch1, CMSSW_3_5_0_ONLINE, CMSSW_3_4_2, fwFor350online, CMSSW_3_5_0, apFor350v0, pe20100205a-for35X, eskFor342, pe20100204a-for35X, for341op1-onl-slc5, CMSSW_3_5_0_pre5_ONLINE, for350p5-onl-slc5, pe20100131c-for35Xr526, pe20100131b-for35Xr526, pe20100131a-for35Xr526, CMSSW_3_5_0_pre5g493, pe20100130b-for35Xg493, pe20100130-for35Xg493, CMSSW_3_5_0_pre5, for350p4-onl-slc5, pe20100129a-for35X, CMSSW_3_5_0_pre4, apFor350pre5v0, sm100128a, sm100128, apFor350pre4v0, pe20100127e-for35X, pe20100127d-for35X, pe20100127c-for35X, sm100127-onl35x, CMSSW_3_4_1_ONLINE, pe20100127b-for35X, pe20100127a-for35X, sm100126, pe20100124a-for35X, ap20100123a-for35X, CMSSW_3_5_0_pre3, apFor350pre3v0, pe20100113a-for35X, sm20100113a-for35X, sm20100113-for35X, pe20100112b-for35X, sm20100112a-for35X, sm20100112-for35X, pe20100112-for35X, dsr20100107fwlite341, sm100107a, sm100106a, sm100105c, sm100105b, pe20100105a-for34X-for35X, ge20100105-pyqt-relocatable-build, sm100105a, pe20091227a-ports, CMSSW_3_5_0_pre2, CMSSW_3_4_1, apFor350pre2v2, apFor350pre2v1, apFor350pre2v0, eskFor341, pe20091216b-for34X-for35X, pe20091216a-for34X-for35X, CMSSW_3_4_0, ge20091214b-new-bootstrap, ge20091214a-new-bootstrap, ge20091214-new-bootstrap, ge20091214-fix-rh5x, CMSSW_3_5_0_pre1, apFor350pre1v0, eskFor340, pe20091209b-for34X-for35X, pe20091209a-for34X-for35X, CMSSW_3_4_0_pre7, eskFor340p7-slc5-gcc434, dg20091203b-comp-base, DAS_20091202, pe20091201a-for34X-slc5-gcc434, DQMCATTEST_0_0_1, pe20091130b-for34X-slc5-gcc434, pe20091130a-for34X-slc5-gcc434, pe20091120c-for34X-slc5-gcc434, CMSSW_3_4_0_pre6, pe20091120b-for34X-slc5-gcc434, pe20091120a-for34X-slc5-gcc434, pe20091119b-for34X-slc5-gcc434, pe20091119a-for34X-slc5-gcc434, eskFor340p6-slc5-gcc434, DAS_20091117, pe20091116a-for34X-slc5-gcc434, pe20091114a-for34X-slc5-gcc434, pe20091113c-for34X-slc5-gcc434
Changes since 1.57: +1 -1 lines
Log Message:
Same change introduced by Andreas in rev 1.56 on top of python2.4 version
of this file:
updated removal of _tkinter.so such that it also works when there is
no _tkinter.so (as in slc5onl)
The change is only applied in the online builds.

File Contents

# User Rev Content
1 elmer 1.57 ### RPM external python 2.6.4
2 eulisse 1.3 ## INITENV +PATH PATH %i/bin
3     ## INITENV +PATH LD_LIBRARY_PATH %i/lib
4 argiro 1.1 # OS X patches and build fudging stolen from fink
5 elmer 1.55 %define closingbrace )
6 elmer 1.57 %define online %(case %cmsplatf in *onl_*_*%closingbrace echo true;; *%closingbrace echo false;; esac)
7 ratnik 1.34
8     Requires: expat bz2lib db4 gdbm
9    
10 elmer 1.55 %if "%online" != "true"
11 elmer 1.57 Requires: zlib openssl sqlite
12 ratnik 1.34 %endif
13    
14 eulisse 1.8 # FIXME: readline, crypt
15 argiro 1.1 # FIXME: gmp, panel, tk/tcl, x11
16    
17 elmer 1.24 Source0: http://www.python.org/ftp/%n/%realversion/Python-%realversion.tgz
18 elmer 1.13 Patch0: python-Include-pyport.h
19     Patch1: python-Lib-plat-mac-applesingle.py
20     Patch2: python-Lib-site.py
21     Patch3: python-Mac-OSX-Makefile
22     Patch4: python-Makefile.pre.in
23     Patch5: python-configure
24     Patch6: python-setup.py
25 argiro 1.1
26 steen 1.19
27 argiro 1.1 %prep
28 elmer 1.24 %setup -n Python-%realversion
29 elmer 1.13 #%patch0
30     #%patch1
31     #%patch2
32     #%patch3
33     #%patch4
34     #%patch5
35     #%patch6
36 eulisse 1.5 perl -p -i -e "s|#!.*/usr/local/bin/python|#!/usr/bin/env python|" Lib/cgi.py
37    
38 valya 1.48 %ifos darwin
39 argiro 1.1 sed 's|@PREFIX@|%i|g' < %_sourcedir/python-osx | patch -p1
40     %endif
41    
42     %build
43     # Python is awkward about passing other include or library directories
44     # to it. Basically there is no way to pass anything from configure to
45     # make, or down to python itself. To get python detect the extensions
46     # we want to enable, we simply have to link the contents into python's
47     # own include/lib directories. Ugh.
48     #
49     # NB: It would sort-of make sense to link more stuff from /sw on OS X,
50     # but we simply cannot link the whole world. If you need something,
51     # see above for the commented-out list of packages that could be
52     # linked specifically, or could be built by ourselves, depending on
53     # whether we like to pick up system libraries or want total control.
54 elmer 1.57 #mkdir -p %i/include %i/lib
55     mkdir -p %i/include %i/lib %i/bin
56 ratnik 1.34
57 elmer 1.55 %if "%online" != "true"
58 elmer 1.57 %define extradirs $ZLIB_ROOT $OPENSSL_ROOT $SQLITE_ROOT
59 ratnik 1.34 %else
60     %define extradirs %{nil}
61     %endif
62    
63     dirs="$EXPAT_ROOT $BZ2LIB_ROOT $NCURSES_ROOT $DB4_ROOT $GDBM_ROOT %{extradirs}"
64    
65 eulisse 1.16 echo $dirs
66 argiro 1.1 for d in $dirs; do
67     for f in $d/include/*; do
68 eulisse 1.29 [ -e $f ] || continue
69 argiro 1.1 rm -f %i/include/$(basename $f)
70     ln -s $f %i/include
71     done
72     for f in $d/lib/*; do
73 eulisse 1.29 [ -e $f ] || continue
74 argiro 1.1 rm -f %i/lib/$(basename $f)
75     ln -s $f %i/lib
76     done
77     done
78    
79 eulisse 1.39 additionalConfigureOptions=""
80     case %cmsplatf in
81     osx105* )
82     additionalConfigureOptions="--disable-readline"
83     ;;
84     esac
85    
86     ./configure --prefix=%i $additionalConfigureOptions --enable-shared \
87     --without-tkinter --disable-tkinter
88    
89 ratnik 1.38 # The following is a kludge around the fact that the /usr/lib/libreadline.so
90     # symlink (for 32-bit lib) is missing on the 64bit machines
91 elmer 1.57 case %cmsplatf in
92     slc4_ia32* )
93     mkdir -p %{i}/lib
94     ln -s /usr/lib/libreadline.so.4.3 %{i}/lib/libreadline.so
95     ;;
96     esac
97 ratnik 1.38 make %makeprocesses
98 ratnik 1.37
99 argiro 1.1 %install
100     make install
101 elmer 1.24 %define pythonv %(echo %realversion | cut -d. -f 1,2)
102 eulisse 1.8
103 elmer 1.57 case %cmsplatf in
104     osx*)
105     make install prefix=%i
106     (cd Misc; /bin/rm -rf RPM)
107     mkdir -p %i/share/doc/%n
108     cp -R Demo Doc %i/share/doc/%n
109     cp -R Misc Tools %i/lib/python%{pythonv}
110     gcc -dynamiclib -all_load -single_module \
111     -framework System -framework CoreServices -framework Foundation \
112     %i/lib/python%{pythonv}/config/libpython%{pythonv}.a \
113     -undefined dynamic_lookup \
114     -o %i/lib/python%{pythonv}/config/libpython%{pythonv}.dylib \
115     -install_name %i/lib/python%{pythonv}/config/libpython%{pythonv}.dylib \
116     -current_version %{pythonv} -compatibility_version %{pythonv} -ldl
117     (cd %i/lib/python%{pythonv}/config
118     perl -p -i -e 's|-fno-common||g' Makefile)
119    
120     find %i/lib/python%{pythonv}/config -name 'libpython*' -exec mv {} %i/lib \;
121     ;;
122     esac
123 eulisse 1.9
124     perl -p -i -e "s|^#!.*python|#!/usr/bin/env python|" %{i}/bin/idle \
125     %{i}/bin/pydoc \
126 elmer 1.57 %{i}/bin/python-config \
127     %{i}/bin/2to3 \
128     %{i}/bin/python2.6-config \
129 eulisse 1.9 %{i}/bin/smtpd.py \
130 elmer 1.57 %{i}/lib/python2.6/bsddb/dbshelve.py \
131     %{i}/lib/python2.6/test/test_bz2.py \
132     %{i}/lib/python2.6/test/test_largefile.py \
133     %{i}/lib/python2.6/test/test_optparse.py
134 eulisse 1.17 rm `find %{i}/lib -maxdepth 1 -mindepth 1 ! -name '*python*'`
135 eulisse 1.18 rm `find %{i}/include -maxdepth 1 -mindepth 1 ! -name '*python*'`
136 muzaffar 1.28
137 elmer 1.55 %if "%online" == "true"
138 valya 1.48 # remove tkinter that brings dependency on libtk:
139 elmer 1.58 find %{i}/lib -type f -name "_tkinter.so" -exec rm {} \;
140 elmer 1.55 %endif
141 valya 1.48
142 muzaffar 1.28 # SCRAM ToolBox toolfile
143     mkdir -p %i/etc/scram.d
144     cat << \EOF_TOOLFILE >%i/etc/scram.d/%n
145     <doc type=BuildSystem::ToolDoc version=1.0>
146     <Tool name=%n version=%v>
147 elmer 1.57 <lib name=python2.6>
148 muzaffar 1.28 <Client>
149     <Environment name=PYTHON_BASE default="%i"></Environment>
150     <Environment name=LIBDIR default="$PYTHON_BASE/lib"></Environment>
151 elmer 1.57 <Environment name=INCLUDE default="$PYTHON_BASE/include/python2.6"></Environment>
152     <Environment name=PYTHON_COMPILE default="$PYTHON_BASE/lib/python2.6/compileall.py"></Environment>
153 muzaffar 1.28 </Client>
154     <use name=sockets>
155     <Runtime name=PATH value="$PYTHON_BASE/bin" type=path>
156     </Tool>
157     EOF_TOOLFILE
158    
159 elmer 1.57 # Makes sure that executables start with /usr/bin/env perl and not with comments.
160     find %i -type f -perm -555 -name '*.py' -exec perl -p -i -e 'if ($. == 1) {s|^"""|#/usr/bin/env python\n"""|}' {} \;
161     find %i -type f -perm -555 -name '*.py' -exec perl -p -i -e 'if ($. == 1) {s|^\'\'\'|#/usr/bin/env python\n\'\'\'|}' {} \;
162     find %i -type f -perm -555 -name '*.py' -exec perl -p -i -e 'if ($. == 1) {s|/usr/local/bin/python|/usr/bin/env python|}' {} \;
163     rm -f %i/share/doc/python/Demo/rpc/test
164    
165 eulisse 1.16 %post
166     find $RPM_INSTALL_PREFIX/%pkgrel/lib -type l | xargs ls -la | sed -e "s|.*[ ]\(/.*\) -> \(.*\)| \2 \1|;s|[ ]/[^ ]*/external| $RPM_INSTALL_PREFIX/%cmsplatf/external|g" | xargs -n2 ln -sf
167 muzaffar 1.28 %{relocateConfig}etc/scram.d/%n