PageRenderTime 39ms CodeModel.GetById 11ms RepoModel.GetById 1ms app.codeStats 0ms

/Library/Formula/pypy.rb

https://bitbucket.org/bathtub/tigerbrew
Ruby | 90 lines | 52 code | 19 blank | 19 comment | 0 complexity | 8842aeea6be8227a95a50e909b7ec2bc MD5 | raw file
  1. require 'formula'
  2. class Distribute < Formula
  3. url 'http://pypi.python.org/packages/source/d/distribute/distribute-0.6.45.tar.gz'
  4. sha1 '55b15037f2222828496a96f38447c0fa0228df85'
  5. end
  6. class Pypy < Formula
  7. homepage 'http://pypy.org/'
  8. url 'https://bitbucket.org/pypy/pypy/downloads/pypy-2.0.2-osx64.tar.bz2'
  9. version '2.0.2'
  10. sha1 'a53de7bc88b9caa635d9d679c6e63813881ea7e9'
  11. depends_on :arch => :x86_64
  12. def install
  13. rmtree 'site-packages'
  14. prefix.install Dir['*']
  15. # Post-install, fix up the site-packages and install-scripts folders
  16. # so that user-installed Python software survives minor updates, such
  17. # as going from 1.7.0 to 1.7.1.
  18. # Create a site-packages in the prefix.
  19. prefix_site_packages.mkpath
  20. # Symlink the prefix site-packages into the cellar.
  21. ln_s prefix_site_packages, prefix+'site-packages'
  22. # Tell distutils-based installers where to put scripts
  23. scripts_folder.mkpath
  24. (distutils+"distutils.cfg").write <<-EOF.undent
  25. [install]
  26. install-scripts=#{scripts_folder}
  27. EOF
  28. # Install distribute. The user can then do:
  29. # $ easy_install pip
  30. # $ pip install --upgrade distribute
  31. # to get newer versions of distribute outside of Homebrew.
  32. Distribute.new.brew do
  33. system "#{bin}/pypy", "setup.py", "install"
  34. end
  35. # Symlink to easy_install_pypy.
  36. unless (scripts_folder+'easy_install_pypy').exist?
  37. ln_s "#{scripts_folder}/easy_install", "#{scripts_folder}/easy_install_pypy"
  38. end
  39. # Symlink to pip_pypy.
  40. unless (scripts_folder+'pip_pypy').exist?
  41. ln_s "#{scripts_folder}/pip", "#{scripts_folder}/pip_pypy"
  42. end
  43. end
  44. def caveats; <<-EOS.undent
  45. A "distutils.cfg" has been written to:
  46. #{distutils}
  47. specifing the install-scripts folder as:
  48. #{scripts_folder}
  49. If you install Python packages via "pypy setup.py install", easy_install, pip,
  50. any provided scripts will go into the install-scripts folder above, so you may
  51. want to add it to your PATH.
  52. Distribute has been installed, so easy_install is available.
  53. To update distribute itself outside of Homebrew:
  54. #{scripts_folder}/easy_install pip
  55. #{scripts_folder}/pip install --upgrade distribute
  56. See: https://github.com/mxcl/homebrew/wiki/Homebrew-and-Python
  57. EOS
  58. end
  59. # The HOMEBREW_PREFIX location of site-packages
  60. def prefix_site_packages
  61. HOMEBREW_PREFIX+"lib/pypy/site-packages"
  62. end
  63. # Where distribute will install executable scripts
  64. def scripts_folder
  65. HOMEBREW_PREFIX+"share/pypy"
  66. end
  67. # The Cellar location of distutils
  68. def distutils
  69. prefix+"lib-python/2.7/distutils"
  70. end
  71. end