mirror of
https://github.com/kennethreitz-archive/python-build.git
synced 2026-06-05 23:30:18 +00:00
Improve venv command, log and bashrc
This commit is contained in:
@@ -4,9 +4,9 @@ from pythonbrew.define import INSTALLER_ROOT, ROOT, PATH_ETC
|
||||
|
||||
def install_pythonbrew():
|
||||
PythonbrewInstaller().install(INSTALLER_ROOT)
|
||||
# pythonbrew is only for bash
|
||||
# for bash
|
||||
shrc = yourshrc = "bashrc"
|
||||
logger.info("""
|
||||
logger.log("""
|
||||
Well-done! Congratulations!
|
||||
|
||||
The pythonbrew is installed as:
|
||||
|
||||
@@ -7,7 +7,7 @@ from pythonbrew.define import PATH_BUILD, PATH_BIN, PATH_DISTS, PATH_PYTHONS,\
|
||||
PATH_ETC, PATH_SCRIPTS, PATH_SCRIPTS_PYTHONBREW,\
|
||||
PATH_SCRIPTS_PYTHONBREW_COMMANDS, PATH_BIN_PYTHONBREW,\
|
||||
ROOT, PATH_LOG, PATH_PATCHES, PATH_ETC_CONFIG,\
|
||||
PATH_SCRIPTS_PYTHONBREW_INSTALLER, PATH_VENVS
|
||||
PATH_SCRIPTS_PYTHONBREW_INSTALLER, PATH_VENVS, PATH_HOME_ETC
|
||||
import stat
|
||||
|
||||
class PythonbrewInstaller(object):
|
||||
@@ -23,6 +23,7 @@ class PythonbrewInstaller(object):
|
||||
makedirs(PATH_BIN)
|
||||
makedirs(PATH_LOG)
|
||||
makedirs(PATH_VENVS)
|
||||
makedirs(PATH_HOME_ETC)
|
||||
|
||||
# create script directories
|
||||
rm_r(PATH_SCRIPTS)
|
||||
|
||||
@@ -38,7 +38,7 @@ class PythonInstaller(object):
|
||||
pkg = Package(name, options.alias)
|
||||
self.download_url = get_python_version_url(pkg.version)
|
||||
if not self.download_url:
|
||||
logger.info("Unknown python version: `%s`" % pkg.name)
|
||||
logger.error("Unknown python version: `%s`" % pkg.name)
|
||||
raise UnknownVersionException
|
||||
filename = Link(self.download_url).filename
|
||||
self.pkg = pkg
|
||||
@@ -83,11 +83,11 @@ class PythonInstaller(object):
|
||||
except:
|
||||
rm_r(self.install_dir)
|
||||
logger.error("Failed to install %s. See %s to see why." % (self.pkg.name, self.logfile))
|
||||
logger.info(" pythonbrew install --force %s" % self.pkg.version)
|
||||
logger.log(" pythonbrew install --force %s" % self.pkg.version)
|
||||
sys.exit(1)
|
||||
self.symlink()
|
||||
self.install_setuptools()
|
||||
logger.info("Installed %(pkgname)s successfully. Run the following command to switch to %(pkgname)s."
|
||||
logger.info("\nInstalled %(pkgname)s successfully. Run the following command to switch to %(pkgname)s."
|
||||
% {"pkgname":self.pkg.name})
|
||||
logger.info(" pythonbrew switch %s" % self.pkg.alias)
|
||||
|
||||
@@ -107,7 +107,7 @@ class PythonInstaller(object):
|
||||
dl.download(base_url, self.download_url, self.download_file)
|
||||
except:
|
||||
unlink(self.download_file)
|
||||
logger.info("\nInterrupt to abort. `%s`" % (self.download_url))
|
||||
logger.log("\nInterrupt to abort. `%s`" % (self.download_url))
|
||||
sys.exit(1)
|
||||
# extracting
|
||||
if not extract_downloadfile(self.content_type, self.download_file, self.build_dir):
|
||||
@@ -206,7 +206,7 @@ class PythonInstaller(object):
|
||||
options = self.options
|
||||
pkgname = self.pkg.name
|
||||
if options.no_setuptools:
|
||||
logger.info("Skip installation of setuptools.")
|
||||
logger.log("Skip installation of setuptools.")
|
||||
return
|
||||
download_url = DISTRIBUTE_SETUP_DLSITE
|
||||
filename = Link(download_url).filename
|
||||
@@ -228,7 +228,7 @@ class PythonInstaller(object):
|
||||
s.check_call([easy_install, 'pip'])
|
||||
except:
|
||||
logger.error("Failed to install setuptools. See %s/build.log to see why." % (ROOT))
|
||||
logger.info("Skip installation of setuptools.")
|
||||
logger.log("Skip installation of setuptools.")
|
||||
|
||||
class PythonInstallerMacOSX(PythonInstaller):
|
||||
"""Python installer for MacOSX
|
||||
@@ -239,7 +239,7 @@ class PythonInstallerMacOSX(PythonInstaller):
|
||||
# check for version
|
||||
version = self.pkg.version
|
||||
if version < '2.6' and (version != '2.4.6' and version < '2.5.5'):
|
||||
logger.info("`%s` is not supported on MacOSX Snow Leopard" % self.pkg.name)
|
||||
logger.error("`%s` is not supported on MacOSX Snow Leopard" % self.pkg.name)
|
||||
raise NotSupportedVersionException
|
||||
# set configure options
|
||||
target = get_macosx_deployment_target()
|
||||
|
||||
Reference in New Issue
Block a user