/Library/Formula/pypy.rb

https://bitbucket.org/smcferrin/homebrew · Ruby · 91 lines · 54 code · 19 blank · 18 comment · 0 complexity · c80d71b9996aad59c4bc43792893c0b6 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. url 'https://bitbucket.org/pypy/pypy/downloads/pypy-1.9-osx64.tar.bz2'
  9. version '1.9'
  10. sha1 '825e15724419fbdb6fe215eeea044f9181883c90'
  11. devel do
  12. url 'https://bitbucket.org/pypy/pypy/downloads/pypy-2.0-beta1-osx64.tar.bz2'
  13. version '2.0-beta1'
  14. sha1 'e4938fdf33072e457fee6cb22798ec08b5a01978'
  15. end
  16. depends_on :arch => :x86_64
  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. (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; <<-EOS.undent
  46. A "distutils.cfg" has been written to:
  47. #{distutils}
  48. specifing the install-scripts folder as:
  49. #{scripts_folder}
  50. If you install Python packages via "pypy setup.py install", easy_install, pip,
  51. any provided scripts will go into the install-scripts folder above, so you may
  52. want to add it to your PATH.
  53. Distribute has been installed, so easy_install is available.
  54. To update distribute itself outside of Homebrew:
  55. #{scripts_folder}/easy_install pip
  56. #{scripts_folder}/pip install --upgrade distribute
  57. See: https://github.com/mxcl/homebrew/wiki/Homebrew-and-Python
  58. EOS
  59. end
  60. # The HOMEBREW_PREFIX location of site-packages
  61. def prefix_site_packages
  62. HOMEBREW_PREFIX+"lib/pypy/site-packages"
  63. end
  64. # Where distribute will install executable scripts
  65. def scripts_folder
  66. HOMEBREW_PREFIX+"share/pypy"
  67. end
  68. # The Cellar location of distutils
  69. def distutils
  70. prefix+"lib-python/2.7/distutils"
  71. end
  72. end