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

[bug] conan.tools.env.EnvVars can't be initialized with scope=None #17249

Closed
bkarasm opened this issue Oct 30, 2024 · 3 comments
Closed

[bug] conan.tools.env.EnvVars can't be initialized with scope=None #17249

bkarasm opened this issue Oct 30, 2024 · 3 comments
Assignees
Labels
Milestone

Comments

@bkarasm
Copy link
Contributor

bkarasm commented Oct 30, 2024

Describe the bug

When trying to use EnvVars class with scope=None as described in the docs I get an error

AttributeError: 'NoneType' object has no attribute 'startswith'

which is thrown by the deduce_subsystem() function from conans/client/subsystems.py.

Below is a code snippet from my conanfile.py. I'm trying to set GIT_LFS_SKIP_SMUDGE environment variable to skip LFS files when cloning git repo:

    def source(self):
        git = Git(self)
        env = Environment()
        env.define("GIT_LFS_SKIP_SMUDGE", "1")  # skip LFS files
        with env.vars(self, scope=None).apply():
            git.fetch_commit(...)

How to reproduce it

No response

@franramirez688
Copy link
Contributor

Hi @bkarasm - Thanks for reporting this!

This issue should be solved in the current latest release 2.9.1.

Closing the issue as solved, but do not hesitate to reopen it if any other problem arises.

@bkarasm
Copy link
Contributor Author

bkarasm commented Nov 5, 2024

Hi @franramirez688, I was hoping that if I use scope=None in the source() method Conan won't default to build context. I'll create a separate issue to seek for assistance for the case I described.

@franramirez688
Copy link
Contributor

Hi @bkarasm

It's not defaulting to build context, it's only supposing that the deduce_subsystem() function (and only for Windows) should use the build machine to deduce the subsystem if required. The rest is not using the build context at all.
Other changes are coming up to improve this flow because it's a bit confusing 😞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants