Skip to content
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

Fixed indentation in env.txt header #592

Merged
merged 1 commit into from
Dec 13, 2022
Merged

Fixed indentation in env.txt header #592

merged 1 commit into from
Dec 13, 2022

Conversation

AndrewVallette
Copy link
Contributor

Description

The header for the env.txt file that is generated in write_env_txt() contains leading whitespace that libmamba is not able to parse. This causes it to use a blank string for a matchspec, resulting in the following critical error:

critical libmamba Invalid spec, no package name found:

This issue occurs because lstrip() is called on a multi-line f-string before dedent(), which causes leading whitespace to only be removed up to the beginning of the first non-blank line. Calling dedent() before lstrip() will ensure all leading whitespace is stripped out for all lines.

Without this fix, the header in write_env_txt() is written out as:

# This file may be used to create an environment using:
        # $ conda create --name <env> --file <this file>
        # platform: osx-arm64
        @EXPLICIT

After the fix, the header is written out without leading whitespace:

# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: osx-arm64
@EXPLICIT

@AndrewVallette AndrewVallette requested a review from a team as a code owner December 13, 2022 00:57
@conda-bot
Copy link
Contributor

We require contributors to sign our Contributor License Agreement and we don't have one on file for @AndrewVallette.

In order for us to review and merge your code, please e-sign the Contributor License Agreement PDF. We then need to manually verify your signature. We will ping the bot to refresh the PR status when we have confirmed your signature.

@dbast
Copy link
Member

dbast commented Dec 13, 2022

@conda-bot check

@conda-bot conda-bot added the cla-signed [bot] added once the contributor has signed the CLA label Dec 13, 2022
@dbast
Copy link
Member

dbast commented Dec 13, 2022

Tested this and it indeed fixes the bug as described... Merging without news entry as this bug was not present in the last release.

@dbast dbast merged commit 7307290 into conda:main Dec 13, 2022
@jaimergp
Copy link
Contributor

Thanks!

I usually add the PR number to the news item that introduced the feature being fixed. In this case, the file is https://github.com/conda/constructor/blob/main/news/559-explicit-install, and I'd add it to the item in Enhancements.

Could you please address this in a new PR? Thanks!

dbast added a commit to dbast/constructor that referenced this pull request Dec 13, 2022
@dbast dbast mentioned this pull request Dec 13, 2022
3 tasks
dbast added a commit that referenced this pull request Dec 13, 2022
@AndrewVallette AndrewVallette deleted the fix_env_txt_header_indentation branch December 13, 2022 15:43
@github-actions github-actions bot added the locked [bot] locked due to inactivity label Dec 14, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed [bot] added once the contributor has signed the CLA locked [bot] locked due to inactivity
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants