File size: 629 Bytes
7475f0d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from conda import plugins


def pre_command_patcher(command):
    try:
        from . import patch  # noqa

        patch.main(plugin=True, command=command)
    except Exception as exc:  # pragma: nocover
        print("Error loading anaconda-anon-usage:", exc)


class AlwaysContains:
    def __contains__(self, item):
        return True


@plugins.hookimpl
def conda_pre_commands():
    yield plugins.CondaPreCommand(
        name="anaconda-anon-usage",
        action=pre_command_patcher,
        # This ensures the plugin is run no matter what
        # conda command is being called
        run_for=AlwaysContains(),
    )