/Misc/RPM/python-2.6.spec

http://unladen-swallow.googlecode.com/ · Unknown · 387 lines · 327 code · 60 blank · 0 comment · 0 complexity · 040433c6ded69c5d6dcf884073181bff MD5 · raw file

  1. ##########################
  2. # User-modifiable configs
  3. ##########################
  4. # Is the resulting package and the installed binary named "python" or
  5. # "python2"?
  6. #WARNING: Commenting out doesn't work. Last line is what's used.
  7. %define config_binsuffix none
  8. %define config_binsuffix 2.6
  9. # Build tkinter? "auto" enables it if /usr/bin/wish exists.
  10. #WARNING: Commenting out doesn't work. Last line is what's used.
  11. %define config_tkinter no
  12. %define config_tkinter yes
  13. %define config_tkinter auto
  14. # Use pymalloc? The last line (commented or not) determines wether
  15. # pymalloc is used.
  16. #WARNING: Commenting out doesn't work. Last line is what's used.
  17. %define config_pymalloc no
  18. %define config_pymalloc yes
  19. # Enable IPV6?
  20. #WARNING: Commenting out doesn't work. Last line is what's used.
  21. %define config_ipv6 yes
  22. %define config_ipv6 no
  23. # Location of the HTML directory.
  24. %define config_htmldir /var/www/html/python
  25. #################################
  26. # End of user-modifiable configs
  27. #################################
  28. %define name python
  29. #--start constants--
  30. %define version 2.6.4
  31. %define libver 2.6
  32. #--end constants--
  33. %define release 1pydotorg
  34. %define __prefix /usr
  35. # kludge to get around rpm <percent>define weirdness
  36. %define ipv6 %(if [ "%{config_ipv6}" = yes ]; then echo --enable-ipv6; else echo --disable-ipv6; fi)
  37. %define pymalloc %(if [ "%{config_pymalloc}" = yes ]; then echo --with-pymalloc; else echo --without-pymalloc; fi)
  38. %define binsuffix %(if [ "%{config_binsuffix}" = none ]; then echo ; else echo "%{config_binsuffix}"; fi)
  39. %define include_tkinter %(if [ \\( "%{config_tkinter}" = auto -a -f /usr/bin/wish \\) -o "%{config_tkinter}" = yes ]; then echo 1; else echo 0; fi)
  40. %define libdirname %(( uname -m | egrep -q '_64$' && [ -d /usr/lib64 ] && echo lib64 ) || echo lib)
  41. # detect if documentation is available
  42. %define include_docs %(if [ -f "%{_sourcedir}/html-%{version}.tar.bz2" ]; then echo 1; else echo 0; fi)
  43. Summary: An interpreted, interactive, object-oriented programming language.
  44. Name: %{name}%{binsuffix}
  45. Version: %{version}
  46. Release: %{release}
  47. Copyright: Modified CNRI Open Source License
  48. Group: Development/Languages
  49. Source: Python-%{version}.tar.bz2
  50. %if %{include_docs}
  51. Source1: html-%{version}.tar.bz2
  52. %endif
  53. BuildRoot: %{_tmppath}/%{name}-%{version}-root
  54. BuildPrereq: expat-devel
  55. BuildPrereq: db4-devel
  56. BuildPrereq: gdbm-devel
  57. BuildPrereq: sqlite-devel
  58. Prefix: %{__prefix}
  59. Packager: Sean Reifschneider <jafo-rpms@tummy.com>
  60. %description
  61. Python is an interpreted, interactive, object-oriented programming
  62. language. It incorporates modules, exceptions, dynamic typing, very high
  63. level dynamic data types, and classes. Python combines remarkable power
  64. with very clear syntax. It has interfaces to many system calls and
  65. libraries, as well as to various window systems, and is extensible in C or
  66. C++. It is also usable as an extension language for applications that need
  67. a programmable interface. Finally, Python is portable: it runs on many
  68. brands of UNIX, on PCs under Windows, MS-DOS, and OS/2, and on the
  69. Mac.
  70. %package devel
  71. Summary: The libraries and header files needed for Python extension development.
  72. Prereq: python%{binsuffix} = %{PACKAGE_VERSION}
  73. Group: Development/Libraries
  74. %description devel
  75. The Python programming language's interpreter can be extended with
  76. dynamically loaded extensions and can be embedded in other programs.
  77. This package contains the header files and libraries needed to do
  78. these types of tasks.
  79. Install python-devel if you want to develop Python extensions. The
  80. python package will also need to be installed. You'll probably also
  81. want to install the python-docs package, which contains Python
  82. documentation.
  83. %if %{include_tkinter}
  84. %package tkinter
  85. Summary: A graphical user interface for the Python scripting language.
  86. Group: Development/Languages
  87. Prereq: python%{binsuffix} = %{PACKAGE_VERSION}-%{release}
  88. %description tkinter
  89. The Tkinter (Tk interface) program is an graphical user interface for
  90. the Python scripting language.
  91. You should install the tkinter package if you'd like to use a graphical
  92. user interface for Python programming.
  93. %endif
  94. %package tools
  95. Summary: A collection of development tools included with Python.
  96. Group: Development/Tools
  97. Prereq: python%{binsuffix} = %{PACKAGE_VERSION}-%{release}
  98. %description tools
  99. The Python package includes several development tools that are used
  100. to build python programs. This package contains a selection of those
  101. tools, including the IDLE Python IDE.
  102. Install python-tools if you want to use these tools to develop
  103. Python programs. You will also need to install the python and
  104. tkinter packages.
  105. %if %{include_docs}
  106. %package docs
  107. Summary: Python-related documentation.
  108. Group: Development/Documentation
  109. %description docs
  110. Documentation relating to the Python programming language in HTML and info
  111. formats.
  112. %endif
  113. %changelog
  114. * Mon Dec 20 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.4-2pydotorg]
  115. - Changing the idle wrapper so that it passes arguments to idle.
  116. * Tue Oct 19 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.4b1-1pydotorg]
  117. - Updating to 2.4.
  118. * Thu Jul 22 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.4-3pydotorg]
  119. - Paul Tiemann fixes for %{prefix}.
  120. - Adding permission changes for directory as suggested by reimeika.ca
  121. - Adding code to detect when it should be using lib64.
  122. - Adding a define for the location of /var/www/html for docs.
  123. * Thu May 27 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.4-2pydotorg]
  124. - Including changes from Ian Holsman to build under Red Hat 7.3.
  125. - Fixing some problems with the /usr/local path change.
  126. * Sat Mar 27 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.2-3pydotorg]
  127. - Being more agressive about finding the paths to fix for
  128. #!/usr/local/bin/python.
  129. * Sat Feb 07 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.3-2pydotorg]
  130. - Adding code to remove "#!/usr/local/bin/python" from particular files and
  131. causing the RPM build to terminate if there are any unexpected files
  132. which have that line in them.
  133. * Mon Oct 13 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.2-1pydotorg]
  134. - Adding code to detect wether documentation is available to build.
  135. * Fri Sep 19 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.1-1pydotorg]
  136. - Updating to the 2.3.1 release.
  137. * Mon Feb 24 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3b1-1pydotorg]
  138. - Updating to 2.3b1 release.
  139. * Mon Feb 17 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3a1-1]
  140. - Updating to 2.3 release.
  141. * Sun Dec 23 2001 Sean Reifschneider <jafo-rpms@tummy.com>
  142. [Release 2.2-2]
  143. - Added -docs package.
  144. - Added "auto" config_tkinter setting which only enables tk if
  145. /usr/bin/wish exists.
  146. * Sat Dec 22 2001 Sean Reifschneider <jafo-rpms@tummy.com>
  147. [Release 2.2-1]
  148. - Updated to 2.2.
  149. - Changed the extension to "2" from "2.2".
  150. * Tue Nov 18 2001 Sean Reifschneider <jafo-rpms@tummy.com>
  151. [Release 2.2c1-1]
  152. - Updated to 2.2c1.
  153. * Thu Nov 1 2001 Sean Reifschneider <jafo-rpms@tummy.com>
  154. [Release 2.2b1-3]
  155. - Changed the way the sed for fixing the #! in pydoc works.
  156. * Wed Oct 24 2001 Sean Reifschneider <jafo-rpms@tummy.com>
  157. [Release 2.2b1-2]
  158. - Fixed missing "email" package, thanks to anonymous report on sourceforge.
  159. - Fixed missing "compiler" package.
  160. * Mon Oct 22 2001 Sean Reifschneider <jafo-rpms@tummy.com>
  161. [Release 2.2b1-1]
  162. - Updated to 2.2b1.
  163. * Mon Oct 9 2001 Sean Reifschneider <jafo-rpms@tummy.com>
  164. [Release 2.2a4-4]
  165. - otto@balinor.mat.unimi.it mentioned that the license file is missing.
  166. * Sun Sep 30 2001 Sean Reifschneider <jafo-rpms@tummy.com>
  167. [Release 2.2a4-3]
  168. - Ignacio Vazquez-Abrams pointed out that I had a spruious double-quote in
  169. the spec files. Thanks.
  170. * Wed Jul 25 2001 Sean Reifschneider <jafo-rpms@tummy.com>
  171. [Release 2.2a1-1]
  172. - Updated to 2.2a1 release.
  173. - Changed idle and pydoc to use binsuffix macro
  174. #######
  175. # PREP
  176. #######
  177. %prep
  178. %setup -n Python-%{version}
  179. ########
  180. # BUILD
  181. ########
  182. %build
  183. ./configure --enable-unicode=ucs4 %{ipv6} %{pymalloc} --prefix=%{__prefix}
  184. make
  185. ##########
  186. # INSTALL
  187. ##########
  188. %install
  189. # set the install path
  190. echo '[install_scripts]' >setup.cfg
  191. echo 'install_dir='"${RPM_BUILD_ROOT}%{__prefix}/bin" >>setup.cfg
  192. [ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
  193. mkdir -p $RPM_BUILD_ROOT%{__prefix}/%{libdirname}/python%{libvers}/lib-dynload
  194. make prefix=$RPM_BUILD_ROOT%{__prefix} install
  195. # REPLACE PATH IN PYDOC
  196. if [ ! -z "%{binsuffix}" ]
  197. then
  198. (
  199. cd $RPM_BUILD_ROOT%{__prefix}/bin
  200. mv pydoc pydoc.old
  201. sed 's|#!.*|#!%{__prefix}/bin/env python'%{binsuffix}'|' \
  202. pydoc.old >pydoc
  203. chmod 755 pydoc
  204. rm -f pydoc.old
  205. )
  206. fi
  207. # add the binsuffix
  208. if [ ! -z "%{binsuffix}" ]
  209. then
  210. ( cd $RPM_BUILD_ROOT%{__prefix}/bin; rm -f python[0-9a-zA-Z]*;
  211. mv -f python python"%{binsuffix}" )
  212. ( cd $RPM_BUILD_ROOT%{__prefix}/man/man1; mv python.1 python%{binsuffix}.1 )
  213. ( cd $RPM_BUILD_ROOT%{__prefix}/bin; mv -f pydoc pydoc"%{binsuffix}" )
  214. ( cd $RPM_BUILD_ROOT%{__prefix}/bin; mv -f idle idle"%{binsuffix}" )
  215. fi
  216. ########
  217. # Tools
  218. echo '#!%{__prefix}/bin/env python%{binsuffix}' >${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix}
  219. echo 'import os, sys' >>${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix}
  220. echo 'os.execvp("%{__prefix}/bin/python%{binsuffix}", ["%{__prefix}/bin/python%{binsuffix}", "%{__prefix}/lib/python%{libvers}/idlelib/idle.py"] + sys.argv[1:])' >>${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix}
  221. echo 'print "Failed to exec Idle"' >>${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix}
  222. echo 'sys.exit(1)' >>${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix}
  223. chmod 755 $RPM_BUILD_ROOT%{__prefix}/bin/idle%{binsuffix}
  224. cp -a Tools $RPM_BUILD_ROOT%{__prefix}/%{libdirname}/python%{libvers}
  225. # MAKE FILE LISTS
  226. rm -f mainpkg.files
  227. find "$RPM_BUILD_ROOT""%{__prefix}"/%{libdirname}/python%{libvers}/lib-dynload -type f |
  228. sed "s|^${RPM_BUILD_ROOT}|/|" |
  229. grep -v -e '_tkinter.so$' >mainpkg.files
  230. find "$RPM_BUILD_ROOT""%{__prefix}"/bin -type f |
  231. sed "s|^${RPM_BUILD_ROOT}|/|" |
  232. grep -v -e '/bin/idle%{binsuffix}$' >>mainpkg.files
  233. rm -f tools.files
  234. find "$RPM_BUILD_ROOT""%{__prefix}"/%{libdirname}/python%{libvers}/idlelib \
  235. "$RPM_BUILD_ROOT""%{__prefix}"/%{libdirname}/python%{libvers}/Tools -type f |
  236. sed "s|^${RPM_BUILD_ROOT}|/|" >tools.files
  237. echo "%{__prefix}"/bin/idle%{binsuffix} >>tools.files
  238. ######
  239. # Docs
  240. %if %{include_docs}
  241. mkdir -p "$RPM_BUILD_ROOT"%{config_htmldir}
  242. (
  243. cd "$RPM_BUILD_ROOT"%{config_htmldir}
  244. bunzip2 < %{SOURCE1} | tar x
  245. )
  246. %endif
  247. # fix the #! line in installed files
  248. find "$RPM_BUILD_ROOT" -type f -print0 |
  249. xargs -0 grep -l /usr/local/bin/python | while read file
  250. do
  251. FIXFILE="$file"
  252. sed 's|^#!.*python|#!%{__prefix}/bin/env python'"%{binsuffix}"'|' \
  253. "$FIXFILE" >/tmp/fix-python-path.$$
  254. cat /tmp/fix-python-path.$$ >"$FIXFILE"
  255. rm -f /tmp/fix-python-path.$$
  256. done
  257. # check to see if there are any straggling #! lines
  258. find "$RPM_BUILD_ROOT" -type f | xargs egrep -n '^#! */usr/local/bin/python' \
  259. | grep ':1:#!' >/tmp/python-rpm-files.$$ || true
  260. if [ -s /tmp/python-rpm-files.$$ ]
  261. then
  262. echo '*****************************************************'
  263. cat /tmp/python-rpm-files.$$
  264. cat <<@EOF
  265. *****************************************************
  266. There are still files referencing /usr/local/bin/python in the
  267. install directory. They are listed above. Please fix the .spec
  268. file and try again. If you are an end-user, you probably want
  269. to report this to jafo-rpms@tummy.com as well.
  270. *****************************************************
  271. @EOF
  272. rm -f /tmp/python-rpm-files.$$
  273. exit 1
  274. fi
  275. rm -f /tmp/python-rpm-files.$$
  276. ########
  277. # CLEAN
  278. ########
  279. %clean
  280. [ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT
  281. rm -f mainpkg.files tools.files
  282. ########
  283. # FILES
  284. ########
  285. %files -f mainpkg.files
  286. %defattr(-,root,root)
  287. %doc Misc/README Misc/cheatsheet Misc/Porting
  288. %doc LICENSE Misc/ACKS Misc/HISTORY Misc/NEWS
  289. %{__prefix}/man/man1/python%{binsuffix}.1*
  290. %attr(755,root,root) %dir %{__prefix}/include/python%{libvers}
  291. %attr(755,root,root) %dir %{__prefix}/%{libdirname}/python%{libvers}/
  292. %{__prefix}/%{libdirname}/python%{libvers}/*.txt
  293. %{__prefix}/%{libdirname}/python%{libvers}/*.py*
  294. %{__prefix}/%{libdirname}/python%{libvers}/pdb.doc
  295. %{__prefix}/%{libdirname}/python%{libvers}/profile.doc
  296. %{__prefix}/%{libdirname}/python%{libvers}/curses
  297. %{__prefix}/%{libdirname}/python%{libvers}/distutils
  298. %{__prefix}/%{libdirname}/python%{libvers}/encodings
  299. %{__prefix}/%{libdirname}/python%{libvers}/plat-linux2
  300. %{__prefix}/%{libdirname}/python%{libvers}/site-packages
  301. %{__prefix}/%{libdirname}/python%{libvers}/test
  302. %{__prefix}/%{libdirname}/python%{libvers}/xml
  303. %{__prefix}/%{libdirname}/python%{libvers}/email
  304. %{__prefix}/%{libdirname}/python%{libvers}/email/mime
  305. %{__prefix}/%{libdirname}/python%{libvers}/sqlite3
  306. %{__prefix}/%{libdirname}/python%{libvers}/compiler
  307. %{__prefix}/%{libdirname}/python%{libvers}/bsddb
  308. %{__prefix}/%{libdirname}/python%{libvers}/hotshot
  309. %{__prefix}/%{libdirname}/python%{libvers}/logging
  310. %{__prefix}/%{libdirname}/python%{libvers}/lib-old
  311. %files devel
  312. %defattr(-,root,root)
  313. %{__prefix}/include/python%{libvers}/*.h
  314. %{__prefix}/%{libdirname}/python%{libvers}/config
  315. %files -f tools.files tools
  316. %defattr(-,root,root)
  317. %if %{include_tkinter}
  318. %files tkinter
  319. %defattr(-,root,root)
  320. %{__prefix}/%{libdirname}/python%{libvers}/lib-tk
  321. %{__prefix}/%{libdirname}/python%{libvers}/lib-dynload/_tkinter.so*
  322. %endif
  323. %if %{include_docs}
  324. %files docs
  325. %defattr(-,root,root)
  326. %{config_htmldir}/*
  327. %endif