PageRenderTime 46ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/Library/Formula/pypy.rb

https://bitbucket.org/zozo123/homebrew
Ruby | 95 lines | 59 code | 19 blank | 17 comment | 1 complexity | 897b5b4275be0fc9e7910c30038e0583 MD5 | raw file
  1. require 'formula'
  2. class Distribute < Formula
  3. url 'http://pypi.python.org/packages/source/d/distribute/distribute-0.6.26.tar.gz'
  4. md5 '841f4262a70107f85260362f5def8206'
  5. end
  6. class Pypy < Formula
  7. homepage 'http://pypy.org/'
  8. if MacOS.prefer_64_bit?
  9. url 'https://bitbucket.org/pypy/pypy/downloads/pypy-1.8-osx64.tar.bz2'
  10. version '1.8'
  11. md5 '1c293253e8e4df411c3dd59dff82a663'
  12. else
  13. url 'http://pypy.org/download/pypy-1.4.1-osx.tar.bz2'
  14. version '1.4.1'
  15. md5 '8584c4e8c042f5b661fcfffa0d9b8a25'
  16. end
  17. def install
  18. rmtree 'site-packages'
  19. prefix.install Dir['*']
  20. # Post-install, fix up the site-packages and install-scripts folders
  21. # so that user-installed Python software survives minor updates, such
  22. # as going from 1.7.0 to 1.7.1.
  23. # Create a site-packages in the prefix.
  24. prefix_site_packages.mkpath
  25. # Symlink the prefix site-packages into the cellar.
  26. ln_s prefix_site_packages, prefix+'site-packages'
  27. # Tell distutils-based installers where to put scripts
  28. scripts_folder.mkpath
  29. (prefix+"lib-python/modified-2.7/distutils/distutils.cfg").write <<-EOF.undent
  30. [install]
  31. install-scripts=#{scripts_folder}
  32. EOF
  33. # Install distribute. The user can then do:
  34. # $ easy_install pip
  35. # $ pip install --upgrade distribute
  36. # to get newer versions of distribute outside of Homebrew.
  37. Distribute.new.brew do
  38. system "#{bin}/pypy", "setup.py", "install"
  39. # Symlink to easy_install_pypy.
  40. unless (scripts_folder+'easy_install_pypy').exist?
  41. ln_s "#{scripts_folder}/easy_install", "#{scripts_folder}/easy_install_pypy"
  42. end
  43. end
  44. end
  45. def caveats
  46. message = <<-EOS.undent
  47. A "distutils.cfg" has been written to:
  48. #{lib}/pypy/distutils
  49. specifing the install-scripts folder as:
  50. #{scripts_folder}
  51. If you install Python packages via "pypy setup.py install", easy_install, pip,
  52. any provided scripts will go into the install-scripts folder above, so you may
  53. want to add it to your PATH.
  54. Distribute has been installed, so easy_install is available.
  55. To update distribute itself outside of Homebrew:
  56. #{scripts_folder}/easy_install pip
  57. #{scripts_folder}/pip install --upgrade distribute
  58. See: https://github.com/mxcl/homebrew/wiki/Homebrew-and-Python
  59. EOS
  60. unless MacOS.prefer_64_bit?
  61. message += "\n" + <<-EOS.undent
  62. Outdated PyPy 1.4.1 is the last version with official 32-bit Mac binary.
  63. Consider to build modern version yourself: http://pypy.org/download.html#building-from-source
  64. EOS
  65. end
  66. return message
  67. end
  68. # The HOMEBREW_PREFIX location of site-packages
  69. def prefix_site_packages
  70. HOMEBREW_PREFIX+"lib/pypy/site-packages"
  71. end
  72. # Where distribute will install executable scripts
  73. def scripts_folder
  74. HOMEBREW_PREFIX+"share/pypy"
  75. end
  76. end