ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/python.spec
Revision: 1.97
Committed: Thu Sep 6 13:42:19 2012 UTC (12 years, 7 months ago) by davidlt
Branch: MAIN
CVS Tags: CMSSW_6_1_0_pre7_TS127013-slc5_amd64_gcc472, CMSSW_6_1_0_pre7_TS127013, davidlt_20121204_1200-61X-osx107-gcc472, davidlt_20121204_1200-61X-osx108-gcc472, davidlt_20121204_1200-61X-slc6-gcc472, davidlt_20121204_1200-61X-gcc472, daForCMSSW_6_1_0_pre7_TS127013-slc5_amd64_gcc472, davidlt_20121204_0745-61X-osx107-gcc472, davidlt_20121204_0743-61X-osx108-gcc472, davidlt_20121204_0844-61X-slc6-gcc472, davidlt_20121204_0843-61X-gcc472, davidlt_20121203_1104-61X-osx107-gcc472, davidlt_20121203_0957-61X-osx108-gcc472, davidlt_20121203_0956-61X-slc6-gcc472, davidlt_20121203_0955-61X-gcc472, CMSSW_6_1_0_pre7-osx108_amd64_gcc472, CMSSW_6_1_0_pre7-osx107_amd64_gcc472, eulisse_20121129_1546-61X-gcc472, eulisse_20121129_1439-61X-gcc472, eulisse_20121129_1406-61X-gcc472, daForCMSSW_6_1_0_pre7-osx108_amd64_gcc472, daForCMSSW_6_1_0_pre7-osx107_amd64_gcc472, eulisse_20121129_1155-61X-gcc472, CMSSW_6_1_0_pre7-slc5_amd64_gcc472, CMSSW_6_1_0_pre7, daForCMSSW_6_1_0_pre7-slc5_amd64_gcc472, davidlt_20121128_0903-61X-osx107-gcc472, davidlt_20121128_0902-61X-osx108-gcc472, davidlt_20121128_0904-61X-slc6-gcc472, davidlt_20121128_0902-61X-gcc472, davidlt_20121127_1909-61X-osx108-gcc472, davidlt_20121127_1909-61X-osx107-gcc472, davidlt_20121127_1908-61X-slc6-gcc472, davidlt_20121127_1907-61X-gcc472, davidlt_20121127_1044-61X-osx107-gcc472, davidlt_20121127_1028-osx108-gcc472, davidlt_20121127_1020-61X-slc6-gcc472, davidlt_20121127_1012-gcc472, eulisse_20121126_2202_61X-gcc472, CMSSW_6_1_0_pre6_TS126203_TS126341_patch1-slc5_amd64_gcc472, CMSSW_6_1_0_pre6_TS126203_TS126341_patch1, daForCMSSW_6_1_0_pre6_TS126203_TS126341_patch1-slc5_amd64_gcc472, CMSSW_6_1_0_pre6g496cand01-slc5_amd64_gcc472, CMSSW_6_1_0_pre6g496cand01, daForCMSSW_6_1_0_pre6g496cand01-slc5_amd64_gcc472, davidlt_20121122_1002-61X-g496cand01-gcc472, CMSSW_6_1_0_pre6-osx108_amd64_gcc472, CMSSW_6_1_0_pre6-osx107_amd64_gcc472, eulisse_20121120_1136_61X-gcc472, daForCMSSW_6_1_0_pre6-osx107_amd64_gcc472, daForCMSSW_6_1_0_pre6-osx108_amd64_gcc472, ForCMSSW_6_1_0_pre6-slc6_amd64_gcc472, davidlt_20121119_1533-61X-g496cand01-gcc472, CMSSW_6_1_0_pre6_TS126203_TS126341-slc5_amd64_gcc472, CMSSW_6_1_0_pre6_TS126203_TS126341, daForCMSSW_6_1_0_pre6_TS126203_TS126341-slc5_amd64_gcc472, CMSSW_6_1_0_pre6-slc5_amd64_gcc472, CMSSW_6_1_0_pre6, daForCMSSW_6_1_0_pre6-slc5_amd64_gcc472, davidlt_20121113_0821-61X-osx107-gcc472, davidlt_20121113_0816-osx108-gcc472, davidlt_20121113_0835-61X-slc6-gcc472, davidlt_20121113_0819-61X-gcc472, davidlt_20121110_0800-osx108-gcc472, davidlt_20121109_1131-61X-osx107-gcc472, davidlt_20121109_1130-61X-slc6-gcc472, davidlt_20121109_1127-0735-61X-gcc472, eulisse_20121107-0735-61X-gcc472, davidlt_20121105_1212-osx108-gcc472, davidlt_20121105_1128-61X-osx107-gcc472, davidlt_20121105_1127-61X-slc6-gcc472, davidlt_20121105_1126-61X-gcc472, CMSSW_6_1_0_pre5-slc5_amd64_gcc472, CMSSW_6_1_0_pre5, daForCMSSW_6_1_0_pre5-slc5_amd64_gcc472, davidlt_20121101_1230-osx108-gcc472, davidlt_20121101_1230-61X-gcc472, davidlt_20121101_1230-61X-osx107-gcc472, davidlt_20121101_1230-61X-slc6-gcc472, davidlt_20121030_1450-osx108-gcc472, davidlt_20121030_1450-61X-slc6-gcc472, davidlt_20121030_1450-61X-osx107-gcc472, davidlt_20121030_1450-61X-gcc472, davidlt_20121029_1240-osx108-gcc472, davidlt_20121029_1251-61X-osx107-gcc472, davidlt_20121029_1108-61X-slc6-gcc472, davidlt_20121029_1056-61X-gcc472, eulisse_20121026_1128-61X-gcc472, eulisse_20121025_1358-61X-gcc472, davidlt_20121025_1106-osx108-gcc472, davidlt_20121025_1108-61X-osx107-gcc472, davidlt_20121025_1107-61X-slc6-gcc472, davidlt_20121025_1106-61X-gcc472, davidlt_20121024_1014-osx108-gcc472, davidlt_20121024_1014-61X-osx107-gcc472, davidlt_20121024_1013-61X-slc6-gcc472, davidlt_20121024_1011-61X-gcc472, eulisse_20121024_0912-61X-gcc472, eulisse_20121023_0912-61X-gcc472, davidlt_20121023_1647-61X-osx107-gcc472, BOOTSTRAP_osx107_amd64_gcc472, eulisse_20121023_1600-61X-gcc472, davidlt_20121023_1155-61X-slc6-gcc472, BOOTSTRAP_slc6_amd64_gcc472, eulisse_20121017_1120-61X-gcc472, CMSSW_6_1_0_pre4-osx108_amd64_gcc472, CMSSW_6_1_0_pre4-osx107_amd64_gcc462, CMSSW_6_1_0_pre4-slc6_amd64_gcc462, eulisse_20121015_1727-61X-gcc472, daForCMSSW_6_1_0_pre4-osx108_amd64_gcc472, daForCMSSW_6_1_0_pre4-osx107_amd64_gcc462, ForCMSSW_6_1_0_pre4-slc6_amd64_gcc462, CMSSW_6_1_0_pre4-slc5_amd64_gcc472, CMSSW_6_1_0_pre4-slc5_amd64_gcc462, CMSSW_6_1_0_pre4, CMSSW_6_1_0_pre3_TS124729-slc5_amd64_gcc462, daForCMSSW_6_1_0_pre4-slc5_amd64_gcc472, daForCMSSW_6_1_0_pre4-slc5_amd64_gcc462, CMSSW_6_1_0_pre3_TS124729, eulisse_20121011_1741-61X-gcc472, eulisse_20121011_1728-61X-gcc472, eulisse_20121011_1718-61X-gcc472, daForCMSSW_6_1_0_pre3_TS124729-slc5_amd64_gcc462, davidlt_20121009_1600-61X-slc6, davidlt_20121009_1600-61X-osx107, davidlt_20121009_1600-61X-gcc472, davidlt_20121009_1600-61X, davidlt_20121009_1530-osx108-gcc472, davidlt_20121008_1222-osx108-gcc472, davidlt_20121008_1257-61X-osx107, davidlt_20121008_1223-61X-slc6, davidlt_20121008_1221-61X-gcc472, davidlt_20121008_1220-61X, davidlt_20121005_1417-61X-osx108_amd64_gcc472, BOOTSTRAP_osx108_amd64_gcc472, davidlt_20121003_1452-61X-gcc472, davidlt_2, davidlt_1, eulisse_20121003_1138-61X-gcc470, CMSSW_6_1_0_pre3-osx108_amd64_gcc470, CMSSW_6_1_0_pre3-osx107_amd64_gcc462, CMSSW_6_1_0_pre3-slc6_amd64_gcc462, CMSSW_6_1_0_pre3-slc5_amd64_gcc470, eulisse_20121001_1347-61X-gcc470, CMSSW_6_1_0_pre3-slc5_amd64_gcc462, CMSSW_6_1_0_pre3, daForCMSSW_6_1_0_pre3-osx108_amd64_gcc470, daForCMSSW_6_1_0_pre3-osx107_amd64_gcc462, ForCMSSW_6_1_0_pre3-slc6_amd64_gcc462, daForCMSSW_6_1_0_pre3-slc5_amd64_gcc470, daForCMSSW_6_1_0_pre3-slc5_amd64_gcc462, eulisse_20120930_1000-61X-gcc470, eulisse_20120928_0244-61X-gcc470, eulisse_20120928_0219-61X-gcc470, eulisse_20120928_0150-61X-gcc470, davidlt_20120927_1517-61X-osx108, davidlt_20120927_1510-61X-osx107, davidlt_20120927_1511-61X-slc6, davidlt_20120927_1508-61X-gcc470, davidlt_20120927_1507-61X, BOOTSTRAP_slc5_amd64_gcc472, davidlt_20120925_1134-61X-osx108, davidlt_20120925_1135-61X-osx107, davidlt_20120925_1129-61X-slc6, davidlt_20120925_1124-61X-gcc470, davidlt_20120925_1123-61X, davidlt_20120921_1153-61X-osx107, davidlt_20120921_1158-61X-slc6, davidlt_20120921_1151-61X-osx108, davidlt_20120921_1150-61X-gcc470, davidlt_20120921_1150-61X, davidlt_20120920_1536-61X-osx107, davidlt_20120920_1529-61X-osx108, davidlt_20120920_1529-61X-slc6, davidlt_20120920_1528-61X-gcc470, davidlt_20120920_1527-61X, eulisse_20120920_1429-61X-gcc470, CMSSW_6_1_0_pre2-slc6_amd64_gcc462, CMSSW_6_1_0_pre2-slc5_amd64_gcc470, CMSSW_6_1_0_pre2-osx107_amd64_gcc462, CMSSW_6_1_0_pre2-osx108_amd64_gcc470, CMSSW_6_1_0_pre2-slc5_amd64_gcc462, CMSSW_6_1_0_pre2, eulisse_20120918_2117-61X-gcc470, eulisse_20120918_1706-61X-gcc470, ForCMSSW_6_1_0_pre2-slc6_amd64_gcc462, daForCMSSW_6_1_0_pre2-slc5_amd64_gcc470, daForCMSSW_6_1_0_pre2-osx107_amd64_gcc462, daForCMSSW_6_1_0_pre2-osx108_amd64_gcc470, daForCMSSW_6_1_0_pre2-slc5_amd64_gcc462, davidlt_20120917_0750-61X-osx108, davidlt_20120917_0748-61X-osx107, davidlt_20120917_0802-61X-slc6, davidlt_20120917_0746-61X-gcc470, davidlt_20120917_0745-61X, davidlt_20120914_1755-61X-osx108, davidlt_20120914_1415-61X-osx107, davidlt_20120914_1414-61X-slc6, davidlt_20120914_1412-61X-gcc470, davidlt_20120914_1412-61X, davidlt_20120914_1040-61X-osx108, davidlt_20120914_1040-61X-osx107, davidlt_20120914_1039-61X-slc6, davidlt_20120914_1109-61X-gcc470, davidlt_20120914_1042-61X, davidlt_20120912_1154-61X-osx107, davidlt_20120912_1156-61X-slc6, davidlt_20120912_1130-61X-gcc470, davidlt_20120912_1127-61X, davidlt_20120911_0937-61X-osx108, davidlt_20120910_1500-61X-osx108, davidlt-20120910-1500-61X-osx108_amd64_gcc470, davidlt-20120910-1247-61X-osx108_amd64_gcc470
Changes since 1.96: +2 -0 lines
Log Message:
Bring back python-2.7.3-dont-detect-dbm patch to avoid MacPorts.

File Contents

# User Rev Content
1 fwyzard 1.96 ### RPM external python 2.7.3
2 eulisse 1.3 ## INITENV +PATH PATH %i/bin
3     ## INITENV +PATH LD_LIBRARY_PATH %i/lib
4 lat 1.73 ## INITENV SETV PYTHON_LIB_SITE_PACKAGES lib/python%{python_major_version}/site-packages
5 fwyzard 1.96 ## INITENV SETV PYTHONHASHSEED random
6 argiro 1.1 # OS X patches and build fudging stolen from fink
7 lat 1.73 %{expand:%%define python_major_version %(echo %realversion | cut -d. -f1,2)}
8     %define online %(case %cmsplatf in (*onl_*_*) echo true;; (*) echo false;; esac)
9 dsr 1.62
10 fwyzard 1.95 Requires: expat bz2lib db4 gdbm openssl
11 ratnik 1.34
12 elmer 1.55 %if "%online" != "true"
13 fwyzard 1.95 Requires: zlib sqlite
14 ratnik 1.34 %endif
15    
16 eulisse 1.8 # FIXME: readline, crypt
17 argiro 1.1 # FIXME: gmp, panel, tk/tcl, x11
18    
19 dsr 1.62 Source0: http://www.python.org/ftp/%n/%realversion/Python-%realversion.tgz
20 davidlt 1.97 Patch0: python-2.7.3-dont-detect-dbm
21 fwyzard 1.96 Patch1: python-fix-macosx-relocation
22     Patch2: python-2.7.3-fix-pyport
23     Patch3: python-2.7.3-ssl-fragment
24 steen 1.19
25 argiro 1.1 %prep
26 dsr 1.62 %setup -n Python-%realversion
27 lat 1.74 find . -type f | while read f; do
28     if head -n1 $f | grep -q /usr/local; then
29     perl -p -i -e "s|#!.*/usr/local/bin/python|#!/usr/bin/env python|" $f
30     else :; fi
31     done
32 davidlt 1.97 %patch0 -p1
33 fwyzard 1.96 %patch1 -p0
34 dsr 1.92
35 fwyzard 1.96 %ifos darwin
36     %patch2 -p1
37     %endif
38    
39     %patch3 -p1
40 davidlt 1.93
41 argiro 1.1 %build
42     # Python is awkward about passing other include or library directories
43     # to it. Basically there is no way to pass anything from configure to
44     # make, or down to python itself. To get python detect the extensions
45     # we want to enable, we simply have to link the contents into python's
46     # own include/lib directories. Ugh.
47     #
48     # NB: It would sort-of make sense to link more stuff from /sw on OS X,
49     # but we simply cannot link the whole world. If you need something,
50     # see above for the commented-out list of packages that could be
51     # linked specifically, or could be built by ourselves, depending on
52     # whether we like to pick up system libraries or want total control.
53 dsr 1.62 #mkdir -p %i/include %i/lib
54     mkdir -p %i/include %i/lib %i/bin
55 ratnik 1.34
56 elmer 1.55 %if "%online" != "true"
57 fwyzard 1.95 %define extradirs $ZLIB_ROOT $SQLITE_ROOT
58 ratnik 1.34 %else
59     %define extradirs %{nil}
60     %endif
61    
62     dirs="$EXPAT_ROOT $BZ2LIB_ROOT $NCURSES_ROOT $DB4_ROOT $GDBM_ROOT %{extradirs}"
63    
64 eulisse 1.70 # We need to export it because setup.py now uses it to determine the actual
65     # location of DB4, this was needed to avoid having it picked up from the system.
66     export DB4_ROOT
67    
68 davidlt 1.83 # Python's configure parses LDFLAGS and CPPFLAGS to look for aditional library and include directories
69 eulisse 1.16 echo $dirs
70 davidlt 1.83 LDFLAGS=""
71     CPPFLAGS=""
72 argiro 1.1 for d in $dirs; do
73 davidlt 1.83 LDFLAGS="$LDFLAGS -L $d/lib"
74     CPPFLAGS="$CPPFLAGS -I $d/include"
75 argiro 1.1 done
76 davidlt 1.83 export LDFLAGS
77     export CPPFLAGS
78 argiro 1.1
79 eulisse 1.39 additionalConfigureOptions=""
80     case %cmsplatf in
81     osx105* )
82     additionalConfigureOptions="--disable-readline"
83     ;;
84     esac
85    
86 fwyzard 1.96 # 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 dsr 1.92
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
122     case %cmsplatf in
123     slc4_ia32* )
124     mkdir -p %{i}/lib
125     ln -s /usr/lib/libreadline.so.4.3 %{i}/lib/libreadline.so
126     ;;
127     esac
128 fwyzard 1.96
129 ratnik 1.38 make %makeprocesses
130 ratnik 1.37
131 argiro 1.1 %install
132 eulisse 1.71 # We need to export it because setup.py now uses it to determine the actual
133     # location of DB4, this was needed to avoid having it picked up from the system.
134     export DB4_ROOT
135 fwyzard 1.81 make install
136 dsr 1.62 %define pythonv %(echo %realversion | cut -d. -f 1,2)
137 eulisse 1.8
138 dsr 1.62 case %cmsplatf in
139     osx*)
140     make install prefix=%i
141     (cd Misc; /bin/rm -rf RPM)
142     mkdir -p %i/share/doc/%n
143     cp -R Demo Doc %i/share/doc/%n
144     cp -R Misc Tools %i/lib/python%{pythonv}
145     gcc -dynamiclib -all_load -single_module \
146     -framework System -framework CoreServices -framework Foundation \
147     %i/lib/python%{pythonv}/config/libpython%{pythonv}.a \
148     -undefined dynamic_lookup \
149     -o %i/lib/python%{pythonv}/config/libpython%{pythonv}.dylib \
150     -install_name %i/lib/python%{pythonv}/config/libpython%{pythonv}.dylib \
151     -current_version %{pythonv} -compatibility_version %{pythonv} -ldl
152     (cd %i/lib/python%{pythonv}/config
153     perl -p -i -e 's|-fno-common||g' Makefile)
154    
155     find %i/lib/python%{pythonv}/config -name 'libpython*' -exec mv -f {} %i/lib \;
156     ;;
157     esac
158 eulisse 1.9
159 fwyzard 1.96 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 eulisse 1.67
166     find %{i}/lib -maxdepth 1 -mindepth 1 ! -name '*python*' -exec rm {} \;
167     find %{i}/include -maxdepth 1 -mindepth 1 ! -name '*python*' -exec rm {} \;
168 muzaffar 1.28
169 lat 1.74 # remove executable permission anything which is *.py script,
170     # is executable, but does not start with she-bang so not valid
171     # executable; this avoids problems with rpm 4.8+ find-requires
172     find %i -name '*.py' -perm +0111 | while read f; do
173     if head -n1 $f | grep -q '"'; then chmod -x $f; else :; fi
174     done
175    
176 valya 1.48 # remove tkinter that brings dependency on libtk:
177 elmer 1.58 find %{i}/lib -type f -name "_tkinter.so" -exec rm {} \;
178 valya 1.48
179 eulisse 1.77 # Remove documentation, examples and test files.
180 fwyzard 1.96 %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 diego 1.75
189     # Remove .pyo files
190     find %i -name '*.pyo' -exec rm {} \;
191    
192 lat 1.68 # Generate dependencies-setup.{sh,csh} so init.{sh,csh} picks full environment.
193 diego 1.63 mkdir -p %i/etc/profile.d
194 lat 1.68 : > %i/etc/profile.d/dependencies-setup.sh
195     : > %i/etc/profile.d/dependencies-setup.csh
196     for tool in $(echo %{requiredtools} | sed -e's|\s+| |;s|^\s+||'); do
197     root=$(echo $tool | tr a-z- A-Z_)_ROOT; eval r=\$$root
198     if [ X"$r" != X ] && [ -r "$r/etc/profile.d/init.sh" ]; then
199     echo "test X\$$root != X || . $r/etc/profile.d/init.sh" >> %i/etc/profile.d/dependencies-setup.sh
200     echo "test X\$$root != X || source $r/etc/profile.d/init.csh" >> %i/etc/profile.d/dependencies-setup.csh
201     fi
202 diego 1.63 done
203    
204 eulisse 1.16 %post
205 fwyzard 1.96 %{relocateConfig}lib/python2.7/config/Makefile
206 lat 1.68 %{relocateConfig}etc/profile.d/dependencies-setup.*sh