def _install(self, args):
        '''
        Install a package from a repo
        '''
        if len(args) < 2:
            raise SPMInvocationError('A package must be specified')

        packages = args[1:]
        file_map = {}
        optional = []
        recommended = []
        to_install = []
        for pkg in packages:
            if pkg.endswith('.spm'):
                if self._pkgfiles_fun('path_exists', pkg):
                    comps = pkg.split('-')
                    comps = '-'.join(comps[:-2]).split('/')
                    pkg_name = comps[-1]

                    formula_tar = tarfile.open(pkg, 'r:bz2')
                    formula_ref = formula_tar.extractfile('{0}/FORMULA'.format(pkg_name))
                    formula_def = yaml.safe_load(formula_ref)

                    file_map[pkg_name] = pkg
                    to_, op_, re_ = self._check_all_deps(
                        pkg_name=pkg_name,
                        pkg_file=pkg,
                        formula_def=formula_def
                    )
                    to_install.extend(to_)
                    optional.extend(op_)
                    recommended.extend(re_)
                else:
                    raise SPMInvocationError('Package file {0} not found'.format(pkg))
            else:
                to_, op_, re_ = self._check_all_deps(pkg_name=pkg)
                to_install.extend(to_)
                optional.extend(op_)
                recommended.extend(re_)

        optional = set(filter(len, optional))
        self.ui.status('The following dependencies are optional:\n\t{0}\n'.format(
            '\n\t'.join(optional)
        ))
        recommended = set(filter(len, recommended))
        self.ui.status('The following dependencies are recommended:\n\t{0}\n'.format(
            '\n\t'.join(recommended)
        ))

        to_install = set(filter(len, to_install))
        msg = 'Installing packages:\n\t{0}\n'.format('\n\t'.join(to_install))
        if not self.opts['assume_yes']:
            self.ui.confirm(msg)

        repo_metadata = self._get_repo_metadata()

        for package in to_install:
            if file_map in package:
                self._install_indv_pkg(package, file_map[package])
            else:
                for repo in repo_metadata:
                    repo_info = repo_metadata[repo]
                    if package in repo_metadata[repo]['packages']:
                        cache_path = '{0}/{1}'.format(
                            self.opts['spm_cache_dir'],
                            repo
                        )
                        # Download the package
                        dl_path = '{0}/{1}'.format(
                            repo_info['info']['url'],
                            repo_info['packages'][package]['filename']
                        )
                        out_file = '{0}/{1}'.format(
                            cache_path,
                            repo_info['packages'][package]['filename']
                        )
                        if not os.path.exists(cache_path):
                            os.makedirs(cache_path)

                        if dl_path.startswith('file://'):
                            dl_path = dl_path.replace('file://', '')
                            shutil.copyfile(dl_path, out_file)
                        else:
                            http.query(dl_path, text_out=out_file)

                        # Kick off the install
                        self._install_indv_pkg(package, out_file)
        return
dataset/ETHPy150Open saltstack/salt/salt/spm/__init__.py/SPMClient._install/swapped operands of `in`