# Path: nuka/utils.py
# PY3 = sys.version_info[0] == 3
# ARCHIVE_EXTS = ('.gz', '.tar', '.zip')
# LOG = 60
# CHANGED = logging.WARNING + 1
# PROGRESS = logging.WARNING + 2
#     def next(o):
# def default_watcher(delay=5):
#     def watcher(task, process):
# def import_module(name):
# def makedirs(dirname, mod=None, own=None):
# def chmod(dst, mod, recursive=False):
# def chown(dst, own, recursive=False):
# def best_executable():
# def isexecutable(path):
#     def __init__(self, value, alphabet=None, length=16):
#     def iterator(self):
#     def next(self):
# def proto_dumps(data, content_type=u'plain'):
# def proto_dumps_std(data, std, content_type='plain'):
# def proto_dumps_std_threadsafe(data, std):
# def proto_loads_std(std):
# class secret(object):
# 
# Path: nuka/tasks/file.py
# class exists(Task):
# class mkdir(Task):
# class mkdirs(Task):
# class rm(Task):
# class mv(Task):
# class chmod(Task):
# class chown(Task):
# class put(Task):
# class scripts(put):
# class cat(Task):
# class update(Task):
#     def __init__(self, dst=None, **kwargs):
#     def do(self):
#     def diff(self):
#     def __init__(self, dst=None, mod=None, own=None, **kwargs):
#     def do(self):
#     def diff(self):
#     def __init__(self, directories=None, **kwargs):
#     def do(self):
#     def diff(self):
#     def __init__(self, dst=None, **kwargs):
#     def do(self):
#     def diff(self):
#     def __init__(self, src=None, dst=None, **kwargs):
#     def do(self):
#     def diff(self):
#     def __init__(self, dst=None, mod='644', recursive=False, **kwargs):
#     def do(self):
#     def __init__(self, dst=None, own='root:root', recursive=False, **kwargs):
#     def do(self):
#     def __init__(self, files=None, **kwargs):
#     def pre_process(self):
#     def do(self):
#     def diff(self):
#     def do(self):
#     def __init__(self, src=None, **kwargs):
#     def do(self):
#     def __init__(self, dst=None, replaces=None, appends=None, **kwargs):
#     def pre_process(self):
#     def update(self, data):
#     def do(self):
#     def diff(self, dst=None, **kwargs):
# 
# Path: nuka/tasks/http.py
# class fetch(Task):
#     def __init__(self, src=None, dst=None, **kwargs):
#     def fetch(self, dst, src):
#     def do(self):


import os
import sys
    import logging
from nuka import utils
from nuka.tasks import file
from nuka.tasks import http
        binary = os.path.join(dst, 'bin', 'python')
        if not os.path.isfile(binary):
            executable = self.args.get('executable',
                                       utils.best_executable())
            if 'python3' in executable:
                # use stdlib venv
                args = [dst]
                self.sh([executable, '-m', 'venv', '--without-pip'] + args)
                self.sh([binary, '-m', 'ensurepip'], check=False)
            else:
                # use virtualenv
                dirname = os.path.dirname(sys.executable)
                venv = os.path.join(dirname, 'virtualenv')
                if not os.path.isfile(venv):
                    venv = 'virtualenv'

                res = self.sh([venv, '-p', executable, dst])

        if not os.path.isfile(binary):
            raise OSError('Not able to create {0}'.format(binary))

        has_pip = False
        if os.path.isfile(pip):
            has_pip = True
        if not has_pip:
            res = self.sh([binary, '-m', 'pip', '--version'], check=False)
            if res['rc'] == 0:
                has_pip = True

        if not has_pip:

# Path: nuka/utils.py
# PY3 = sys.version_info[0] == 3
# ARCHIVE_EXTS = ('.gz', '.tar', '.zip')
# LOG = 60
# CHANGED = logging.WARNING + 1
# PROGRESS = logging.WARNING + 2
#     def next(o):
# def default_watcher(delay=5):
#     def watcher(task, process):
# def import_module(name):
# def makedirs(dirname, mod=None, own=None):
# def chmod(dst, mod, recursive=False):
# def chown(dst, own, recursive=False):
# def best_executable():
# def isexecutable(path):
#     def __init__(self, value, alphabet=None, length=16):
#     def iterator(self):
#     def next(self):
# def proto_dumps(data, content_type=u'plain'):
# def proto_dumps_std(data, std, content_type='plain'):
# def proto_dumps_std_threadsafe(data, std):
# def proto_loads_std(std):
# class secret(object):
# 
# Path: nuka/tasks/file.py
# class exists(Task):
# class mkdir(Task):
# class mkdirs(Task):
# class rm(Task):
# class mv(Task):
# class chmod(Task):
# class chown(Task):
# class put(Task):
# class scripts(put):
# class cat(Task):
# class update(Task):
#     def __init__(self, dst=None, **kwargs):
#     def do(self):
#     def diff(self):
#     def __init__(self, dst=None, mod=None, own=None, **kwargs):
#     def do(self):
#     def diff(self):
#     def __init__(self, directories=None, **kwargs):
#     def do(self):
#     def diff(self):
#     def __init__(self, dst=None, **kwargs):
#     def do(self):
#     def diff(self):
#     def __init__(self, src=None, dst=None, **kwargs):
#     def do(self):
#     def diff(self):
#     def __init__(self, dst=None, mod='644', recursive=False, **kwargs):
#     def do(self):
#     def __init__(self, dst=None, own='root:root', recursive=False, **kwargs):
#     def do(self):
#     def __init__(self, files=None, **kwargs):
#     def pre_process(self):
#     def do(self):
#     def diff(self):
#     def do(self):
#     def __init__(self, src=None, **kwargs):
#     def do(self):
#     def __init__(self, dst=None, replaces=None, appends=None, **kwargs):
#     def pre_process(self):
#     def update(self, data):
#     def do(self):
#     def diff(self, dst=None, **kwargs):
# 
# Path: nuka/tasks/http.py
# class fetch(Task):
#     def __init__(self, src=None, dst=None, **kwargs):
#     def fetch(self, dst, src):
#     def do(self):


# Path: nuka/tasks/virtualenv.py
import os
import sys
    import logging
from nuka import utils
from nuka.tasks import file
from nuka.tasks import http

        binary = os.path.join(dst, 'bin', 'python')
        if not os.path.isfile(binary):
            executable = self.args.get('executable',
                                       utils.best_executable())
            if 'python3' in executable:
                # use stdlib venv
                args = [dst]
                self.sh([executable, '-m', 'venv', '--without-pip'] + args)
                self.sh([binary, '-m', 'ensurepip'], check=False)
            else:
                # use virtualenv
                dirname = os.path.dirname(sys.executable)
                venv = os.path.join(dirname, 'virtualenv')
                if not os.path.isfile(venv):
                    venv = 'virtualenv'

                res = self.sh([venv, '-p', executable, dst])

        if not os.path.isfile(binary):
            raise OSError('Not able to create {0}'.format(binary))

        has_pip = False
        if os.path.isfile(pip):
            has_pip = True
        if not has_pip:
            res = self.sh([binary, '-m', 'pip', '--version'], check=False)
            if res['rc'] == 0:
                has_pip = True

        if not has_pip:

            res = self.check(http.fetch(