1 |
diego |
1.85 |
### RPM external python 2.6.8
|
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 |
diego |
1.85 |
## 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 |
ratnik |
1.34 |
Requires: expat bz2lib db4 gdbm
|
11 |
|
|
|
12 |
elmer |
1.55 |
%if "%online" != "true"
|
13 |
dsr |
1.62 |
Requires: zlib openssl 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 |
diego |
1.85 |
Patch0: python-dont-detect-dbm
|
21 |
|
|
Patch1: python-fix-macosx-relocation
|
22 |
steen |
1.19 |
|
23 |
argiro |
1.1 |
%prep
|
24 |
dsr |
1.62 |
%setup -n Python-%realversion
|
25 |
lat |
1.74 |
find . -type f | while read f; do
|
26 |
|
|
if head -n1 $f | grep -q /usr/local; then
|
27 |
|
|
perl -p -i -e "s|#!.*/usr/local/bin/python|#!/usr/bin/env python|" $f
|
28 |
|
|
else :; fi
|
29 |
|
|
done
|
30 |
diego |
1.85 |
%patch0 -p0
|
31 |
|
|
%patch1 -p0
|
32 |
argiro |
1.1 |
|
33 |
|
|
%build
|
34 |
|
|
# Python is awkward about passing other include or library directories
|
35 |
|
|
# to it. Basically there is no way to pass anything from configure to
|
36 |
|
|
# make, or down to python itself. To get python detect the extensions
|
37 |
|
|
# we want to enable, we simply have to link the contents into python's
|
38 |
|
|
# own include/lib directories. Ugh.
|
39 |
|
|
#
|
40 |
|
|
# NB: It would sort-of make sense to link more stuff from /sw on OS X,
|
41 |
|
|
# but we simply cannot link the whole world. If you need something,
|
42 |
|
|
# see above for the commented-out list of packages that could be
|
43 |
|
|
# linked specifically, or could be built by ourselves, depending on
|
44 |
|
|
# whether we like to pick up system libraries or want total control.
|
45 |
dsr |
1.62 |
#mkdir -p %i/include %i/lib
|
46 |
|
|
mkdir -p %i/include %i/lib %i/bin
|
47 |
ratnik |
1.34 |
|
48 |
elmer |
1.55 |
%if "%online" != "true"
|
49 |
dsr |
1.62 |
%define extradirs $ZLIB_ROOT $OPENSSL_ROOT $SQLITE_ROOT
|
50 |
ratnik |
1.34 |
%else
|
51 |
|
|
%define extradirs %{nil}
|
52 |
|
|
%endif
|
53 |
|
|
|
54 |
|
|
dirs="$EXPAT_ROOT $BZ2LIB_ROOT $NCURSES_ROOT $DB4_ROOT $GDBM_ROOT %{extradirs}"
|
55 |
|
|
|
56 |
eulisse |
1.70 |
# We need to export it because setup.py now uses it to determine the actual
|
57 |
|
|
# location of DB4, this was needed to avoid having it picked up from the system.
|
58 |
|
|
export DB4_ROOT
|
59 |
|
|
|
60 |
davidlt |
1.83 |
# Python's configure parses LDFLAGS and CPPFLAGS to look for aditional library and include directories
|
61 |
eulisse |
1.16 |
echo $dirs
|
62 |
davidlt |
1.83 |
LDFLAGS=""
|
63 |
|
|
CPPFLAGS=""
|
64 |
argiro |
1.1 |
for d in $dirs; do
|
65 |
davidlt |
1.83 |
LDFLAGS="$LDFLAGS -L $d/lib"
|
66 |
|
|
CPPFLAGS="$CPPFLAGS -I $d/include"
|
67 |
argiro |
1.1 |
done
|
68 |
davidlt |
1.83 |
export LDFLAGS
|
69 |
|
|
export CPPFLAGS
|
70 |
argiro |
1.1 |
|
71 |
eulisse |
1.39 |
additionalConfigureOptions=""
|
72 |
|
|
case %cmsplatf in
|
73 |
|
|
osx105* )
|
74 |
|
|
additionalConfigureOptions="--disable-readline"
|
75 |
|
|
;;
|
76 |
|
|
esac
|
77 |
|
|
|
78 |
fwyzard |
1.81 |
./configure --prefix=%i $additionalConfigureOptions --enable-shared \
|
79 |
eulisse |
1.39 |
--without-tkinter --disable-tkinter
|
80 |
|
|
|
81 |
ratnik |
1.38 |
make %makeprocesses
|
82 |
ratnik |
1.37 |
|
83 |
argiro |
1.1 |
%install
|
84 |
eulisse |
1.71 |
# We need to export it because setup.py now uses it to determine the actual
|
85 |
|
|
# location of DB4, this was needed to avoid having it picked up from the system.
|
86 |
|
|
export DB4_ROOT
|
87 |
fwyzard |
1.81 |
make install
|
88 |
dsr |
1.62 |
%define pythonv %(echo %realversion | cut -d. -f 1,2)
|
89 |
eulisse |
1.8 |
|
90 |
dsr |
1.62 |
case %cmsplatf in
|
91 |
|
|
osx*)
|
92 |
|
|
make install prefix=%i
|
93 |
|
|
(cd Misc; /bin/rm -rf RPM)
|
94 |
|
|
mkdir -p %i/share/doc/%n
|
95 |
|
|
cp -R Demo Doc %i/share/doc/%n
|
96 |
|
|
cp -R Misc Tools %i/lib/python%{pythonv}
|
97 |
|
|
gcc -dynamiclib -all_load -single_module \
|
98 |
|
|
-framework System -framework CoreServices -framework Foundation \
|
99 |
|
|
%i/lib/python%{pythonv}/config/libpython%{pythonv}.a \
|
100 |
|
|
-undefined dynamic_lookup \
|
101 |
|
|
-o %i/lib/python%{pythonv}/config/libpython%{pythonv}.dylib \
|
102 |
|
|
-install_name %i/lib/python%{pythonv}/config/libpython%{pythonv}.dylib \
|
103 |
|
|
-current_version %{pythonv} -compatibility_version %{pythonv} -ldl
|
104 |
|
|
(cd %i/lib/python%{pythonv}/config
|
105 |
|
|
perl -p -i -e 's|-fno-common||g' Makefile)
|
106 |
|
|
|
107 |
|
|
find %i/lib/python%{pythonv}/config -name 'libpython*' -exec mv -f {} %i/lib \;
|
108 |
|
|
;;
|
109 |
|
|
esac
|
110 |
eulisse |
1.9 |
|
111 |
diego |
1.85 |
perl -p -i -e "s|^#!.*python|#!/usr/bin/env python|" %{i}/bin/idle \
|
112 |
|
|
%{i}/bin/pydoc \
|
113 |
|
|
%{i}/bin/python-config \
|
114 |
|
|
%{i}/bin/2to3 \
|
115 |
|
|
%{i}/bin/python2.6-config \
|
116 |
|
|
%{i}/bin/smtpd.py \
|
117 |
|
|
%{i}/lib/python2.6/bsddb/dbshelve.py \
|
118 |
|
|
%{i}/lib/python2.6/test/test_bz2.py \
|
119 |
|
|
%{i}/lib/python2.6/test/test_largefile.py \
|
120 |
|
|
%{i}/lib/python2.6/test/test_optparse.py
|
121 |
eulisse |
1.67 |
|
122 |
|
|
find %{i}/lib -maxdepth 1 -mindepth 1 ! -name '*python*' -exec rm {} \;
|
123 |
|
|
find %{i}/include -maxdepth 1 -mindepth 1 ! -name '*python*' -exec rm {} \;
|
124 |
muzaffar |
1.28 |
|
125 |
lat |
1.74 |
# remove executable permission anything which is *.py script,
|
126 |
|
|
# is executable, but does not start with she-bang so not valid
|
127 |
|
|
# executable; this avoids problems with rpm 4.8+ find-requires
|
128 |
|
|
find %i -name '*.py' -perm +0111 | while read f; do
|
129 |
|
|
if head -n1 $f | grep -q '"'; then chmod -x $f; else :; fi
|
130 |
|
|
done
|
131 |
|
|
|
132 |
valya |
1.48 |
# remove tkinter that brings dependency on libtk:
|
133 |
elmer |
1.58 |
find %{i}/lib -type f -name "_tkinter.so" -exec rm {} \;
|
134 |
valya |
1.48 |
|
135 |
eulisse |
1.77 |
# Remove documentation, examples and test files.
|
136 |
diego |
1.85 |
%define drop_files { %i/share %{i}/lib/python%{pythonv}/test \
|
137 |
|
|
%{i}/lib/python%{pythonv}/distutils/tests \
|
138 |
|
|
%{i}/lib/python%{pythonv}/json/tests \
|
139 |
|
|
%{i}/lib/python%{pythonv}/ctypes/test \
|
140 |
|
|
%{i}/lib/python%{pythonv}/sqlite3/test \
|
141 |
|
|
%{i}/lib/python%{pythonv}/bsddb/test \
|
142 |
|
|
%{i}/lib/python%{pythonv}/email/test \
|
143 |
|
|
%{i}/lib/python%{pythonv}/lib2to3/tests }
|
144 |
diego |
1.75 |
|
145 |
|
|
# Remove .pyo files
|
146 |
|
|
find %i -name '*.pyo' -exec rm {} \;
|
147 |
|
|
|
148 |
lat |
1.68 |
# Generate dependencies-setup.{sh,csh} so init.{sh,csh} picks full environment.
|
149 |
diego |
1.63 |
mkdir -p %i/etc/profile.d
|
150 |
lat |
1.68 |
: > %i/etc/profile.d/dependencies-setup.sh
|
151 |
|
|
: > %i/etc/profile.d/dependencies-setup.csh
|
152 |
|
|
for tool in $(echo %{requiredtools} | sed -e's|\s+| |;s|^\s+||'); do
|
153 |
|
|
root=$(echo $tool | tr a-z- A-Z_)_ROOT; eval r=\$$root
|
154 |
|
|
if [ X"$r" != X ] && [ -r "$r/etc/profile.d/init.sh" ]; then
|
155 |
|
|
echo "test X\$$root != X || . $r/etc/profile.d/init.sh" >> %i/etc/profile.d/dependencies-setup.sh
|
156 |
|
|
echo "test X\$$root != X || source $r/etc/profile.d/init.csh" >> %i/etc/profile.d/dependencies-setup.csh
|
157 |
|
|
fi
|
158 |
diego |
1.63 |
done
|
159 |
|
|
|
160 |
eulisse |
1.16 |
%post
|
161 |
dsr |
1.62 |
%{relocateConfig}lib/python2.6/config/Makefile
|
162 |
lat |
1.68 |
%{relocateConfig}etc/profile.d/dependencies-setup.*sh
|