Skip to content
Snippets Groups Projects
Commit d4ee2151 authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

ENH: query_installed_packages can also consider externally hosted packages

parent 8f081cbf
Branches master
No related tags found
1 merge request!45New update_fsl_package script
......@@ -246,10 +246,13 @@ class Package:
@ft.lru_cache
def query_installed_packages() -> Dict[str, Package]:
def query_installed_packages(include_external : bool) -> Dict[str, Package]:
"""Uses conda to find out the versions of all packages installed in
$FSLDIR, which are sourced from the FSL conda channels.
If "include_external" is True, externally hosted packages that are listed
in EXTERNALLY_HOSTED_PACKAGES are also queried.
Returns a dict of {pkgname : Package} mappings. The "dependencies"
attributes of the package objects are not populated.
"""
......@@ -270,8 +273,11 @@ def query_installed_packages() -> Dict[str, Package]:
# or those listed in the externally
# hosted package list.
for pkg in info:
if pkg['base_url'].rstrip() in channels or \
pkg['name'] in EXTERNALLY_HOSTED_PACKAGES:
internal = pkg['base_url'].rstrip() in channels
external = pkg['name'] in EXTERNALLY_HOSTED_PACKAGES
if internal or (external and include_external):
pkgs[pkg['name']] = Package(pkg['name'],
pkg['version'],
pkg['channel'],
......@@ -565,7 +571,7 @@ def main(argv : Sequence[str] = None):
# Download information about all
# available packages on the FSL
# conda channels.
print('Downloading FSL conda channel information ...')
print('Downloading FSL conda channel metadata ...')
channeldata = [download_channel_metadata(PUBLIC_FSL_CHANNEL)]
if args.internal:
channeldata.insert(0, download_channel_metadata(
......@@ -574,8 +580,10 @@ def main(argv : Sequence[str] = None):
password=args.password))
print('Building FSL package list ...')
if args.all: packages = list(query_installed_packages().keys())
else: packages = args.package
if args.all:
packages = list(query_installed_packages(args.external).keys())
else:
packages = args.package
# Identify the versions that are
# available for the packages the
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment