upe.query — Get info about the installed packages

upe.query.pkgin(*pkglist)

Check if all the packages in pkglist are installed:

>>> import upe
>>> upe.query('foo', 'bar')
False
>>> upe.install('foo') # Install foo
>>> upe.query('foo', 'bar')
False
>>> upe.install('bar') # Install bar
>>> upe.query('foo', 'bar')
True

Hint

This is useful for dependency checking.

upe.query.getver(pkg)

Get the currently installed version of pkg.

upe.query.checkneeded(pkg[, ignore=[]])

Check if a packge is needed for any other installed package (this may take some time with many packages installed). Any package on ignore won’t be checked. By default, ignore is an empty list. Will return the following:

# If package x needs pkg:
(True, ('x',))
# If packages x and y require pkg:
(True, ('x', 'y'))
# Else:
(False,)

Tip

This is used on upe.pkgmgmt.remove() to check if a package can be safely uninstalled. Ignore is used if other packages will be uninstalled too.

Previous topic

upe.pkgmgmt — Install, remove and update packages

Next topic

upe.repo.main — Connect and create repositories