def handle_(config, data): with Console(verbose=config.get("verbose", False), exit_on_error=True) as c: repo = init_repository(c, config["repository"]) pkg_mgr = PackageManager(repo, console=c, mirroring=data["mirror"], install_deps=not data["no_dependencies"]) if data["requirements"]: c.info("installing from requirements file...") for syntax in open(data["requirements"], "r").readlines(): c.info("installing {}".format(syntax)) pkg_mgr.install(syntax, data["type"], data["no_user"]) else: for syntax in data["packages"]: c.info("installing {}".format(syntax)) pkg_mgr.install(syntax, data["type"], data["no_user"])
def test_install_no_user(): repo = Repository() installer = Installer() pm = PackageManager(repo=repo, installer=installer, overwrite=False, console=Console(exit_on_error=False)) pkg = Package(name="test_package", version="1.0.0", type="SOURCE") filename = resource_filename(__name__, "data/test_package-1.0.0.zip") pm.upload(pkg, filename) #install pm.install("test_package==1.0.0", "SOURCE", no_user=False) assert check_if_installed(installer, "test_package-1.0.0")
def test_without_deps(): repo = Repository() installer = Installer() pm = PackageManager(repo=repo, installer=installer, overwrite=False, mirroring=True, install_deps=False, console=Console(exit_on_error=False)) pkg1 = Package(name="test_package", version="1.0.0", type="SOURCE") filename1 = resource_filename(__name__, "data/test_package-1.0.0.zip") pkg2 = Package(name="other_package", version="1.0.0", type="SOURCE") #depends on test_package filename2 = resource_filename(__name__, "data/other_package-1.0.0.tar.gz") pm.upload(pkg1, filename1) pm.upload(pkg2, filename2) pm.install("other_package==1.0.0", "SOURCE", no_user=False) assert check_if_installed(installer, "other_package-1.0.0")