Commit bd0e565b authored by Domen Kožar's avatar Domen Kožar

Merge pull request #77 from rvanlaar/patch-1

PEP8 changes for bootstrap.py
parents ef7d2ad3 ee709cfb
...@@ -18,7 +18,11 @@ The script accepts buildout command-line options, so you can ...@@ -18,7 +18,11 @@ The script accepts buildout command-line options, so you can
use the -c option to specify an alternate configuration file. use the -c option to specify an alternate configuration file.
""" """
import os, shutil, sys, tempfile import os
import shutil
import sys
import tempfile
from optparse import OptionParser from optparse import OptionParser
tmpeggs = tempfile.mkdtemp() tmpeggs = tempfile.mkdtemp()
...@@ -48,10 +52,10 @@ parser.add_option("-t", "--accept-buildout-test-releases", ...@@ -48,10 +52,10 @@ parser.add_option("-t", "--accept-buildout-test-releases",
"bootstrap and buildout will get the newest releases " "bootstrap and buildout will get the newest releases "
"even if they are alphas or betas.")) "even if they are alphas or betas."))
parser.add_option("-c", "--config-file", parser.add_option("-c", "--config-file",
help=("Specify the path to the buildout configuration " help=("Specify the path to the buildout configuration "
"file to be used.")) "file to be used."))
parser.add_option("-f", "--find-links", parser.add_option("-f", "--find-links",
help=("Specify a URL to search for buildout releases")) help=("Specify a URL to search for buildout releases"))
options, args = parser.parse_args() options, args = parser.parse_args()
...@@ -61,7 +65,8 @@ options, args = parser.parse_args() ...@@ -61,7 +65,8 @@ options, args = parser.parse_args()
to_reload = False to_reload = False
try: try:
import pkg_resources, setuptools import pkg_resources
import setuptools
if not hasattr(pkg_resources, '_distribute'): if not hasattr(pkg_resources, '_distribute'):
to_reload = True to_reload = True
raise ImportError raise ImportError
...@@ -73,7 +78,8 @@ except ImportError: ...@@ -73,7 +78,8 @@ except ImportError:
except ImportError: except ImportError:
from urllib2 import urlopen from urllib2 import urlopen
exec(urlopen('http://python-distribute.org/distribute_setup.py').read(), ez) exec(urlopen('http://python-distribute.org/distribute_setup.py').read(),
ez)
setup_args = dict(to_dir=tmpeggs, download_delay=0, no_fake=True) setup_args = dict(to_dir=tmpeggs, download_delay=0, no_fake=True)
ez['use_setuptools'](**setup_args) ez['use_setuptools'](**setup_args)
...@@ -89,7 +95,7 @@ except ImportError: ...@@ -89,7 +95,7 @@ except ImportError:
###################################################################### ######################################################################
# Install buildout # Install buildout
ws = pkg_resources.working_set ws = pkg_resources.working_set
cmd = [sys.executable, '-c', cmd = [sys.executable, '-c',
'from setuptools.command.easy_install import main; main()', 'from setuptools.command.easy_install import main; main()',
...@@ -113,6 +119,7 @@ if version is None and not options.accept_buildout_test_releases: ...@@ -113,6 +119,7 @@ if version is None and not options.accept_buildout_test_releases:
# Figure out the most recent final version of zc.buildout. # Figure out the most recent final version of zc.buildout.
import setuptools.package_index import setuptools.package_index
_final_parts = '*final-', '*final' _final_parts = '*final-', '*final'
def _final_version(parsed_version): def _final_version(parsed_version):
for part in parsed_version: for part in parsed_version:
if (part[:1] == '*') and (part not in _final_parts): if (part[:1] == '*') and (part not in _final_parts):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment