-
Notifications
You must be signed in to change notification settings - Fork 5
/
.prepare_project.sh
34 lines (29 loc) · 1.11 KB
/
.prepare_project.sh
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
28
29
30
31
32
33
34
#!/usr/bin/env bash
echo "Checking pip version"
MINIMUM_PIP_VERSION=22
pipversion=( $(pip --version | awk '{print $2}' | sed 's/\./ /g') )
if let "${pipversion[0]}<${MINIMUM_PIP_VERSION}"; then
echo "Insufficient version of pip found. Requires at least version ${MINIMUM_PIP_VERSION}."
echo "See https://lincc-ppt.readthedocs.io/ for details."
exit 1
fi
echo "Initializing local git repository"
{
gitversion=( $(git version | git version | awk '{print $3}' | sed 's/\./ /g') )
if let "${gitversion[0]}<2"; then
# manipulate directly
git init . && echo 'ref: refs/heads/main' >.git/HEAD
elif let "${gitversion[0]}==2 & ${gitversion[1]}<34"; then
# rename master to main
git init . && { git branch -m master main 2>/dev/null || true; };
else
# set the initial branch name to main
git init --initial-branch=main >/dev/null
fi
} > /dev/null
echo "Installing package and runtime dependencies in local environment"
pip install -e . > /dev/null
echo "Installing developer dependencies in local environment"
pip install -e .'[dev]' > /dev/null
echo "Installing pre-commit"
pre-commit install > /dev/null