PageRenderTime 44ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/Library/Formula/pypy.rb

https://bitbucket.org/cocoatomo/homebrew
Ruby | 91 lines | 63 code | 14 blank | 14 comment | 0 complexity | b714f48ef06229e426620293c571340a MD5 | raw file
  1. require 'formula'
  2. class Setuptools < Formula
  3. url 'https://pypi.python.org/packages/source/s/setuptools/setuptools-1.1.4.tar.gz'
  4. sha1 'b8bf9c2b8a114045598f0e16681d6a63a4d6cdf9'
  5. end
  6. class Pypy < Formula
  7. homepage 'http://pypy.org/'
  8. url 'https://bitbucket.org/pypy/pypy/downloads/pypy-2.1-osx64.tar.bz2'
  9. version '2.1.0'
  10. sha1 '6cdaa1dc0a47d9eb6d816f7d394ca46f290a1ed5'
  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 setuptools. The user can then do:
  29. # $ easy_install pip
  30. # $ pip install --upgrade setuptools
  31. # to get newer versions of setuptools outside of Homebrew.
  32. Setuptools.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_pypy,
  50. pip_pypy, any provided scripts will go into the install-scripts folder above,
  51. so you may want to add it to your PATH *after* the `$(brew --prefix)/bin`
  52. so you don't overwrite tools from CPython.
  53. Setuptools has been installed, so easy_install is available.
  54. To update setuptools itself outside of Homebrew:
  55. #{scripts_folder}/easy_install pip
  56. #{scripts_folder}/pip install --upgrade setuptools
  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 setuptools 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