mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
Add script for removing Apache header.
* Can be used to remove the license header added with add_apache_header.sh
This commit is contained in:
15
scripts/apache_python.txt
Normal file
15
scripts/apache_python.txt
Normal file
@ -0,0 +1,15 @@
|
||||
# Copyright (c) 2016-present, Facebook, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
##############################################################################
|
||||
|
13
scripts/remove_apache_header.sh
Executable file
13
scripts/remove_apache_header.sh
Executable file
@ -0,0 +1,13 @@
|
||||
if [[ "$1" == *.py ]]; then
|
||||
apache_header="apache_python.txt"
|
||||
else
|
||||
apache_header="apache_header.txt"
|
||||
fi
|
||||
apache_lines=$(wc -l < "${apache_header}")
|
||||
apache_md5=$(cat "${apache_header}" | md5)
|
||||
header_md5=$(head -n ${apache_lines} $1 | md5)
|
||||
if [ "${header_md5}" == "${apache_md5}" ]; then
|
||||
keep_lines=$(($(wc -l < $1) - ${apache_lines}))
|
||||
tail -n ${keep_lines} $1 > _remove_apache_header.txt
|
||||
mv _remove_apache_header.txt $1
|
||||
fi
|
13
scripts/temp.sh
Normal file → Executable file
13
scripts/temp.sh
Normal file → Executable file
@ -1,6 +1,7 @@
|
||||
find ../caffe2 -name "*.h" -exec ./add_apache_header.sh {} \;
|
||||
find ../caffe2 -name "*.cc" -exec ./add_apache_header.sh {} \;
|
||||
find ../caffe2 -name "*.cpp" -exec ./add_apache_header.sh {} \;
|
||||
find ../caffe2 -name "*.cu" -exec ./add_apache_header.sh {} \;
|
||||
find ../caffe2 -name "*.mm" -exec ./add_apache_header.sh {} \;
|
||||
find ../caffe2 -name "*.m" -exec ./add_apache_header.sh {} \;
|
||||
find ../caffe2 -name "*.py" -exec ./remove_apache_header.sh {} \;
|
||||
find ../caffe2 -name "*.h" -exec ./remove_apache_header.sh {} \;
|
||||
find ../caffe2 -name "*.cc" -exec ./remove_apache_header.sh {} \;
|
||||
find ../caffe2 -name "*.cpp" -exec ./remove_apache_header.sh {} \;
|
||||
find ../caffe2 -name "*.cu" -exec ./remove_apache_header.sh {} \;
|
||||
find ../caffe2 -name "*.mm" -exec ./remove_apache_header.sh {} \;
|
||||
find ../caffe2 -name "*.m" -exec ./remove_apache_header.sh {} \;
|
||||
|
Reference in New Issue
Block a user