def install_package(self, pkg_name, deps=True, installer="easy_install", pypi_index_url=None, debug=False, verbose=False, dev=True): """ Install a package in the given virtualenv. """ get_log().info('Installing package [%s]' % pkg_name) # would like to install with --no-deps, but we want to know about 3rd # party package versions. cmd = [os.path.join(self.bindir, installer)] if dev and installer == 'pyinstall': # use 'dev' mode for pyinstall to pick up latest dev versions if # they're available (easy_install uses dev versions anyway) cmd.append('--dev') if debug: cmd.append('-v') if pypi_index_url: cmd.extend(['-i', util.maybe_add_simple_index(pypi_index_url)]) if not deps: cmd.append('--no-deps') cmd.append(pkg_name) self.run_python_cmd(cmd, capture_stdout=not verbose)
def setup_package(self, pkg_dir, test=True, deps=True, build=True, pypi_index_url=None, prefer_final=False, debug=False, verbose=False): """ Setup a package in this python installation using `python setup.py develop`. Parameters ---------- pkg_dir : `str` package checkout dir options : `optparse.Options` command-line options test : `bool` True/False will install test packages """ self.log.info("Setting up package in: %s" % pkg_dir) cmd = ['setup.py'] if debug: cmd.append('-v') cmd.append('develop') if pypi_index_url: cmd.extend(['-i', util.maybe_add_simple_index(pypi_index_url)]) if not test: cmd.append('--no-test') if not deps: cmd.append('--no-deps') if not build: cmd.append('--no-build') if prefer_final: cmd.append('--prefer-final') return self.run_python_cmd(cmd, capture_stdout=not verbose, capture_stderr=not verbose, cwd=pkg_dir)