forked from tenpy/tenpy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cleanup.sh
executable file
·53 lines (42 loc) · 1.28 KB
/
cleanup.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
#!/bin/bash
echo "Clean up all the compiled/autogenerated stuff in the tenpy repository, and possibly more."
read -p "Are you sure? Type 'y' to confirm: " -n 1
echo
if [ "$REPLY" != "y" ]; then
echo "Abort"
exit 1
fi
echo "The following files and folders got removed"
rm_dir() {
test -d "$1" && echo "$1/" && rm -r "$1"
}
rm_files() {
for file in "$@"
do
test -f "$file" && echo "$file" && rm "$file"
done
}
# clean up *all* the auto-generated stuff, i.e. compiled code, generated documentation, python cached files, test data...
# remove compiled stuff
rm_files tenpy/linalg/{*.c,*.cpp,*.so,*.html}
rm_dir "build"
rm_dir "dist"
rm_dir "physics_tenpy.egg-info"
# remove egg files
rm_dir ".eggs"
rm_dir ".pytest_cache"
rm_dir "tests/.pytest_cache"
# hard-coded version generated by setup.py
rm_files tenpy/_version.py
# clean-up generated documentation
rm_dir "doc/examples"
rm_dir "doc/toycodes"
rm_dir "doc/reference"
rm_dir "doc/sphinx_build"
# clean-up data generated by tests
rm_dir "tests/export_import_test/data"
# clean-up benchmark results
rm_files tests/benchmark/{*.txt,*.png}
# remove python cached files. They might give problems if you modified some files and the date of the file wasn't updated.
find . -name "*.pyc" -delete
find . -name "__pycache__" -print -delete