PageRenderTime 72ms CodeModel.GetById 43ms RepoModel.GetById 1ms app.codeStats 0ms

/Library/Formula/pypy.rb

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