added get_list
This commit is contained in:
11
snek
11
snek
@ -4,6 +4,7 @@ import argparse
|
||||
import json
|
||||
import shutil
|
||||
import subprocess
|
||||
from collections import defaultdict
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
|
||||
@ -114,6 +115,16 @@ class Conda:
|
||||
subprocess.run(cmd)
|
||||
|
||||
|
||||
def get_list(self, env):
|
||||
cmd = [self.exe, "list", "--json", "--name", env]
|
||||
pkgs = run_and_parse(cmd)
|
||||
res = defaultdict(list)
|
||||
for p in pkgs:
|
||||
for k in ("name", "version", "build_string", "build_number", "channel"):
|
||||
res[k].append(p[k])
|
||||
return dict(res)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user