Fix temporary code for install in api, add doc.
This commit is contained in:
+19
-4
@@ -259,7 +259,25 @@ def search_file(term):
|
||||
term = term[1:]
|
||||
return filesdb.search_file(term)
|
||||
|
||||
# ****** Danger Zone Below! Tressspassers eyes will be explode! ********** #
|
||||
|
||||
def install(packages, reinstall=False, ignore_file_conflicts=False):
|
||||
"""
|
||||
Returns True if no errors occured during the operation
|
||||
@param packages: list of package names -> list_of_strings
|
||||
@param reinstall: reinstalls already installed packages else ignores
|
||||
@param ignore_file_conflicts: Ignores file conflicts during the installation and continues to install
|
||||
packages.
|
||||
"""
|
||||
if not ctx.get_option('ignore_file_conflicts'):
|
||||
ctx.set_option('ignore_file_conflicts', ignore_file_conflicts)
|
||||
|
||||
# Install pisi package files or pisi packages from a repository
|
||||
if packages and packages[0].endswith(ctx.const.package_suffix):
|
||||
return pisi.operations.install.install_pkg_files(packages)
|
||||
else:
|
||||
return pisi.operations.install.install_pkg_names(packages, reinstall)
|
||||
|
||||
# ****** Danger Zone Below! Tressspassers' eyes will explode! ********** #
|
||||
|
||||
def package_graph(A, packagedb, ignore_installed = False):
|
||||
"""Construct a package relations graph.
|
||||
@@ -548,9 +566,6 @@ def rebuild_db(files=False):
|
||||
# from pisi.build import build_until
|
||||
# from pisi.atomicoperations import resurrect_package, build
|
||||
|
||||
def install(*args, **kw):
|
||||
return pisi.operations.install.install(*args, **kw)
|
||||
|
||||
def remove(*args, **kw):
|
||||
return pisi.operations.remove.remove(*args, **kw)
|
||||
|
||||
|
||||
@@ -26,18 +26,6 @@ import pisi.dependency as dependency
|
||||
import pisi.ui as ui
|
||||
import pisi.db
|
||||
|
||||
def install(packages, reinstall = False, ignore_file_conflicts=False):
|
||||
"""install a list of packages (either files/urls, or names)"""
|
||||
|
||||
if not ctx.get_option('ignore_file_conflicts'):
|
||||
ctx.set_option('ignore_file_conflicts', ignore_file_conflicts)
|
||||
|
||||
# determine if this is a list of files/urls or names
|
||||
if packages and packages[0].endswith(ctx.const.package_suffix): # they all have to!
|
||||
return install_pkg_files(packages)
|
||||
else:
|
||||
return install_pkg_names(packages, reinstall)
|
||||
|
||||
def install_pkg_names(A, reinstall = False):
|
||||
"""This is the real thing. It installs packages from
|
||||
the repository, trying to perform a minimum number of
|
||||
@@ -60,7 +48,7 @@ def install_pkg_names(A, reinstall = False):
|
||||
|
||||
if len(A)==0:
|
||||
ctx.ui.info(_('No packages to install.'))
|
||||
return
|
||||
return True
|
||||
|
||||
A |= operations.upgrade.upgrade_base(A)
|
||||
|
||||
@@ -85,7 +73,7 @@ def install_pkg_names(A, reinstall = False):
|
||||
ctx.ui.info(_('Total size of package(s): %.2f %s') % (total_size, symbol))
|
||||
|
||||
if ctx.get_option('dry_run'):
|
||||
return
|
||||
return True
|
||||
|
||||
if set(order) - A_0:
|
||||
if not ctx.ui.confirm(_('There are extra packages due to dependencies. Do you want to continue?')):
|
||||
@@ -96,6 +84,8 @@ def install_pkg_names(A, reinstall = False):
|
||||
for x in order:
|
||||
atomicoperations.install_single_name(x, True) # allow reinstalls here
|
||||
|
||||
return True
|
||||
|
||||
def install_pkg_files(package_URIs):
|
||||
"""install a number of pisi package files"""
|
||||
|
||||
@@ -109,7 +99,7 @@ def install_pkg_files(package_URIs):
|
||||
# simple code path then
|
||||
for x in package_URIs:
|
||||
atomicoperations.install_single_file(x)
|
||||
return # short circuit
|
||||
return True
|
||||
|
||||
# read the package information into memory first
|
||||
# regardless of which distribution they come from
|
||||
@@ -195,13 +185,15 @@ in the respective order to satisfy extra dependencies:
|
||||
ctx.ui.info(_('Installation order: ') + util.strlist(order) )
|
||||
|
||||
if ctx.get_option('dry_run'):
|
||||
return
|
||||
return True
|
||||
|
||||
ctx.ui.notify(ui.packagestogo, order = order)
|
||||
|
||||
for x in order:
|
||||
atomicoperations.install_single_file(dfn[x])
|
||||
|
||||
return True
|
||||
|
||||
def plan_install_pkg_names(A, ignore_package_conflicts = False):
|
||||
# try to construct a pisi graph of packages to
|
||||
# install / reinstall
|
||||
|
||||
Reference in New Issue
Block a user