0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-02 09:46:52 -05:00

lint: convert submodule linter test to Python

This commit is contained in:
Eunoia 2022-04-07 20:20:22 +00:00 committed by GitHub
parent 254f3cc368
commit 4a9e36dbaf
2 changed files with 23 additions and 20 deletions

23
test/lint/lint-submodule.py Executable file
View file

@ -0,0 +1,23 @@
#!/usr/bin/env python3
#
# Copyright (c) 2022 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
This script checks for git modules
"""
import subprocess
import sys
def main():
submodules_list = subprocess.check_output(['git', 'submodule', 'status', '--recursive'],
universal_newlines = True, encoding = 'utf8').rstrip('\n')
if submodules_list:
print("These submodules were found, delete them:\n", submodules_list)
sys.exit(1)
sys.exit(0)
if __name__ == '__main__':
main()

View file

@ -1,20 +0,0 @@
#!/usr/bin/env bash
#
# Copyright (c) 2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# This script checks for git modules
export LC_ALL=C
EXIT_CODE=0
CMD=$(git submodule status --recursive)
if test -n "$CMD";
then
echo These submodules were found, delete them:
echo "$CMD"
EXIT_CODE=1
fi
exit $EXIT_CODE