[buildcore] Cleanup pybb error handling and type annotations
This commit is contained in:
parent
fb5934975d
commit
a119f96a73
12
deps/buildcore/scripts/pybb.py
vendored
12
deps/buildcore/scripts/pybb.py
vendored
@ -8,7 +8,7 @@
|
|||||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
#
|
#
|
||||||
|
|
||||||
# "Python Busy Box" - adds cross platform equivalents to Unix commands that
|
# "Python Busy Box" - adds cross-platform equivalents to Unix commands that
|
||||||
# don't translate well to that other operating system
|
# don't translate well to that other operating system
|
||||||
|
|
||||||
import os
|
import os
|
||||||
@ -17,7 +17,7 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
def cat(paths: str) -> int:
|
def cat(paths: [str]) -> int:
|
||||||
for path in paths:
|
for path in paths:
|
||||||
try:
|
try:
|
||||||
with open(path) as f:
|
with open(path) as f:
|
||||||
@ -109,11 +109,15 @@ def main():
|
|||||||
err = cmake_build(sys.argv[2], sys.argv[3] if len(sys.argv) > 3 else None)
|
err = cmake_build(sys.argv[2], sys.argv[3] if len(sys.argv) > 3 else None)
|
||||||
elif sys.argv[1] == 'cat':
|
elif sys.argv[1] == 'cat':
|
||||||
err = cat(sys.argv[2:])
|
err = cat(sys.argv[2:])
|
||||||
sys.exit(err)
|
else:
|
||||||
|
sys.stderr.write('Command not found\n')
|
||||||
|
err = 1
|
||||||
|
return err
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
try:
|
try:
|
||||||
main()
|
err = main()
|
||||||
|
sys.exit(err)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user