ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/python.spec
Revision: 1.100
Committed: Tue Dec 4 11:02:17 2012 UTC (12 years, 4 months ago) by eulisse
Branch: MAIN
CVS Tags: cmsbuild_20130311_1500-61X-osx107, cmsbuild_20130311_1424-61X-osx108-gcc472, cmsbuild_20130327-61X-slc6, cmsbuild_20130405_1715-61X-gcc472, dmendezlForCMSSW_6_1_2_SLHC1-slc5_amd64_gcc472, CMSSW_6_1_2_SLHC1-slc5_amd64_gcc472, CMSSW_6_1_2_SLHC1, davidltForCMSSW_6_1_2_SLHC1-slc5_amd64_gcc472, sm130402-63X-slc5_mic, eulisseForCMSSW_6_1_2-slc6_amd64_gcc472, dmendezlForCMSSW_6_1_2-slc6_amd64_gcc472, davidlt_20130328_0731-62X-next, davidlt_20130328_0731-62X, dm20130327-61X-slc6, dgmlForCMSSW_6_1_2-osx107_amd64_gcc472, dgmlForCMSSW_6_1_2-osx108_amd64_gcc472, CMSSW_6_1_2, ForCMSSW_6_1_2-slc6_amd64_gcc472, davidlt_20130325_1139-62X-next, davidlt_20130325_1353-62X-next, davidlt_20130325_1131-62X-next, davidlt_20130325_1108-62X, dgmlForCMSSW_6_1_2-slc5_amd64_gcc472, CMSSW_6_2_0_pre4-slc6_amd64_gcc472, ForCMSSW_6_2_0_pre4-slc6_amd64_gcc472, CMSSW_6_2_0_pre4-osx107_amd64_gcc472, CMSSW_6_2_0_pre4-osx108_amd64_gcc472, daForCMSSW_6_2_0_pre4-osx107_amd64_gcc472, daForCMSSW_6_2_0_pre4-osx108_amd64_gcc472, CMSSW_6_2_0_pre4-slc5_amd64_gcc472, CMSSW_6_2_0_pre4, daForCMSSW_6_2_0_pre4-slc5_amd64_gcc472, pgForCMSSW_6_2_X_2013-03-15-0200-slc5_amd64_gcc472, davidlt_20130314_1540-62X-next, dmendezl_20130312_1520-slc6, dmendezl_20130311_1500-61X-osx107, dmendezl_20130311_1424-61X-osx108-gcc472, eulisse_20130311_0939-61X, geForCMSSW_6_1_2-slc5_amd64_gcc472, davidlt_20130307_0945-62X-next, davidlt_20130307_0943-62X, CMSSW_6_2_0_pre3-osx107_amd64_gcc472, CMSSW_6_2_0_pre3-osx108_amd64_gcc472, eulisse_20130405_1715-61X-gcc472, eulisse_20130304_1715-61X-osx107, eulisse_20130304_1715-61X-osx108-gcc472, eulisse_20130304_1714_61X-slc6, daForCMSSW_6_2_0_pre3-osx107_amd64_gcc472, daForCMSSW_6_2_0_pre3-osx108_amd64_gcc472, CMSSW_6_2_0_pre3-slc6_amd64_gcc472, ForCMSSW_6_2_0_pre3-slc6_amd64_gcc472, CMSSW_6_2_0_pre3-slc5_amd64_gcc472, CMSSW_6_2_0_pre3, CMSSW_6_1_1-osx108_amd64_gcc472, CMSSW_6_1_1-osx107_amd64_gcc472, daForCMSSW_6_2_0_pre3-slc5_amd64_gcc472, daForCMSSW_6_1_1-osx108_amd64_gcc472, daForCMSSW_6_1_1-osx107_amd64_gcc472, CMSSW_6_1_1_SLHCphase2tk1-slc5_amd64_gcc472, CMSSW_6_1_1_SLHCphase2tk1, daForCMSSW_6_1_1_SLHCphase2tk1-slc5_amd64_gcc472, davidlt_20130227_1855-62X-next, davidlt_20130227_1854-62X, davidlt_20130227_1127-62X-next, davidlt_20130227_1125-62X, davidlt_20130226_1240-62X-next, davidlt_20130226_1239-62X, CMSSW_6_1_1_SLHCphase1tk1-slc5_amd64_gcc472, CMSSW_6_1_1_SLHCphase1tk1, daForCMSSW_6_1_1_SLHCphase1tk1-slc5_amd64_gcc472, eulisse_20130225_1400-62x-next, eulisse_20130225_1400-62x, davidlt_20130225_1102-62X-next, davidlt_20130225_1025-62X, davidlt_20130222_1635-62X-next, davidlt_20130222_1633-62X, davidlt_20130220_1737-62X-next, davidlt_20130220_1735-62X, daForCMSSW_6_2_0_pre2-osx107_amd64_gcc472, daForCMSSW_6_2_0_pre2-osx108_amd64_gcc472, ForCMSSW_6_2_0_pre2-slc6_amd64_gcc472, CMS_CONDWEB_DEV, CMS_CONDWEB_0_2, CMSSW_6_2_0_pre2-slc5_amd64_gcc472, CMSSW_6_2_0_pre2, CMS_CONDWEB_0_1, daForCMSSW_6_2_0_pre2-slc5_amd64_gcc472, CMSSW_6_1_1-slc5_amd64_gcc472, CMSSW_6_1_1, daForCMSSW_6_1_1-slc5_amd64_gcc472, davidlt_20130212_1424-62X-next, davidlt_20130212_1424-62X, davidlt_20130212_1020-62X-next, davidlt_20130212_1001-62X, daForCMSSW_6_1_0_SLHC-slc5_amd64_gcc472, davidlt_20130209_1053-61X-osx107-gcc472, davidlt_20130209_1051-61X-osx108-gcc472, davidlt_20130209_1109-61X-slc6-gcc472, davidlt_20130208_1428-62X-next, davidlt_20130208_1427-62X, davidlt_20130207_2033-61X-gcc472, davidlt_20130207_1856-62X, davidlt_20130206_2133-62X-next, davidlt_20130206_2129-62X-osx107-gcc472, davidlt_20130207_1345-62X-osx108-gcc472, davidlt_20130206_2133-62X-gcc472-next, davidlt_20130206_1150-62X-osx107-gcc472, davidlt_20130206_1150-62X-osx108-gcc472, davidlt_20130206_1149-62X-gcc472-next, davidlt_20130206_1149-62X, davidlt_20130206_0923-62X-osx107-gcc472, davidlt_20130206_0922-62X-osx108-gcc472, davidlt_20130206_0922-62X-gcc472-next, davidlt_20130206_0909-62X, davidlt_20130205_2014-62X-osx108-gcc472, davidlt_20130205_1941-62X-osx107-gcc472, davidlt_20130205_1942-62X-gcc472-next, davidlt_20130205_1939-62X, geForCMSSW_6_2_0_pre1-osx108_amd64_gcc472, geForCMSSW_6_2_0_pre1-osx107_amd64_gcc472, CMSSW_6_2_0_pre1, geForCMSSW_6_2_0_pre1-slc5_amd64_gcc472, ForCMSSW_6_1_0-slc6_amd64_gcc472, eulisse_20130128_1430-62X-gcc472-next, eulisse_20130128_1430-62X-slc6-gcc472, eulisse_20130128_1430-62X, davidlt_20130116_1037-62X-osx108-gcc472, davidlt_20130116_1009-62X-osx107-gcc472, davidlt_20130116_1008-62X-slc6-gcc472, davidlt_20130116_1043-62X, cms_adminFor-slc5_amd64_gcc472, eulisse_20130112_1105-62X, eulisse_20130112_0044-62X, eulisse_20130109_2108-62X-gcc472, eulisse_20121231_1245-61X-gcc472, eulisse_20121230_2125-61X-gcc472, CMSSW_6_1_0-osx107, CMSSW_6_1_0-osx108, CMSSW_6_1_0, eulisse_20121217_2120-61X-gcc472, eulisse_20121217_2135-61X-gcc472, eulisse_20121217_2127-61X-slc6-gcc472, eulisse_20121217_2059-61X-osx107-gcc472, eulisse_20121217_1941-61X-osx107-gcc472, eulisse_20121216_1036-61X-gcc472, eulisse_20121214_2046-61X-osx108-gcc472, eulisse_20121214_2022-61X-gcc472, eulisse_20121214_1049-61X-osx107-gcc472, eulisse_20121214_1044-61X-slc6-gcc472, eulisse_20121214_1009-61X-gcc472, eulisse_20121213_2246-61X-osx107-gcc472, eulisse_20121213_2133-61X-slc6-gcc472, eulisse_20121213_1659-61X-gcc472, davidlt_20121212_1833-61X-osx107-gcc472, davidlt_20121212_1832-61X-osx108-gcc472, davidlt_20121212_1831-61X-slc6-gcc472, davidlt_20121212_1831-61X-gcc472, CMSSW_6_1_0_pre8-slc5_amd64_gcc472, CMSSW_6_1_0_pre8, daForCMSSW_6_1_0_pre8-osx108_amd64_gcc472, daForCMSSW_6_1_0_pre8-osx107_amd64_gcc472, daForCMSSW_6_1_0_pre8-slc5_amd64_gcc472, davidlt_20121207_1047-61X-osx107-gcc472, davidlt_20121207_1046-61X-osx108-gcc472, davidlt_20121207_1045-61X-slc6-gcc472, davidlt_20121207_1045-61X-gcc472, davidlt_20121206_0901-61X-osx107-gcc472, davidlt_20121206_1159-61X-osx108-gcc472, davidlt_20121206_0900-61X-slc6-gcc472, davidlt_20121206_0859-61X-gcc472
Changes since 1.99: +3 -3 lines
Log Message:
Remove ncurses changes until we figure out how to make it work properly.

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 eulisse 1.100 Requires: zlib sqlite readline
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 eulisse 1.100 %define extradirs $ZLIB_ROOT $SQLITE_ROOT $READLINE_ROOT
58 ratnik 1.34 %else
59     %define extradirs %{nil}
60     %endif
61    
62 eulisse 1.100 dirs="$EXPAT_ROOT $BZ2LIB_ROOT $DB4_ROOT $GDBM_ROOT %{extradirs}"
63 ratnik 1.34
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 fwyzard 1.96 # Bugfix for dbm package. Use ndbm.h header and gdbm compatibility layer.
80     sed -ibak "s/ndbm_libs = \[\]/ndbm_libs = ['gdbm', 'gdbm_compat']/" setup.py
81    
82     ./configure --prefix=%i $additionalConfigureOptions --enable-shared
83    
84     # Modify pyconfig.h to match macros from GLIBC features.h on Linux machines.
85     # _POSIX_C_SOURCE and _XOPEN_SOURCE macros are not identical anymore
86     # starting GLIBC 2.10.1. Python.h is not included before standard headers
87     # in CMSSW and pyconfig.h is not smart enough to detect already defined
88     # macros on Linux. The following problem does not exists on BSD machines as
89     # cdefs.h does not define these macros.
90     case %cmsplatf in
91     slc6*)
92     rm -f cms_configtest.cpp
93     cat <<CMS_EOF > cms_configtest.cpp
94     #include <features.h>
95    
96     int main() {
97     return 0;
98     }
99     CMS_EOF
100    
101     FEATURES=$(g++ -dM -E -DGNU_GCC=1 -D_GNU_SOURCE=1 -D_DARWIN_SOURCE=1 cms_configtest.cpp \
102     | grep -E '_POSIX_C_SOURCE |_XOPEN_SOURCE ')
103     rm -f cms_configtest.cpp a.out
104    
105     POSIX_C_SOURCE=$(echo "${FEATURES}" | grep _POSIX_C_SOURCE | cut -d ' ' -f 3)
106     XOPEN_SOURCE=$(echo "${FEATURES}" | grep _XOPEN_SOURCE | cut -d ' ' -f 3)
107    
108     sed -ibak "s/\(#define _POSIX_C_SOURCE \)\(.*\)/\1${POSIX_C_SOURCE}/g" pyconfig.h
109     sed -ibak "s/\(#define _XOPEN_SOURCE \)\(.*\)/\1${XOPEN_SOURCE}/g" pyconfig.h
110     ;;
111     esac
112 dsr 1.92
113 ratnik 1.38 make %makeprocesses
114 ratnik 1.37
115 argiro 1.1 %install
116 eulisse 1.71 # We need to export it because setup.py now uses it to determine the actual
117     # location of DB4, this was needed to avoid having it picked up from the system.
118     export DB4_ROOT
119 fwyzard 1.81 make install
120 dsr 1.62 %define pythonv %(echo %realversion | cut -d. -f 1,2)
121 eulisse 1.8
122 dsr 1.62 case %cmsplatf in
123     osx*)
124     make install prefix=%i
125     (cd Misc; /bin/rm -rf RPM)
126     mkdir -p %i/share/doc/%n
127     cp -R Demo Doc %i/share/doc/%n
128     cp -R Misc Tools %i/lib/python%{pythonv}
129     gcc -dynamiclib -all_load -single_module \
130     -framework System -framework CoreServices -framework Foundation \
131     %i/lib/python%{pythonv}/config/libpython%{pythonv}.a \
132     -undefined dynamic_lookup \
133     -o %i/lib/python%{pythonv}/config/libpython%{pythonv}.dylib \
134     -install_name %i/lib/python%{pythonv}/config/libpython%{pythonv}.dylib \
135     -current_version %{pythonv} -compatibility_version %{pythonv} -ldl
136     (cd %i/lib/python%{pythonv}/config
137     perl -p -i -e 's|-fno-common||g' Makefile)
138    
139     find %i/lib/python%{pythonv}/config -name 'libpython*' -exec mv -f {} %i/lib \;
140     ;;
141     esac
142 eulisse 1.9
143 fwyzard 1.96 perl -p -i -e "s|^#!.*python|#!/usr/bin/env python|" %{i}/bin/idle \
144     %{i}/bin/pydoc \
145     %{i}/bin/python-config \
146     %{i}/bin/2to3 \
147     %{i}/bin/python2.7-config \
148     %{i}/bin/smtpd.py
149 eulisse 1.67
150     find %{i}/lib -maxdepth 1 -mindepth 1 ! -name '*python*' -exec rm {} \;
151     find %{i}/include -maxdepth 1 -mindepth 1 ! -name '*python*' -exec rm {} \;
152 muzaffar 1.28
153 lat 1.74 # remove executable permission anything which is *.py script,
154     # is executable, but does not start with she-bang so not valid
155     # executable; this avoids problems with rpm 4.8+ find-requires
156     find %i -name '*.py' -perm +0111 | while read f; do
157     if head -n1 $f | grep -q '"'; then chmod -x $f; else :; fi
158     done
159    
160 valya 1.48 # remove tkinter that brings dependency on libtk:
161 elmer 1.58 find %{i}/lib -type f -name "_tkinter.so" -exec rm {} \;
162 valya 1.48
163 eulisse 1.77 # Remove documentation, examples and test files.
164 fwyzard 1.96 %define drop_files { %i/share %{i}/lib/python%{pythonv}/test \
165     %{i}/lib/python%{pythonv}/distutils/tests \
166     %{i}/lib/python%{pythonv}/json/tests \
167     %{i}/lib/python%{pythonv}/ctypes/test \
168     %{i}/lib/python%{pythonv}/sqlite3/test \
169     %{i}/lib/python%{pythonv}/bsddb/test \
170     %{i}/lib/python%{pythonv}/email/test \
171     %{i}/lib/python%{pythonv}/lib2to3/tests }
172 diego 1.75
173     # Remove .pyo files
174     find %i -name '*.pyo' -exec rm {} \;
175    
176 lat 1.68 # Generate dependencies-setup.{sh,csh} so init.{sh,csh} picks full environment.
177 diego 1.63 mkdir -p %i/etc/profile.d
178 lat 1.68 : > %i/etc/profile.d/dependencies-setup.sh
179     : > %i/etc/profile.d/dependencies-setup.csh
180     for tool in $(echo %{requiredtools} | sed -e's|\s+| |;s|^\s+||'); do
181     root=$(echo $tool | tr a-z- A-Z_)_ROOT; eval r=\$$root
182     if [ X"$r" != X ] && [ -r "$r/etc/profile.d/init.sh" ]; then
183     echo "test X\$$root != X || . $r/etc/profile.d/init.sh" >> %i/etc/profile.d/dependencies-setup.sh
184     echo "test X\$$root != X || source $r/etc/profile.d/init.csh" >> %i/etc/profile.d/dependencies-setup.csh
185     fi
186 diego 1.63 done
187    
188 eulisse 1.16 %post
189 fwyzard 1.96 %{relocateConfig}lib/python2.7/config/Makefile
190 lat 1.68 %{relocateConfig}etc/profile.d/dependencies-setup.*sh