Skip to content

activate.ps1 references non-existing variable #173

@stinos

Description

@stinos

Solution to issue cannot be found in the documentation.

  • I checked the documentation.

Issue

https://github.com/conda-forge/libxml2-feedstock/blob/main/recipe/activate.ps1 contains

$conda_catalog_files += "file:///" + $Env:CONDA_PREFIX.replace(" ", "%20").replace("\", "/") + "/etc/xml/catalog"

which will fail with PS strict mode turned on because the variable $conda_catalog_files does not exist:

InvalidOperation: activate.ps1:9
Line |
   9 |  $conda_catalog_files += "file:///" + $Env:CONDA_PREFIX.replace(" ", " …
     |  ~~~~~~~~~~~~~~~~~~~~
     | The variable '$conda_catalog_files' cannot be retrieved because it has not been set.

Strict mode is not uncommon so would be good to fix this by guarding $conda_catalog_files.

However I'm not sure if this variable is actually needed: what is the intent of this code? Where does it expect the $conda_catalog_files variable to come from such that it needs appending to? In d945143 the + was added but that was maybe not actually intended. So I'm wondering if all that is needed here is just to remove that line and use this instead

$Env:XML_CATALOG_FILES += "file:///" + $Env:CONDA_PREFIX.replace(" ", "%20").replace("\", "/") + "/etc/xml/catalog"

Also note that because of replacing spaces with %20 this actually changes from a valid file path to something URL-like, but that's probably wanted?

Installed packages

Not relevant, this concerns libxml2 only.

Environment info

platform : win-64
             user-agent : conda/4.12.0 requests/2.32.3 CPython/3.9.18 Windows/10 Windows/10.0.19045
          administrator : False
             netrc file : None
           offline mode : False

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions