-
Notifications
You must be signed in to change notification settings - Fork 289
/
clean.sh
executable file
·61 lines (48 loc) · 1.23 KB
/
clean.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env bash
# Clean the project directory.
set -e
cd "$(dirname "$0")/.."
# Script Arguments
for i in ${@}; do
case ${i} in
--all)
deep_clean=true
;;
*)
echo "Unknown argument: $i"
exit 1
;;
esac
done
echo "==> Removing Python build artifacts..."
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +
rm -rf build/
rm -rf dist/
rm -rf .eggs/
echo "==> Removing test and coverage artifacts..."
rm -rf .cache/
rm -f .coverage
rm -rf .tox/
rm -rf htmlcov/
echo "==> Cleaning docs directories..."
rm -rf docs/_build/*
if [[ $deep_clean == true ]]; then
echo "==> Deep cleaning..."
if [ -f "Pipfile" ] && [ -n "$(pipenv --version 2>/dev/null)" ]; then
echo "==> Removing pipenv environment..."
pipenv --rm || true
fi
if [ -d ".venv" ]; then
echo "==> Removing project virtual environment '.venv'..."
rm -rf .venv/
fi
if [ -d "venv" ]; then
echo "==> Removing project virtual environment 'venv'..."
rm -rf venv/
fi
fi