mirror of
https://github.com/kennethreitz-archive/python-build.git
synced 2026-06-05 15:20:16 +00:00
Added pybrew to bashrc and Help command by default
This commit is contained in:
@@ -5,10 +5,9 @@ from pythonbrew.baseparser import parser
|
||||
def main():
|
||||
options, args = parser.parse_args(sys.argv[1:])
|
||||
if options.help and not args:
|
||||
args = ["help"]
|
||||
args = ['help']
|
||||
if not args:
|
||||
parser.error('You must give a command (use "pythonbrew help" to see a list of commands)')
|
||||
return
|
||||
args = ['help'] # as default
|
||||
|
||||
load_all_commands()
|
||||
command = args[0].lower()
|
||||
|
||||
@@ -8,7 +8,7 @@ from pythonbrew.log import logger
|
||||
class SwitchCommand(Command):
|
||||
name = "switch"
|
||||
usage = "%prog VERSION"
|
||||
summary = "Switch to the given version of python"
|
||||
summary = "Permanently use the specified python as default"
|
||||
|
||||
def run_command(self, options, args):
|
||||
if not args:
|
||||
|
||||
@@ -8,7 +8,7 @@ from pythonbrew.log import logger
|
||||
class UseCommand(Command):
|
||||
name = "use"
|
||||
usage = "%prog VERSION"
|
||||
summary = "Using the given version of python"
|
||||
summary = "Use the specified python in current shell"
|
||||
|
||||
def run_command(self, options, args):
|
||||
if not args:
|
||||
|
||||
@@ -26,7 +26,6 @@ PATH_PATCHES_MACOSX_PYTHON24 = os.path.join(PATH_PATCHES_MACOSX,"python24")
|
||||
|
||||
# files
|
||||
PATH_BIN_PYTHONBREW = os.path.join(PATH_BIN,'pythonbrew')
|
||||
PATH_BIN_PYBREW = os.path.join(PATH_BIN,'pybrew') # pybrew is symbolic link of pythonbrew
|
||||
PATH_ETC_CURRENT = os.path.join(PATH_ETC,'current')
|
||||
PATH_ETC_TEMP = os.path.join(PATH_ETC,'temp')
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ def get_headerinfo_from_url(url):
|
||||
|
||||
def get_stable_version():
|
||||
c = Curl()
|
||||
return c.read(PYTHONBREW_STABLE_VERSION_URL)
|
||||
return c.read(PYTHONBREW_STABLE_VERSION_URL).strip()
|
||||
|
||||
class Downloader(object):
|
||||
def download(self, msg, url, path):
|
||||
|
||||
@@ -12,7 +12,7 @@ from pythonbrew.util import makedirs, symlink, Package, is_url, Link,\
|
||||
from pythonbrew.define import PATH_BUILD, PATH_BIN, PATH_DISTS, PATH_PYTHONS,\
|
||||
PATH_ETC, PATH_SCRIPTS, PATH_SCRIPTS_PYTHONBREW,\
|
||||
PATH_SCRIPTS_PYTHONBREW_COMMANDS, INSTALLER_ROOT, PATH_BIN_PYTHONBREW,\
|
||||
PATH_BIN_PYBREW, ROOT, PATH_LOG, DISTRIBUTE_SETUP_DLSITE, PATH_PATCHES,\
|
||||
ROOT, PATH_LOG, DISTRIBUTE_SETUP_DLSITE, PATH_PATCHES,\
|
||||
PATH_PATCHES_MACOSX_PYTHON25, PATH_PATCHES_MACOSX_PYTHON24
|
||||
from pythonbrew.downloader import get_python_version_url, Downloader,\
|
||||
get_headerinfo_from_url
|
||||
@@ -99,7 +99,6 @@ if __name__ == "__main__":
|
||||
""" % (sys.executable, PATH_SCRIPTS))
|
||||
fp.close()
|
||||
os.chmod(PATH_BIN_PYTHONBREW, 0755)
|
||||
symlink(PATH_BIN_PYTHONBREW, PATH_BIN_PYBREW) # pybrew is symbolic link of pythonbrew
|
||||
|
||||
# create bashrc
|
||||
fp = open(os.path.join(PATH_ETC,'bashrc'), 'w')
|
||||
|
||||
@@ -89,6 +89,10 @@ pythonbrew()
|
||||
builtin hash -r
|
||||
}
|
||||
|
||||
pybrew()
|
||||
{
|
||||
pythonbrew "$@"
|
||||
}
|
||||
|
||||
# main
|
||||
__pythonbrew_set_current_path
|
||||
|
||||
|
||||
Reference in New Issue
Block a user