mirror of
https://github.com/kennethreitz-archive/python-build.git
synced 2026-06-05 23:30:18 +00:00
Bug fixed. Added tests.
This commit is contained in:
@@ -4,7 +4,7 @@ from pythonbrew.basecommand import Command
|
||||
from pythonbrew.define import PATH_PYTHONS
|
||||
from pythonbrew.util import Package
|
||||
from pythonbrew.log import logger
|
||||
from subprocess import PIPE, Popen
|
||||
from subprocess import Popen
|
||||
|
||||
class PyCommand(Command):
|
||||
name = "py"
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import os
|
||||
import sys
|
||||
from pythonbrew.basecommand import Command
|
||||
from pythonbrew.define import PATH_PYTHONS, PATH_BIN, PATH_ETC_CURRENT
|
||||
from pythonbrew.util import Package
|
||||
from pythonbrew.define import PATH_PYTHONS, PATH_BIN
|
||||
from pythonbrew.util import Package, set_current_path
|
||||
from pythonbrew.log import logger
|
||||
|
||||
class SwitchCommand(Command):
|
||||
@@ -22,14 +22,8 @@ class SwitchCommand(Command):
|
||||
sys.exit(1)
|
||||
pkgbin = os.path.join(pkgdir,'bin')
|
||||
|
||||
self._set_current('%s:%s' % (PATH_BIN, pkgbin))
|
||||
set_current_path('%s:%s' % (PATH_BIN, pkgbin))
|
||||
|
||||
logger.info("Switched to %s" % pkgname)
|
||||
|
||||
def _set_current(self, path):
|
||||
fp = open(PATH_ETC_CURRENT, 'w')
|
||||
fp.write('PATH_PYTHONBREW="%s"\n' % (path))
|
||||
fp.close()
|
||||
|
||||
|
||||
SwitchCommand()
|
||||
|
||||
@@ -22,7 +22,7 @@ class UpdateCommand(Command):
|
||||
# check for latest version
|
||||
if version <= VERSION:
|
||||
logger.info("You are already running the installed latest version of pythonbrew.")
|
||||
sys.exit()
|
||||
return
|
||||
|
||||
download_url = get_pythonbrew_update_url(version)
|
||||
if not download_url:
|
||||
|
||||
@@ -4,7 +4,7 @@ import glob
|
||||
import shutil
|
||||
import re
|
||||
import mimetypes
|
||||
from pythonbrew.util import makedirs, symlink, Package, is_url, splitext, Link,\
|
||||
from pythonbrew.util import makedirs, symlink, Package, is_url, Link,\
|
||||
unlink, is_html, Subprocess, rm_r,\
|
||||
is_macosx_snowleopard, is_python25, is_python24, is_python26,\
|
||||
unpack_downloadfile, is_archive_file, path_to_fileurl, is_file,\
|
||||
|
||||
+7
-3
@@ -8,8 +8,7 @@ import tarfile
|
||||
import platform
|
||||
import urllib
|
||||
from subprocess import PIPE, Popen
|
||||
from pythonbrew.define import PATH_BIN, PATH_PYTHONS, PATH_ETC_CURRENT,\
|
||||
PATH_ETC_TEMP
|
||||
from pythonbrew.define import PATH_BIN, PATH_PYTHONS, PATH_ETC_CURRENT
|
||||
from pythonbrew.exceptions import ShellCommandException
|
||||
from pythonbrew.log import logger
|
||||
|
||||
@@ -108,7 +107,7 @@ def off():
|
||||
continue
|
||||
unlink("%s/%s" % (root, f))
|
||||
unlink("%s/current" % PATH_PYTHONS)
|
||||
write_current(PATH_BIN)
|
||||
set_current_path(PATH_BIN)
|
||||
|
||||
def split_leading_dir(path):
|
||||
path = str(path)
|
||||
@@ -202,6 +201,11 @@ def get_current_python_path():
|
||||
else:
|
||||
return None
|
||||
|
||||
def set_current_path(path):
|
||||
fp = open(PATH_ETC_CURRENT, 'w')
|
||||
fp.write('PATH_PYTHONBREW="%s"\n' % (path))
|
||||
fp.close()
|
||||
|
||||
def path_to_fileurl(path):
|
||||
path = os.path.normcase(os.path.abspath(path))
|
||||
url = urllib.quote(path)
|
||||
|
||||
Reference in New Issue
Block a user