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

Commit d56246a

Browse files
committed
Merge pull request #5 from bryanveloso/re-integrate
Re-Integrate
2 parents 989c59b + 159bfb7 commit d56246a

File tree

9 files changed

+31
-153
lines changed

9 files changed

+31
-153
lines changed

files/brews/python-distribute.rb

Lines changed: 0 additions & 25 deletions
This file was deleted.

files/brews/python-pip.rb

Lines changed: 0 additions & 25 deletions
This file was deleted.

files/brews/python.rb

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
require 'formula'
22

3+
class Distribute < Formula
4+
url 'http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz'
5+
sha1 'b6f9cfbaf3e63833b71009812a613be13e68f5de'
6+
end
7+
8+
class Pip < Formula
9+
url 'http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz'
10+
sha1 '35db84983ef3f66a8a161d320e61d192afc233d9'
11+
end
12+
313
class Python < Formula
414
homepage 'http://www.python.org'
515
url 'http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2'
616
sha1 '842c4e2aff3f016feea3c6e992c7fa96e49c9aa0'
7-
version '2.7.3-boxen1'
17+
version '2.7.3-boxen2'
818

919
option :universal
1020
option 'quicktest', 'Run `make quicktest` after the build'
@@ -41,7 +51,7 @@ def site_packages
4151
HOMEBREW_PREFIX/"lib/python2.7/site-packages"
4252
end
4353

44-
# Where distribute/pip will later install executable scripts.
54+
# Where distribute/pip will install executable scripts.
4555
def scripts_folder
4656
HOMEBREW_PREFIX/"share/python"
4757
end
@@ -99,12 +109,8 @@ def install
99109
# so that user-installed Python software survives minor updates, such
100110
# as going from 2.7.0 to 2.7.1:
101111

102-
# Remove the site-packages that Python created in its Cellar.
103-
site_packages_cellar.rmtree
104-
# Create a site-packages in HOMEBREW_PREFIX/lib/python/site-packages
105-
site_packages.mkpath
106-
# Symlink the prefix site-packages into the cellar.
107-
ln_s site_packages, site_packages_cellar
112+
# Symlink the cellar into the prefix site-packages.
113+
ln_s site_packages_cellar, site_packages
108114

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

144+
# Install distribute and pip
145+
# It's important to have these installers in our bin, because some users
146+
# forget to put #{script_folder} in PATH, then easy_install'ing
147+
# into /Library/Python/X.Y/site-packages with /usr/bin/easy_install.
148+
mkdir_p scripts_folder unless scripts_folder.exist?
149+
setup_args = ["-s", "setup.py", "--no-user-cfg", "install", "--force", "--verbose", "--install-lib=#{site_packages_cellar}", "--install-scripts=#{bin}" ]
150+
Distribute.new.brew { system "#{bin}/python", *setup_args }
151+
Pip.new.brew { system "#{bin}/python", *setup_args }
152+
142153
# Tell distutils-based installers where to put scripts and python modules
143154
(prefix/"Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/distutils.cfg").write <<-EOF.undent
144155
[install]

manifests/distribute.pp

Lines changed: 0 additions & 14 deletions
This file was deleted.

manifests/init.pp

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
include homebrew::config
1010
include xquartz
1111

12-
$version = '2.7.3-boxen1'
12+
$version = '2.7.3-boxen2'
1313

1414
homebrew::formula { 'python':
1515
before => Package['boxen/brews/python']
@@ -20,29 +20,14 @@
2020
require => Class['xquartz']
2121
}
2222

23-
file {
24-
[
25-
"${homebrew::config::installdir}/lib/python2.7",
26-
"${homebrew::config::installdir}/lib/python2.7/site-packages"
27-
]:
28-
ensure => 'directory',
29-
require => Package['boxen/brews/python'] ;
30-
}
31-
32-
file { "${homebrew::config::installdir}/Cellar/python/${version}/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages":
33-
force => true,
23+
file { "${homebrew::config::installdir}/lib/python2.7/site-packages":
3424
ensure => link,
35-
target => "${homebrew::config::installdir}/lib/python2.7/site-packages",
36-
require => [
37-
Package['boxen/brews/python'],
38-
File["${homebrew::config::installdir}/lib/python2.7/site-packages"]
39-
]
25+
force => true,
26+
target => "${homebrew::config::installdir}/Cellar/python/${version}/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages",
27+
require => Package['boxen/brews/python']
4028
}
4129

4230
file { "${boxen::config::envdir}/python.sh":
4331
source => 'puppet:///modules/python/python.sh'
4432
}
45-
46-
include python::distribute
47-
include python::pip
4833
}

manifests/pip.pp

Lines changed: 0 additions & 14 deletions
This file was deleted.

spec/classes/python__distribute_spec.rb

Lines changed: 0 additions & 19 deletions
This file was deleted.

spec/classes/python__pip_spec.rb

Lines changed: 0 additions & 19 deletions
This file was deleted.

spec/classes/python_spec.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,11 @@
1111
should include_class('homebrew')
1212
should include_class('xquartz')
1313
should include_class('boxen::config')
14-
should include_class('python::distribute')
15-
should include_class('python::pip')
1614

1715
should contain_homebrew__formula('python').with(
1816
:before => 'Package[boxen/brews/python]',
1917
)
20-
should contain_package('boxen/brews/python').with_ensure('2.7.3-boxen1')
18+
should contain_package('boxen/brews/python').with_ensure('2.7.3-boxen2')
2119

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

0 commit comments

Comments
 (0)