Skip to content

Added compatibility with micromamba #8531

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 24 additions & 9 deletions subworkflows/nf-core/utils_nextflow_pipeline/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,32 @@ def dumpParametersToJSON(outdir) {
def checkCondaChannels() {
def parser = new org.yaml.snakeyaml.Yaml()
def channels = []
try {
def config = parser.load("conda config --show channels".execute().text)
channels = config.channels
}
catch (NullPointerException e) {
log.debug(e)
log.warn("Could not verify conda channel configuration.")

// Helper function: execute shell command and parse channel output
def getChannels = { String cmd ->
try {
def process = cmd.execute()
process.waitForOrKill(10000) // 10s timeout
if (process.exitValue() == 0) {
return parser.load(process.text)?.channels
} else {
log.debug("Non-zero exit for command: $cmd")
}
} catch (Exception e) {
log.debug("Failed to execute '$cmd': ${e.message}")
}
return null
}
catch (IOException e) {
log.debug(e)

try {
channels = getChannels("conda config --show channels")
?: getChannels("micromamba config list channels")

if (!channels) {
throw new IllegalStateException("Both conda and micromamba commands failed or returned no channels")
}
}
catch (Exception e) {
log.warn("Could not verify conda channel configuration.")
return null
}
Expand Down