equinor / komodo

Komodo is a software distribution system used internally in Equinor
GNU Affero General Public License v3.0
5 stars 22 forks source link

Optional kmd argument --cache has no proper default #282

Closed kwinkunks closed 1 year ago

kwinkunks commented 1 year ago

When building & installing an env, pip is called twice on packages that use it. The first time, --cache defaults to ., which seems reasonable (though a bit messy, possibly creating a ./pip_cache would be better?). It defaults to . because of: https://github.com/equinor/komodo/blob/main/komodo/build.py#L330

However, the second time pip runs (without the --root option), the --cache and --find-links options use args.cache directly (see https://github.com/equinor/komodo/blob/main/komodo/cli.py#L150-L151). If nothing was passed in for this argument, then you end up with None, resulting in pip failing with (for basic treelib example):

WARNING: Location 'None' is ignored: it is either a non-existing path or lacks a specific scheme.
ERROR: Could not find a version that satisfies the requirement treelib==1.6.1 (from versions: none)
ERROR: No matching distribution found for treelib==1.6.1

Workaround: pass a location for the cache, e.g. --cache .

Proposed solution: set a default for the argument at parse time (i.e. in cli.py do this: parser.add_argument("--cache", "-c", default=".")) and remove the buried conditional at https://github.com/equinor/komodo/blob/main/komodo/build.py#L330.

kwinkunks commented 1 year ago

On further reflection I think . is not the best default and something like pip-cache would be better. Using the CWD could result in a lot of temp stuff showing up.

kwinkunks commented 1 year ago

I have a fix ready to go for this, will wait for the README change to be merged because this will update it.

kwinkunks commented 1 year ago

Resolved by 80d99efeed95f0ffe37ba08448a4896c8df93dde