[buildcore] Replace gmake < file with pybb cat
This commit is contained in:
parent
6bd21bf1b4
commit
b27d6671fc
2
deps/buildcore/base.mk
vendored
2
deps/buildcore/base.mk
vendored
@ -48,7 +48,7 @@ ifneq ($(shell which docker 2> /dev/null),)
|
|||||||
ENV_RUN=docker exec -i -t --user $(shell id -u ${USER}) ${DEVENV}
|
ENV_RUN=docker exec -i -t --user $(shell id -u ${USER}) ${DEVENV}
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
CURRENT_BUILD=$(HOST_ENV)-$(file < .current_build)
|
CURRENT_BUILD=$(HOST_ENV)-$(shell ${PYBB} cat .current_build)
|
||||||
|
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
build:
|
build:
|
||||||
|
19
deps/buildcore/scripts/pybb.py
vendored
19
deps/buildcore/scripts/pybb.py
vendored
@ -17,10 +17,22 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def cat(path):
|
||||||
|
try:
|
||||||
|
with open(path) as f:
|
||||||
|
data = f.read()
|
||||||
|
print(data)
|
||||||
|
return 0
|
||||||
|
except FileNotFoundError:
|
||||||
|
sys.stderr.write('cat: {}: no such file or directory\n'.format(path))
|
||||||
|
return 1
|
||||||
|
|
||||||
|
|
||||||
def mkdir(path):
|
def mkdir(path):
|
||||||
if not os.path.exists(path) and os.path.isdir(path):
|
if not os.path.exists(path) and os.path.isdir(path):
|
||||||
os.mkdir(path)
|
os.mkdir(path)
|
||||||
|
|
||||||
|
|
||||||
# this exists because Windows is utterly incapable of providing a proper rm -rf
|
# this exists because Windows is utterly incapable of providing a proper rm -rf
|
||||||
def rm(path):
|
def rm(path):
|
||||||
if (os.path.exists(path) or os.path.islink(path)) and not os.path.isdir(path):
|
if (os.path.exists(path) or os.path.islink(path)) and not os.path.isdir(path):
|
||||||
@ -28,6 +40,7 @@ def rm(path):
|
|||||||
elif os.path.isdir(path):
|
elif os.path.isdir(path):
|
||||||
shutil.rmtree(path)
|
shutil.rmtree(path)
|
||||||
|
|
||||||
|
|
||||||
def cmake_build(base_path, target):
|
def cmake_build(base_path, target):
|
||||||
if not os.path.isdir(base_path):
|
if not os.path.isdir(base_path):
|
||||||
# nothing to build
|
# nothing to build
|
||||||
@ -40,6 +53,7 @@ def cmake_build(base_path, target):
|
|||||||
if err != 0:
|
if err != 0:
|
||||||
return err
|
return err
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
if sys.argv[1] == 'mkdir':
|
if sys.argv[1] == 'mkdir':
|
||||||
mkdir(sys.argv[2])
|
mkdir(sys.argv[2])
|
||||||
@ -49,10 +63,13 @@ def main():
|
|||||||
elif sys.argv[1] == 'cmake-build':
|
elif sys.argv[1] == 'cmake-build':
|
||||||
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)
|
||||||
sys.exit(err)
|
sys.exit(err)
|
||||||
|
elif sys.argv[1] == 'cat':
|
||||||
|
err = cat(sys.argv[2])
|
||||||
|
sys.exit(err)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
try:
|
try:
|
||||||
main()
|
main()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user