def _run_setup_file(self, filename, extras=[]):
        """
        Transform and Run AST of the setup file
        :param filename: file to run
        :type filename: str
        :param extras: extras to install
        :type extras: list of str
        :return: tuple of (files installed, dependencies)
        :rtype: tuple of (list of str, list of str)
        """

        try:
            import pkg_resources
        except ImportError:
            # pkg_resources install may be in progress
            pkg_resources = None

        namespace = {
            '_setup_stub_': _setup_stub_,
            '__file__': filename,
            '__name__': '__main__',
            'setup_args': None,
            'setup_kwargs': None,
        }

        source_folder = os.path.dirname(filename)

        tree = ArchiveFileInstaller._get_cooked_ast(filename)
        codeobj = compile(tree, filename, 'exec')

        # Some setup files import the package to be installed and sometimes opens a file
        # in the source folder. So we modify sys.path and change directory into source folder.
        saved_cwd = os.getcwd()
        saved_sys_path = sys.path[:]
        os.chdir(source_folder)
        sys.path.insert(0, source_folder)
        try:
            exec (codeobj, namespace, namespace)
        finally:
            os.chdir(saved_cwd)
            sys.path = saved_sys_path

        args, kwargs = sys.modules['setuptools']._setup_params_
        # for k in sorted(kwargs.keys()): print('{}: {!r}'.format(k, kwargs[k]))

        if 'ext_modules' in kwargs:
            ext = kwargs['ext_modules']
            if (ext is not None) and (len(ext) > 0):
                print('WARNING: Extension modules are skipped: {}'.format(ext))

        packages = kwargs['packages'] if 'packages' in kwargs else []
        py_modules = kwargs['py_modules'] if 'py_modules' in kwargs else []

        if not packages and not py_modules:
            raise PipError('failed to find packages or py_modules arguments in setup call')

        package_dirs = kwargs.get('package_dir', {})
        use_2to3 = kwargs.get('use_2to3', False) and six.PY3

        files_installed = []

        # handle scripts
        # we handle them before the packages because they may be moved
        # while handling the packages
        scripts = kwargs.get("scripts", [])
        for script in scripts:
            if self.verbose:
                print("Handling commandline script: {s}".format(s=script))
            cmdname = script.replace(os.path.dirname(script), "").replace("/", "")
            if '.' not in cmdname:
                cmdname += ".py"
            scriptpath = os.path.join(source_folder, script)
            with open(scriptpath, "r") as fin:
                content = fin.read()
            cmdpath = create_command(cmdname, content)
            files_installed.append(cmdpath)

        packages = ArchiveFileInstaller._consolidated_packages(packages)
        for p in sorted(packages):  # folders or files under source root

            if p == '':  # no packages just files
                from_folder = os.path.join(source_folder, package_dirs.get(p, ''))
                for f in ArchiveFileInstaller._find_package_files(from_folder):
                    target_file = os.path.join(self.site_packages, f)
                    ArchiveFileInstaller._safe_move(os.path.join(from_folder, f), target_file)
                    files_installed.append(target_file)
                    if use_2to3:
                        _stash('2to3 -w {} > /dev/null'.format(target_file))

            else:  # packages
                target_dir = os.path.join(self.site_packages, p)
                if p in package_dirs:
                    ArchiveFileInstaller._safe_move(os.path.join(source_folder, package_dirs[p]), target_dir)

                elif '' in package_dirs:
                    ArchiveFileInstaller._safe_move(os.path.join(source_folder, package_dirs[''], p), target_dir)

                else:
                    ArchiveFileInstaller._safe_move(os.path.join(source_folder, p), target_dir)
                files_installed.append(target_dir)
                if use_2to3:
                    _stash("""find {} --name '.py' | xargs -n 1 -I %% 2to3 -w %% > /dev/null""".format(target_dir))

        py_modules = ArchiveFileInstaller._consolidated_packages(py_modules)
        for p in sorted(py_modules):  # files or folders where the file resides, e.g. ['file', 'folder.file']

            if '' in package_dirs:
                p = os.path.join(package_dirs[''], p)

            if os.path.isdir(os.path.join(source_folder, p)):  # folder
                target_dir = os.path.join(self.site_packages, p)
                ArchiveFileInstaller._safe_move(os.path.join(source_folder, p), target_dir)
                files_installed.append(target_dir)
                if use_2to3:
                    _stash("""find {} --name '.py' | xargs -n 1 -I %% 2to3 -w %% > /dev/null""".format(target_dir))

            else:  # file
                target_file = os.path.join(self.site_packages, p + '.py')
                ArchiveFileInstaller._safe_move(os.path.join(source_folder, p + '.py'), target_file)
                files_installed.append(target_file)
                if use_2to3:
                    _stash('2to3 -w {} > /dev/null'.format(target_file))

        # handle entry points
        entry_points = kwargs.get("entry_points", {})
        if isinstance(entry_points, (six.binary_type, six.text_type)):
            if pkg_resources is not None:
                entry_points = {s: c for s, c in pkg_resources.split_sections(entry_points)}
            else:
                print("Warning: pkg_resources not available, skipping entry_points definitions.")
                entry_points = {}
        for epn in entry_points:
            if self.verbose:
                print("Handling entrypoints for: " + epn)
            ep = entry_points[epn]
            if isinstance(ep, (six.binary_type, six.text_type)):
                ep = [ep]
            if epn == "console_scripts":
                for dec in ep:
                    name, loc = dec.replace(" ", "").split("=")
                    modname, funcname = loc.split(":")
                    if not name.endswith(".py"):
                        name += ".py"
                    desc = kwargs.get("description", "")
                    path = create_command(
                        name,
                        (
                            u"""'''%s'''
from %s import %s

if __name__ == "__main__":
    %s()
""" % (desc,
                    modname,
                    funcname,
                    funcname)
                        ).encode("utf-8")
                    )
                    files_installed.append(path)
            else:
                print("Warning: passing entry points for '{n}'.".format(n=epn))

        # Recursively Handle dependencies
        dependencies = kwargs.get('install_requires', [])
        if isinstance(dependencies, (six.text_type, six.binary_type)):
            # must be split into lines
            dependencies = dependencies.splitlines()
        # add extra dependencies
        extra_req = kwargs.get("extras_require", [])
        for en in extra_req:
            if en in extras:
                dependencies += list(extra_req.get(en, []))
        return files_installed, dependencies

        Transform and Run AST of the setup file
        :param filename: file to run
        :type filename: str
        :param extras: extras to install
        :type extras: list of str
        :return: tuple of (files installed, dependencies)
        :rtype: tuple of (list of str, list of str)
        
bin/pip.py