diff --git a/ChangeLog b/ChangeLog index f962dcb..a990cdd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +* 0.6.8 + - Added Python-3.2 to the installation list + * 0.6.7 - Bug fixed: Off command did not work. - Added tests. @@ -48,4 +51,4 @@ - Bug fix * 0.1 - - First release \ No newline at end of file + - First release diff --git a/pythonbrew-install b/pythonbrew-install index a761572..7f64250 100755 --- a/pythonbrew-install +++ b/pythonbrew-install @@ -67,9 +67,9 @@ TEMP_FILE="pythonbrew-$STABLE_VERSION" TEMP_TARBALL="$TEMP_FILE.tar.gz" DOWNLOAD_URL="http://pypi.python.org/packages/source/p/pythonbrew/$TEMP_TARBALL" -mkdir -p $PATH_DISTS -rm -rf $PATH_DISTS/$TEMP_TARBALL -rm -rf $PATH_DISTS/$TEMP_FILE +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 --progress-bar -kL $DOWNLOAD_URL -o "$TEMP_TARBALL" diff --git a/pythonbrew/define.py b/pythonbrew/define.py index e388b1f..725159e 100644 --- a/pythonbrew/define.py +++ b/pythonbrew/define.py @@ -1,6 +1,6 @@ import os -VERSION = "0.6.7" +VERSION = "0.6.8" if os.environ.has_key("PYTHONBREW_ROOT"): ROOT = os.environ["PYTHONBREW_ROOT"] @@ -9,6 +9,7 @@ else: INSTALLER_ROOT = os.path.dirname(os.path.abspath(__file__)) +# directories PATH_PYTHONS = os.path.join(ROOT,"pythons") PATH_BUILD = os.path.join(ROOT,"build") PATH_DISTS = os.path.join(ROOT,"dists") @@ -23,23 +24,23 @@ PATH_PATCHES_MACOSX = os.path.join(PATH_PATCHES,"macosx") PATH_PATCHES_MACOSX_PYTHON25 = os.path.join(PATH_PATCHES_MACOSX,"python25") PATH_PATCHES_MACOSX_PYTHON24 = os.path.join(PATH_PATCHES_MACOSX,"python24") -# file path +# files PATH_BIN_PYTHONBREW = os.path.join(PATH_BIN,'pythonbrew') -PATH_BIN_PYBREW = os.path.join(PATH_BIN,'pybrew') # pybrew is symlink as 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') -# download setuptools url +# setuptools download DISTRIBUTE_SETUP_DLSITE = "http://python-distribute.org/distribute_setup.py" -# download pythonbrew url +# pythonbrew download 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 +# stable version text PYTHONBREW_STABLE_VERSION_URL = "https://github.com/utahta/pythonbrew/raw/master/stable-version.txt" -# download Python version url +# python download PYTHON_VERSION_URL = {} PYTHON_VERSION_URL["1.5.2"] = "http://www.python.org/ftp/python/src/py152.tgz" PYTHON_VERSION_URL["1.6.1"] = "http://www.python.org/download/releases/1.6.1/Python-1.6.1.tar.gz" @@ -54,18 +55,12 @@ _PYTHON_VERSIONS_LIST = [ "2.7", "2.7.1", "3.0", "3.0.1", "3.1", "3.1.1", "3.1.2", "3.1.3", + "3.2", ] for version in _PYTHON_VERSIONS_LIST: PYTHON_VERSION_URL[version] = "http://www.python.org/ftp/python/%s/Python-%s.tgz" % (version, version) del _PYTHON_VERSIONS_LIST -PYTHON_VERSION_URL["3.2a1"] = "http://www.python.org/ftp/python/3.2/Python-3.2a1.tgz" -PYTHON_VERSION_URL["3.2a2"] = "http://www.python.org/ftp/python/3.2/Python-3.2a2.tgz" -PYTHON_VERSION_URL["3.2a3"] = "http://www.python.org/ftp/python/3.2/Python-3.2a3.tgz" -PYTHON_VERSION_URL["3.2a4"] = "http://www.python.org/ftp/python/3.2/Python-3.2a4.tgz" -PYTHON_VERSION_URL["3.2b1"] = "http://www.python.org/ftp/python/3.2/Python-3.2b1.tgz" LATEST_VERSIONS_OF_PYTHON = ['1.5.2', '1.6.1', '2.0.1', '2.1.3', '2.2.3', '2.3.7', '2.4.6', '2.5.5', '2.6.6', '2.7.1', - '3.0.1', '3.1.3', '3.2b1'] - - + '3.0.1', '3.1.3', '3.2'] diff --git a/pythonbrew/installer.py b/pythonbrew/installer.py index 32c0c15..828001f 100644 --- a/pythonbrew/installer.py +++ b/pythonbrew/installer.py @@ -20,7 +20,7 @@ from pythonbrew.log import logger def install_pythonbrew(): PythonbrewInstaller().install(INSTALLER_ROOT) - + m = re.search("(t?csh)", os.environ.get("SHELL")) if m: shrc = "cshrc" @@ -59,6 +59,7 @@ def upgrade_pythonbrew(): class PythonbrewInstaller(object): def install(self, installer_root): + # create directories makedirs(PATH_PYTHONS) makedirs(PATH_BUILD) makedirs(PATH_DISTS) @@ -66,35 +67,41 @@ class PythonbrewInstaller(object): makedirs(PATH_BIN) makedirs(PATH_LOG) + # remove old and create new script directories rm_r(PATH_SCRIPTS) makedirs(PATH_SCRIPTS) makedirs(PATH_SCRIPTS_PYTHONBREW) makedirs(PATH_SCRIPTS_PYTHONBREW_COMMANDS) + # copy all py files for path in glob.glob(os.path.join(installer_root,"*.py")): shutil.copy(path, PATH_SCRIPTS_PYTHONBREW) for path in glob.glob(os.path.join(installer_root,"commands","*.py")): shutil.copy(path, PATH_SCRIPTS_PYTHONBREW_COMMANDS) + # remove old and create patches direcotry rm_r(PATH_PATCHES) shutil.copytree(os.path.join(installer_root,"patches"), PATH_PATCHES) + # create main file fp = open("%s/pythonbrew_main.py" % PATH_SCRIPTS, "w") fp.write("""import pythonbrew if __name__ == "__main__": pythonbrew.main() """) fp.close() - + + # create entry point fp = open(PATH_BIN_PYTHONBREW, "w") fp.write("""#!/usr/bin/env bash %s %s/pythonbrew_main.py "$@" """ % (sys.executable, PATH_SCRIPTS)) fp.close() os.chmod(PATH_BIN_PYTHONBREW, 0755) - symlink(PATH_BIN_PYTHONBREW, PATH_BIN_PYBREW) # pybrew is symbolic pythonbrew + symlink(PATH_BIN_PYTHONBREW, PATH_BIN_PYBREW) # pybrew is symbolic link of pythonbrew + # create bashrc fp = open(os.path.join(PATH_ETC,'bashrc'), 'w') for line in open(os.path.join(installer_root,'scripts','bashrc')): line = line.replace('@ROOT@', ROOT) @@ -125,9 +132,9 @@ class PythonInstaller(object): sys.exit(1) filename = Link(self.download_url).filename self.pkg = pkg - self.install_dir = "%s/%s" % (PATH_PYTHONS, pkg.name) - self.build_dir = "%s/%s" % (PATH_BUILD, pkg.name) - self.download_file = "%s/%s" % (PATH_DISTS, filename) + self.install_dir = os.path.join(PATH_PYTHONS, pkg.name) + self.build_dir = os.path.join(PATH_BUILD, pkg.name) + self.download_file = os.path.join(PATH_DISTS, filename) if is_file(self.download_url): path = fileurl_to_path(self.download_url) self.content_type = mimetypes.guess_type(path)[0] @@ -135,7 +142,7 @@ class PythonInstaller(object): headerinfo = get_headerinfo_from_url(self.download_url) self.content_type = headerinfo['content-type'] self.options = options - self.logfile = "%s/build.log" % PATH_LOG + self.logfile = os.path.join(PATH_LOG, 'build.log') def install(self): if os.path.isdir(self.install_dir): @@ -240,7 +247,7 @@ class PythonInstaller(object): elif is_python25(version): configure_option = '--with-universal-archs="intel" MACOSX_DEPLOYMENT_TARGET=10.6 CPPFLAGS="-D_DARWIN_C_SOURCE"' elif is_python26(version): - configure_option = '--with-universal-archs="intel" MACOSX_DEPLOYMENT_TARGET=10.6' + configure_option = '--with-universal-archs="intel" --enable-universalsdk=/ MACOSX_DEPLOYMENT_TARGET=10.6' s = Subprocess(log=self.logfile, cwd=self.build_dir) s.check_call("./configure --prefix=%s %s %s" % (self.install_dir, self.options.configure, configure_option)) @@ -294,9 +301,11 @@ class PythonInstaller(object): s = Subprocess(log=self.logfile, cwd=PATH_DISTS) logger.info("Installing distribute into %s" % install_dir) s.check_call("%s %s" % (path_python, filename)) - if os.path.isfile("%s/bin/easy_install" % (install_dir)) and not is_python3: + # Using easy_install install pip + easy_install = os.path.join(install_dir, 'bin', 'easy_install') + if os.path.isfile(easy_install) and not is_python3: logger.info("Installing pip into %s" % install_dir) - s.check_call("%s/bin/easy_install pip" % (install_dir)) + s.check_call("%s pip" % (easy_install)) except: logger.error("Failed to install setuptools. See %s/build.log to see why." % (ROOT)) logger.info("Skip install setuptools.") diff --git a/stable-version.txt b/stable-version.txt index 8b707c6..c2b97d1 100644 --- a/stable-version.txt +++ b/stable-version.txt @@ -1 +1 @@ -0.6.7 \ No newline at end of file +0.6.8 \ No newline at end of file