pep8 blank lines fixes
flake8 --select W391,E302,E301,E304 autopep8 can't fix W391 even though it claims it can. Fixed using a simple custom script.
This commit is contained in:
parent
be2c8bd789
commit
448c06d125
142 changed files with 249 additions and 25 deletions
|
|
@ -32,12 +32,15 @@ except ImportError:
|
|||
DEFAULT_VERSION = "1.1.6"
|
||||
DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/"
|
||||
|
||||
|
||||
def _python_cmd(*args):
|
||||
args = (sys.executable,) + args
|
||||
return subprocess.call(args) == 0
|
||||
|
||||
|
||||
def _check_call_py24(cmd, *args, **kwargs):
|
||||
res = subprocess.call(cmd, *args, **kwargs)
|
||||
|
||||
class CalledProcessError(Exception):
|
||||
pass
|
||||
if not res == 0:
|
||||
|
|
@ -45,6 +48,7 @@ def _check_call_py24(cmd, *args, **kwargs):
|
|||
raise CalledProcessError(msg)
|
||||
vars(subprocess).setdefault('check_call', _check_call_py24)
|
||||
|
||||
|
||||
def _install(tarball, install_args=()):
|
||||
# extracting the tarball
|
||||
tmpdir = tempfile.mkdtemp()
|
||||
|
|
@ -151,6 +155,7 @@ def use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
|
|||
return _do_download(version, download_base, to_dir,
|
||||
download_delay)
|
||||
|
||||
|
||||
def download_file_powershell(url, target):
|
||||
"""
|
||||
Download the file at url to target using Powershell (which will validate
|
||||
|
|
@ -164,6 +169,7 @@ def download_file_powershell(url, target):
|
|||
]
|
||||
subprocess.check_call(cmd)
|
||||
|
||||
|
||||
def has_powershell():
|
||||
if platform.system() != 'Windows':
|
||||
return False
|
||||
|
|
@ -180,10 +186,12 @@ def has_powershell():
|
|||
|
||||
download_file_powershell.viable = has_powershell
|
||||
|
||||
|
||||
def download_file_curl(url, target):
|
||||
cmd = ['curl', url, '--silent', '--output', target]
|
||||
subprocess.check_call(cmd)
|
||||
|
||||
|
||||
def has_curl():
|
||||
cmd = ['curl', '--version']
|
||||
devnull = open(os.path.devnull, 'wb')
|
||||
|
|
@ -198,10 +206,12 @@ def has_curl():
|
|||
|
||||
download_file_curl.viable = has_curl
|
||||
|
||||
|
||||
def download_file_wget(url, target):
|
||||
cmd = ['wget', url, '--quiet', '--output-document', target]
|
||||
subprocess.check_call(cmd)
|
||||
|
||||
|
||||
def has_wget():
|
||||
cmd = ['wget', '--version']
|
||||
devnull = open(os.path.devnull, 'wb')
|
||||
|
|
@ -216,6 +226,7 @@ def has_wget():
|
|||
|
||||
download_file_wget.viable = has_wget
|
||||
|
||||
|
||||
def download_file_insecure(url, target):
|
||||
"""
|
||||
Use Python to download the file, even though it cannot authenticate the
|
||||
|
|
@ -241,6 +252,7 @@ def download_file_insecure(url, target):
|
|||
|
||||
download_file_insecure.viable = lambda: True
|
||||
|
||||
|
||||
def get_best_downloader():
|
||||
downloaders = [
|
||||
download_file_powershell,
|
||||
|
|
@ -253,6 +265,7 @@ def get_best_downloader():
|
|||
if dl.viable():
|
||||
return dl
|
||||
|
||||
|
||||
def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
|
||||
to_dir=os.curdir, delay=15,
|
||||
downloader_factory=get_best_downloader):
|
||||
|
|
@ -338,6 +351,7 @@ def _build_install_args(options):
|
|||
install_args.append('--user')
|
||||
return install_args
|
||||
|
||||
|
||||
def _parse_args():
|
||||
"""
|
||||
Parse the command line for options
|
||||
|
|
@ -359,6 +373,7 @@ def _parse_args():
|
|||
# positional arguments are ignored
|
||||
return options
|
||||
|
||||
|
||||
def main(version=DEFAULT_VERSION):
|
||||
"""Install or upgrade setuptools and EasyInstall"""
|
||||
options = _parse_args()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue