Skip to content
This repository has been archived by the owner on Dec 2, 2020. It is now read-only.

Commit

Permalink
Merge pull request #5 from bryanveloso/re-integrate
Browse files Browse the repository at this point in the history
Re-Integrate
  • Loading branch information
wfarr committed Mar 5, 2013
2 parents 989c59b + 159bfb7 commit d56246a
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 153 deletions.
25 changes: 0 additions & 25 deletions files/brews/python-distribute.rb

This file was deleted.

25 changes: 0 additions & 25 deletions files/brews/python-pip.rb

This file was deleted.

39 changes: 25 additions & 14 deletions files/brews/python.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
require 'formula'

class Distribute < Formula
url 'http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz'
sha1 'b6f9cfbaf3e63833b71009812a613be13e68f5de'
end

class Pip < Formula
url 'http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz'
sha1 '35db84983ef3f66a8a161d320e61d192afc233d9'
end

class Python < Formula
homepage 'http://www.python.org'
url 'http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2'
sha1 '842c4e2aff3f016feea3c6e992c7fa96e49c9aa0'
version '2.7.3-boxen1'
version '2.7.3-boxen2'

option :universal
option 'quicktest', 'Run `make quicktest` after the build'
Expand Down Expand Up @@ -41,7 +51,7 @@ def site_packages
HOMEBREW_PREFIX/"lib/python2.7/site-packages"
end

# Where distribute/pip will later install executable scripts.
# Where distribute/pip will install executable scripts.
def scripts_folder
HOMEBREW_PREFIX/"share/python"
end
Expand Down Expand Up @@ -99,12 +109,8 @@ def install
# so that user-installed Python software survives minor updates, such
# as going from 2.7.0 to 2.7.1:

# Remove the site-packages that Python created in its Cellar.
site_packages_cellar.rmtree
# Create a site-packages in HOMEBREW_PREFIX/lib/python/site-packages
site_packages.mkpath
# Symlink the prefix site-packages into the cellar.
ln_s site_packages, site_packages_cellar
# Symlink the cellar into the prefix site-packages.
ln_s site_packages_cellar, site_packages

# Teach python not to use things from /System
# and tell it about the correct site-package dir because we moved it
Expand All @@ -116,7 +122,7 @@ def install
import sys
import site
# Only do fix 1 and 2, if the currently run python is a brewed one.
# Only fix if the currently run python is a brewed one.
if sys.executable.startswith('#{HOMEBREW_PREFIX}'):
# Fix 1)
# A setuptools.pth and/or easy-install.pth sitting either in
Expand All @@ -129,16 +135,21 @@ def install
# See: https://github.com/mxcl/homebrew/issues/14712
sys.path = [ p for p in sys.path if not p.startswith('/System') ]
# Fix 2)
# Remove brewed Python's hard-coded site-packages
sys.path.remove('#{site_packages_cellar}')
# Fix 3)
# Fix 2)
# For all Pythons: Tell about homebrew's site-packages location.
# This is needed for Python to parse *.pth files.
site.addsitedir('#{site_packages}')
EOF

# Install distribute and pip
# It's important to have these installers in our bin, because some users
# forget to put #{script_folder} in PATH, then easy_install'ing
# into /Library/Python/X.Y/site-packages with /usr/bin/easy_install.
mkdir_p scripts_folder unless scripts_folder.exist?
setup_args = ["-s", "setup.py", "--no-user-cfg", "install", "--force", "--verbose", "--install-lib=#{site_packages_cellar}", "--install-scripts=#{bin}" ]
Distribute.new.brew { system "#{bin}/python", *setup_args }
Pip.new.brew { system "#{bin}/python", *setup_args }

# Tell distutils-based installers where to put scripts and python modules
(prefix/"Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/distutils.cfg").write <<-EOF.undent
[install]
Expand Down
14 changes: 0 additions & 14 deletions manifests/distribute.pp

This file was deleted.

25 changes: 5 additions & 20 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
include homebrew::config
include xquartz

$version = '2.7.3-boxen1'
$version = '2.7.3-boxen2'

homebrew::formula { 'python':
before => Package['boxen/brews/python']
Expand All @@ -20,29 +20,14 @@
require => Class['xquartz']
}

file {
[
"${homebrew::config::installdir}/lib/python2.7",
"${homebrew::config::installdir}/lib/python2.7/site-packages"
]:
ensure => 'directory',
require => Package['boxen/brews/python'] ;
}

file { "${homebrew::config::installdir}/Cellar/python/${version}/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages":
force => true,
file { "${homebrew::config::installdir}/lib/python2.7/site-packages":
ensure => link,
target => "${homebrew::config::installdir}/lib/python2.7/site-packages",
require => [
Package['boxen/brews/python'],
File["${homebrew::config::installdir}/lib/python2.7/site-packages"]
]
force => true,
target => "${homebrew::config::installdir}/Cellar/python/${version}/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages",
require => Package['boxen/brews/python']
}

file { "${boxen::config::envdir}/python.sh":
source => 'puppet:///modules/python/python.sh'
}

include python::distribute
include python::pip
}
14 changes: 0 additions & 14 deletions manifests/pip.pp

This file was deleted.

19 changes: 0 additions & 19 deletions spec/classes/python__distribute_spec.rb

This file was deleted.

19 changes: 0 additions & 19 deletions spec/classes/python__pip_spec.rb

This file was deleted.

4 changes: 1 addition & 3 deletions spec/classes/python_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@
should include_class('homebrew')
should include_class('xquartz')
should include_class('boxen::config')
should include_class('python::distribute')
should include_class('python::pip')

should contain_homebrew__formula('python').with(
:before => 'Package[boxen/brews/python]',
)
should contain_package('boxen/brews/python').with_ensure('2.7.3-boxen1')
should contain_package('boxen/brews/python').with_ensure('2.7.3-boxen2')

should contain_file('/opt/boxen/env.d/python.sh').with(
:source => 'puppet:///modules/python/python.sh',
Expand Down

0 comments on commit d56246a

Please sign in to comment.