conda / conda/constructor

Supplement pre-install and post-install scripts with a shared-install script.

Open
#1,061 0 comments 0 reactions 0 assignees View on GitHub
type::feature
Dominant language
Python
Stars
497
Forks
181
Avg merge
1d 16h
Merged PRs (30d)
17

Description

### Checklist

- [x] I added a descriptive title
- [x] I searched open requests and couldn't find a duplicate

### What is the idea?

When writing robust pre and post install scripts, often functions and checks are copied into each files. For anything robust and full featured, this makes the scripts harder to maintain. It would be great to have a _shared-script_ key that could be sourced by the pre and post install scripts.

Note: this cannot be done in _extra-files_, because those are added too late for the pre-script execution (postconda_tarball).

### Why is this needed?

Any installer with pre-install checks could benefit from moving the bash implementation into a `functions.sh` script that is sourced. This would improve readability and maintainability, but it would really shine when a post-install script can share the bash commands.

### What should happen?

A user could refactor their pre and post-install scripts to use a common functions.sh file - construct.yaml:
```
name: test
version: 1
channels:
- defaults

pre-install: my-pre.sh
post-install: my-post.sh
shared-script: functions.sh
```

my-pre.sh
```
source ./functions.sh

doStuff1
doStuff2
...
```

### Additional Context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.