Skip to content

Commit 770715b

Browse files
committed
release 0.10
1 parent 7bdb546 commit 770715b

30 files changed

Lines changed: 481 additions & 254 deletions

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
* 0.10
2+
- Added systemwide install support. (issue #31)
3+
- Fixed issue #41 Handle venv binary with the symlink command.
4+
- Improved `venv` command (without virtualenvwrapper)
5+
16
* 0.9
27
- Added `buildout` command.
38
- Added `venv` command.

PKG-INFO

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,17 @@ If you need to install pythonbrew into somewhere else, you can do that by settin
2525
chmod +x pythonbrewinstall
2626
./pythonbrewinstall
2727

28+
For Systemwide(Multi-User) installation
29+
---------------------------------------
30+
31+
If the install script is run as root, pythonbrew will automatically install into /usr/local/pythonbrew.
32+
33+
The pythonbrew will be automatically configured for every user on the system if you install as root.
34+
35+
After installation, where you would normally use `sudo`, non-root users will need to use `sudopybrew`::
36+
37+
sudopybrew install -n -v -j2 2.7.2
38+
2839
Usage
2940
=====
3041

@@ -91,14 +102,16 @@ Create/Remove a symbolic link to python (in a directory on your $PATH)::
91102
pythonbrew symlink -p 2.7.2
92103
pythonbrew symlink pip # Create a symbolic link to the specified script in bin directory
93104
pythonbrew symlink -r # Remove a symbolic link
105+
pythonbrew symlink -v foo # Create a symbolic link to the specified virtual environment python in bin directory
94106

95107
Runs the buildout with specified or current using python::
96108

97109
pythonbrew buildout
98110
pythonbrew buildout -p 2.6.6
99111

100-
Create isolated python environments (uses virtualenv and virtualenvwrapper)::
112+
Create isolated python environments (uses virtualenv)::
101113

114+
pythonbrew venv init
102115
pythonbrew venv create proj
103116
pythonbrew venv list
104117
pythonbrew venv use proj
@@ -149,7 +162,7 @@ buildout
149162
Runs the buildout with specified or current using python.
150163

151164
venv
152-
Create isolated python environments (uses virtualenv and virtualenvwrapper)
165+
Create isolated python environments (uses virtualenv)
153166

154167
version
155168
Show version.
@@ -160,11 +173,18 @@ See more details below
160173
Changelog
161174
=========
162175

176+
0.10 (2011-08-08)
177+
-----------------
178+
179+
- Added systemwide install support. (issue #31)
180+
- Fixed issue #41 Handle venv binary with the symlink command.
181+
- Improved `venv` command (without virtualenvwrapper)
182+
163183
0.9 (2011-07-21)
164184
----------------
165185

166-
- Add `venv` command (virtualenv and virtualenvwrapper supported)
167-
- Add `buildout` command.
186+
- Added `venv` command (uses virtualenv and virtualenvwrapper)
187+
- Added `buildout` command.
168188

169189
0.8 (2011-07-10)
170190
----------------

README.rst

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,17 @@ If you need to install pythonbrew into somewhere else, you can do that by settin
2525
chmod +x pythonbrewinstall
2626
./pythonbrewinstall
2727

28+
For Systemwide(Multi-User) installation
29+
---------------------------------------
30+
31+
If the install script is run as root, pythonbrew will automatically install into /usr/local/pythonbrew.
32+
33+
The pythonbrew will be automatically configured for every user on the system if you install as root.
34+
35+
After installation, where you would normally use `sudo`, non-root users will need to use `sudopybrew`::
36+
37+
sudopybrew install -n -v -j2 2.7.2
38+
2839
Usage
2940
=====
3041

@@ -91,14 +102,16 @@ Create/Remove a symbolic link to python (in a directory on your $PATH)::
91102
pythonbrew symlink -p 2.7.2
92103
pythonbrew symlink pip # Create a symbolic link to the specified script in bin directory
93104
pythonbrew symlink -r # Remove a symbolic link
105+
pythonbrew symlink -v foo # Create a symbolic link to the specified virtual environment python in bin directory
94106

95107
Runs the buildout with specified or current using python::
96108
97109
pythonbrew buildout
98110
pythonbrew buildout -p 2.6.6
99111

100-
Create isolated python environments (uses virtualenv and virtualenvwrapper)::
112+
Create isolated python environments (uses virtualenv)::
101113
114+
pythonbrew venv init
102115
pythonbrew venv create proj
103116
pythonbrew venv list
104117
pythonbrew venv use proj
@@ -149,7 +162,7 @@ buildout
149162
Runs the buildout with specified or current using python.
150163

151164
venv
152-
Create isolated python environments (uses virtualenv and virtualenvwrapper)
165+
Create isolated python environments (uses virtualenv)
153166

154167
version
155168
Show version.

pythonbrew-install

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,23 @@ if [[ $PYTHON_FOUND != '1' ]] ; then
6666
exit
6767
fi
6868

69-
ROOT="$HOME/.pythonbrew"
70-
if [[ -n $PYTHONBREW_ROOT ]] ; then
71-
ROOT=$PYTHONBREW_ROOT
69+
systemwide_install=0
70+
if [[ -n "$PYTHONBREW_ROOT" ]] ; then
71+
ROOT="$PYTHONBREW_ROOT"
72+
else
73+
if (( UID == 0 )) ; then
74+
systemwide_install=1
75+
ROOT="/usr/local/pythonbrew"
76+
else
77+
ROOT="$HOME/.pythonbrew"
78+
fi
7279
fi
7380
PATH_DISTS="$ROOT/dists"
7481

7582
STABLE_VERSION=`curl -skL https://github.com/utahta/pythonbrew/raw/master/stable-version.txt`
7683
STABLE_VERSION=`trim $STABLE_VERSION`
77-
if [[ $STABLE_VERSION = "" ]] ; then
78-
echo 'Could not get stable-version of pythonbrew.'
84+
if [[ -z "$STABLE_VERSION" ]] ; then
85+
echo 'Can not get stable-version of pythonbrew.'
7986
exit 1
8087
fi
8188
TEMP_FILE="pythonbrew-$STABLE_VERSION"
@@ -93,7 +100,11 @@ echo "Extracting $PATH_DISTS/$TEMP_TARBALL"
93100
builtin cd $PATH_DISTS ; tar zxf $TEMP_TARBALL
94101

95102
echo "Installing pythonbrew into $ROOT"
96-
$PYTHON $PATH_DISTS/$TEMP_FILE/pythonbrew_install.py
103+
if (( systemwide_install == 1 )) ; then
104+
PYTHONBREW_ROOT="$ROOT" $PYTHON $PATH_DISTS/$TEMP_FILE/pythonbrew_install.py --systemwide
105+
else
106+
$PYTHON $PATH_DISTS/$TEMP_FILE/pythonbrew_install.py
107+
fi
97108
if [[ $? == 1 ]] ; then
98109
echo "Failed to install pythonbrew."
99110
exit

pythonbrew/__init__.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
import sys
2+
import os
23
from pythonbrew.basecommand import command_dict, load_all_commands
34
from pythonbrew.baseparser import parser
45
from pythonbrew.log import logger
6+
from pythonbrew.define import PATH_HOME_ETC
7+
from pythonbrew.util import makedirs
8+
9+
def init_home():
10+
if not os.path.isdir(PATH_HOME_ETC):
11+
makedirs(PATH_HOME_ETC)
512

613
def main():
714
options, args = parser.parse_args(sys.argv[1:])
@@ -10,13 +17,10 @@ def main():
1017
if not args:
1118
args = ['help'] # as default
1219

20+
init_home()
1321
load_all_commands()
1422
command = args[0].lower()
1523
if command not in command_dict:
16-
if command == 'clean':
17-
# note: for some time
18-
logger.info('\nDEPRECATION WARNING: `pythonbrew clean` has been renamed. Please run `pythonbrew cleanup` instead.\n')
19-
return
2024
parser.error("Unknown command: `%s`" % command)
2125
return
2226
command = command_dict[command]

pythonbrew/commands/buildout.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import sys
33
import subprocess
44
from pythonbrew.basecommand import Command
5-
from pythonbrew.define import PATH_PYTHONS, BOOTSTRAP_DLSITE, PATH_DISTS
5+
from pythonbrew.define import PATH_PYTHONS, BOOTSTRAP_DLSITE
66
from pythonbrew.util import Package, get_using_python_pkgname, Link, is_installed
77
from pythonbrew.log import logger
88
from pythonbrew.downloader import Downloader
@@ -28,7 +28,7 @@ def run_command(self, options, args):
2828
else:
2929
pkgname = get_using_python_pkgname()
3030
if not is_installed(pkgname):
31-
logger.info('%s is not installed.' % pkgname)
31+
logger.error('`%s` is not installed.' % pkgname)
3232
sys.exit(1)
3333
logger.info('Using %s' % pkgname)
3434

@@ -38,20 +38,21 @@ def run_command(self, options, args):
3838
# Download bootstrap.py
3939
download_url = BOOTSTRAP_DLSITE
4040
filename = Link(download_url).filename
41-
bootstrap = os.path.join(PATH_DISTS, filename)
41+
bootstrap = os.path.join(os.getcwd(), filename) # fetching into current directory
4242
try:
4343
d = Downloader()
4444
d.download(filename, download_url, bootstrap)
4545
except:
46-
logger.error("Failed to download. `%s`" % download_url)
46+
e = sys.exc_info()[1]
47+
logger.error("%s" % (e))
4748
sys.exit(1)
4849

49-
# Using bootstrap.py
50+
# call bootstrap.py
5051
if subprocess.call([python, bootstrap, '-d']):
5152
logger.error('Failed to bootstrap.')
5253
sys.exit(1)
5354

54-
# Using buildout
55+
# call buildout
5556
subprocess.call(['./bin/buildout'])
5657

5758
BuildoutCommand()

pythonbrew/commands/help.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ def run_command(self, options, args):
1717
command.parser.print_help()
1818
return
1919
parser.print_help()
20-
logger.info("\nCommands available:")
20+
logger.log("\nCommands available:")
2121
commands = [command_dict[key] for key in sorted(command_dict.keys())]
2222
for command in commands:
23-
logger.info(" %s: %s" % (command.name, command.summary))
24-
logger.info("\nFurther Instructions:")
25-
logger.info(" https://github.com/utahta/pythonbrew")
23+
logger.log(" %s: %s" % (command.name, command.summary))
24+
logger.log("\nFurther Instructions:")
25+
logger.log(" https://github.com/utahta/pythonbrew")
2626

2727
HelpCommand()

pythonbrew/commands/install.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import sys
12
from pythonbrew.basecommand import Command
2-
from pythonbrew.log import logger
33
from pythonbrew.installer.pythoninstaller import PythonInstaller,\
44
PythonInstallerMacOSX
55
from pythonbrew.util import is_macosx
@@ -63,22 +63,22 @@ def __init__(self):
6363
)
6464

6565
def run_command(self, options, args):
66-
if args:
67-
# installing python
68-
for arg in args:
69-
try:
70-
if is_macosx():
71-
p = PythonInstallerMacOSX(arg, options)
72-
else:
73-
p = PythonInstaller(arg, options)
74-
p.install()
75-
except UnknownVersionException:
76-
continue
77-
except AlreadyInstalledException:
78-
continue
79-
except NotSupportedVersionException:
80-
continue
81-
else:
82-
logger.info("Unknown python version.")
66+
if not args:
67+
self.parser.print_help()
68+
sys.exit(1)
69+
# installing python
70+
for arg in args:
71+
try:
72+
if is_macosx():
73+
p = PythonInstallerMacOSX(arg, options)
74+
else:
75+
p = PythonInstaller(arg, options)
76+
p.install()
77+
except UnknownVersionException:
78+
continue
79+
except AlreadyInstalledException:
80+
continue
81+
except NotSupportedVersionException:
82+
continue
8383

8484
InstallCommand()

pythonbrew/commands/list.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
from pythonbrew.basecommand import Command
44
from pythonbrew.define import PYTHON_VERSION_URL, LATEST_VERSIONS_OF_PYTHON,\
55
PATH_PYTHONS
6-
from pythonbrew.util import Package, get_using_python_pkgname,\
7-
get_using_python_path
6+
from pythonbrew.util import Package, get_using_python_pkgname
87
from pythonbrew.log import logger
98

109
class ListCommand(Command):
@@ -36,18 +35,16 @@ def run_command(self, options, args):
3635
self.installed(options, args)
3736

3837
def installed(self, options, args):
39-
logger.info('# installed pythons')
38+
logger.log("# pythonbrew pythons")
4039
cur = get_using_python_pkgname()
4140
for d in sorted(os.listdir(PATH_PYTHONS)):
4241
if cur and cur == d:
43-
logger.info('%s (*)' % d)
42+
logger.log(' %s (*)' % d)
4443
else:
45-
logger.info('%s' % d)
46-
if not cur:
47-
logger.info('%s (*)' % get_using_python_path())
44+
logger.log(' %s' % d)
4845

4946
def available_install(self, options, args):
50-
logger.info('# available install pythons')
47+
logger.log('# Pythons')
5148
if args:
5249
pkg = Package(args[0])
5350
_re = re.compile(r"%s" % pkg.name)
@@ -57,12 +54,12 @@ def available_install(self, options, args):
5754
pkgs.append(pkgname)
5855
if pkgs:
5956
for pkgname in pkgs:
60-
logger.info("%s" % pkgname)
57+
logger.log("%s" % pkgname)
6158
else:
62-
logger.info("Python version not found. `%s`" % pkg.name)
59+
logger.error("`%s` was not found." % pkg.name)
6360
else:
6461
for pkgname in self._get_packages_name(options):
65-
logger.info("%s" % pkgname)
62+
logger.log("%s" % pkgname)
6663

6764
def _get_packages_name(self, options):
6865
return ["Python-%s" % version for version in sorted(PYTHON_VERSION_URL.keys())

pythonbrew/commands/py.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ def __init__(self):
3232

3333
def run_command(self, options, args):
3434
if not args:
35-
logger.info("Unrecognized command line argument: argument not found.")
35+
self.parser.print_help()
3636
sys.exit(1)
3737
pythons = self._get_pythons(options.pythons)
3838
for d in pythons:
3939
if options.verbose:
40-
logger.info('*** %s ***' % d)
40+
logger.info('`%s` running...' % d)
4141
path = os.path.join(PATH_PYTHONS, d, 'bin', args[0])
4242
if os.path.isfile(path) and os.access(path, os.X_OK):
4343
subprocess.call([path] + args[1:])
@@ -46,7 +46,7 @@ def run_command(self, options, args):
4646
if os.path.isfile(path) and os.access(path, os.X_OK):
4747
subprocess.call([path] + args)
4848
else:
49-
logger.info('%s: No such file or directory.' % path)
49+
logger.error('%s: No such file or directory.' % path)
5050

5151
def _get_pythons(self, _pythons):
5252
pythons = [Package(p).name for p in _pythons]

0 commit comments

Comments
 (0)