update version 0.6.1

This commit is contained in:
utahta
2010-11-18 01:29:24 +09:00
parent 53236cc001
commit 0bc17f56db
6 changed files with 33 additions and 24 deletions
+1
View File
@@ -1 +1,2 @@
recursive-include pythonbrew/patches *
include pythonbrew_install.py
+7 -7
View File
@@ -57,12 +57,14 @@ fi
PATH_DISTS="$ROOT/dists"
PATH_ETC="$ROOT/etc"
mkdir -p $PATH_DISTS
rm -rf $PATH_DISTS/pythonbrew.tar.gz
rm -rf $PATH_DISTS/utahta-pythonbrew*
STABLE_VERSION=`curl -sL https://github.com/utahta/pythonbrew/raw/master/stable-version.txt`
TEMP_FILE="pythonbrew-$STABLE_VERSION"
TEMP_TARBALL="$TEMP_FILE.tar.gz"
DOWNLOAD_URL="http://pypi.python.org/packages/source/p/pythonbrew/$TEMP_TARBALL"
TEMP_TARBALL="pythonbrew.tar.gz"
DOWNLOAD_URL="http://github.com/utahta/pythonbrew/tarball/master"
mkdir -p $PATH_DISTS
rm -rf $PATH_DISTS/$TEMP_TARBALL
rm -rf $PATH_DISTS/$TEMP_FILE
echo "Downloading $DOWNLOAD_URL"
builtin cd $PATH_DISTS ; curl -sL $DOWNLOAD_URL -o "$TEMP_TARBALL"
@@ -70,8 +72,6 @@ builtin cd $PATH_DISTS ; curl -sL $DOWNLOAD_URL -o "$TEMP_TARBALL"
echo "Extracting $PATH_DISTS/$TEMP_TARBALL"
builtin cd $PATH_DISTS ; tar zxf $TEMP_TARBALL
TEMP_FILE=`ls $PATH_DISTS | grep utahta-pythonbrew`
echo "Installing pythonbrew into $ROOT"
$PYTHON $PATH_DISTS/$TEMP_FILE/pythonbrew_install.py
if [[ $? == 1 ]] ; then
+8 -6
View File
@@ -5,8 +5,8 @@ from pythonbrew.define import PATH_DISTS, VERSION, ROOT,\
PATH_BUILD
from pythonbrew.log import logger
from pythonbrew.downloader import Downloader, get_pythonbrew_update_url,\
get_response_from_url
from pythonbrew.util import rm_r, is_html, unpack_downloadfile
get_response_from_url, get_stable_version
from pythonbrew.util import rm_r, unpack_downloadfile, Link, is_gzip
from pythonbrew.installer import PythonbrewInstaller
class UpdateCommand(Command):
@@ -15,9 +15,10 @@ class UpdateCommand(Command):
summary = "Upgrades pythonbrew to the latest version"
def run_command(self, options, args):
version = "head"
if args:
version = args[0]
else:
version = get_stable_version()
# check for latest version
if version <= VERSION:
@@ -30,11 +31,12 @@ class UpdateCommand(Command):
sys.exit(1)
resp = get_response_from_url(download_url)
content_type = resp.info()['content-type']
if is_html(content_type):
if not is_gzip(content_type, Link(download_url).filename):
logger.error("Invalid content-type: `%s`" % content_type)
sys.exit(1)
distname = "pythonbrew.tgz"
filename = "pythonbrew-%s" % version
distname = "%s.tgz" % filename
download_file = os.path.join(PATH_DISTS, distname)
try:
d = Downloader()
@@ -43,7 +45,7 @@ class UpdateCommand(Command):
logger.error("Failed to download. `%s`" % download_url)
sys.exit(1)
extract_dir = os.path.join(PATH_BUILD, "pythonbrew")
extract_dir = os.path.join(PATH_BUILD, filename)
rm_r(extract_dir)
if not unpack_downloadfile(content_type, download_file, extract_dir):
sys.exit(1)
+6 -6
View File
@@ -1,6 +1,6 @@
import os
VERSION = "0.6"
VERSION = "0.6.1"
if os.environ.has_key("PYTHONBREW_ROOT"):
ROOT = os.environ["PYTHONBREW_ROOT"]
@@ -31,11 +31,11 @@ PATH_BIN_PYBREW = os.path.join(PATH_BIN,"pybrew") # pybrew is symlink as pythonb
DISTRIBUTE_SETUP_DLSITE = "http://python-distribute.org/distribute_setup.py"
# download pythonbrew url
PYTHONBREW_UPDATE_URL = {
"head": "http://github.com/utahta/pythonbrew/tarball/master",
"0.5": "https://github.com/utahta/pythonbrew/tarball/0.5",
"0.6": "https://github.com/utahta/pythonbrew/tarball/0.6",
}
PYTHONBREW_UPDATE_URL_HEAD = "http://github.com/utahta/pythonbrew/tarball/master"
PYTHONBREW_UPDATE_URL_PYPI = "http://pypi.python.org/packages/source/p/pythonbrew/pythonbrew-%s.tar.gz"
# stable version url
PYTHONBREW_STABLE_VERSION_URL = "https://github.com/utahta/pythonbrew/raw/master/stable-version.txt"
# download Python version url
PYTHON_VERSION_URL = {}
+10 -4
View File
@@ -2,7 +2,8 @@ import sys
import urllib
import urllib2
from pythonbrew.util import size_format
from pythonbrew.define import PYTHON_VERSION_URL, PYTHONBREW_UPDATE_URL
from pythonbrew.define import PYTHON_VERSION_URL, PYTHONBREW_STABLE_VERSION_URL, \
PYTHONBREW_UPDATE_URL_PYPI, PYTHONBREW_UPDATE_URL_HEAD
from pythonbrew.log import logger
def get_response_from_url(url):
@@ -17,6 +18,10 @@ def get_response_from_url(url):
sys.exit(1)
return resp
def get_stable_version():
resp = get_response_from_url(PYTHONBREW_STABLE_VERSION_URL)
return resp.read()
class Downloader(object):
def __init__(self):
self._msg = ""
@@ -43,9 +48,10 @@ class Downloader(object):
self._last_msg = now_msg
def get_pythonbrew_update_url(version):
if PYTHONBREW_UPDATE_URL.has_key(version):
return PYTHONBREW_UPDATE_URL[version]
return None
if version == "head":
return PYTHONBREW_UPDATE_URL_HEAD
else:
return PYTHONBREW_UPDATE_URL_PYPI % (version)
def get_python_version_url(version):
if PYTHON_VERSION_URL.has_key(version):
+1 -1
View File
@@ -1 +1 @@
0.6
0.6.1