Skip to content

Commit 51cd808

Browse files
add dev script for cleaning maturin build artifacts
1 parent 5e048b0 commit 51cd808

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

dev/clean.sh

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one
4+
# or more contributor license agreements. See the NOTICE file
5+
# distributed with this work for additional information
6+
# regarding copyright ownership. The ASF licenses this file
7+
# to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance
9+
# with the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing,
14+
# software distributed under the License is distributed on an
15+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
# KIND, either express or implied. See the License for the
17+
# specific language governing permissions and limitations
18+
# under the License.
19+
#
20+
21+
# This cleans up the project by removing build artifacts and other generated files.
22+
23+
# Function to remove a directory and print the action
24+
remove_dir() {
25+
if [ -d "$1" ]; then
26+
echo "Removing directory: $1"
27+
rm -rf "$1"
28+
fi
29+
}
30+
31+
# Function to remove a file and print the action
32+
remove_file() {
33+
if [ -f "$1" ]; then
34+
echo "Removing file: $1"
35+
rm -f "$1"
36+
fi
37+
}
38+
39+
# Remove .pytest_cache directory
40+
remove_dir .pytest_cache/
41+
42+
# Remove target directory
43+
remove_dir target/
44+
45+
# Remove any __pycache__ directories
46+
find python/ -type d -name "__pycache__" -print | while read -r dir; do
47+
remove_dir "$dir"
48+
done
49+
50+
# Remove pytest-coverage.lcov file
51+
# remove_file .coverage
52+
# remove_file pytest-coverage.lcov
53+
54+
# Remove rust-coverage.lcov file
55+
# remove_file rust-coverage.lcov
56+
57+
# Remove pyo3 files
58+
find python/ -type f -name '_internal.*.so' -print | while read -r file; do
59+
remove_file "$file"
60+
done
61+
62+
echo "Cleanup complete."

0 commit comments

Comments
 (0)