[nostalgia] Add pybb tool to help with cross platform compatibility
This commit is contained in:
parent
f272555a25
commit
cad2f078a0
7
Makefile
7
Makefile
@ -3,15 +3,14 @@ ifeq (${OS},Windows_NT)
|
|||||||
.SHELLFLAGS := -NoProfile -Command
|
.SHELLFLAGS := -NoProfile -Command
|
||||||
OS=windows
|
OS=windows
|
||||||
HOST_ENV=${OS}
|
HOST_ENV=${OS}
|
||||||
RM_RF=Remove-Item -ErrorAction Ignore -Recurse -Path
|
|
||||||
else
|
else
|
||||||
OS=$(shell uname | tr [:upper:] [:lower:])
|
OS=$(shell uname | tr [:upper:] [:lower:])
|
||||||
HOST_ENV=${OS}-$(shell uname -m)
|
HOST_ENV=${OS}-$(shell uname -m)
|
||||||
RM_RF=rm -rf
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
DEVENV=devenv$(shell pwd | sed 's/\//-/g')
|
DEVENV=devenv$(shell pwd | sed 's/\//-/g')
|
||||||
DEVENV_IMAGE=nostalgia-devenv
|
DEVENV_IMAGE=nostalgia-devenv
|
||||||
|
RM_RF=python3 scripts/pybb rm
|
||||||
ifndef VCPKG_DIR_BASE
|
ifndef VCPKG_DIR_BASE
|
||||||
VCPKG_DIR_BASE=.vcpkg
|
VCPKG_DIR_BASE=.vcpkg
|
||||||
endif
|
endif
|
||||||
@ -47,7 +46,9 @@ clean:
|
|||||||
$(foreach file, $(wildcard build/*), ${ENV_RUN} cmake --build $(file) --target clean;)
|
$(foreach file, $(wildcard build/*), ${ENV_RUN} cmake --build $(file) --target clean;)
|
||||||
.PHONY: purge
|
.PHONY: purge
|
||||||
purge:
|
purge:
|
||||||
${ENV_RUN} ${RM_RF} build .current_build dist
|
${ENV_RUN} ${RM_RF} .current_build
|
||||||
|
${ENV_RUN} ${RM_RF} build
|
||||||
|
${ENV_RUN} ${RM_RF} dist
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test: build
|
test: build
|
||||||
$(foreach file, $(wildcard build/*), ${ENV_RUN} cmake --build $(file) --target test;)
|
$(foreach file, $(wildcard build/*), ${ENV_RUN} cmake --build $(file) --target test;)
|
||||||
|
18
scripts/pybb
Normal file
18
scripts/pybb
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#! /usr/bin/env python3
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
def mkdir(path):
|
||||||
|
if not os.path.exists(path) and os.path.isdir(path):
|
||||||
|
os.mkdir(path)
|
||||||
|
|
||||||
|
def rm(path):
|
||||||
|
if os.path.exists(path) or os.path.islink(path):
|
||||||
|
os.remove(path)
|
||||||
|
|
||||||
|
if sys.argv[1] == 'mkdir':
|
||||||
|
mkdir(sys.argv[2])
|
||||||
|
elif sys.argv[1] == 'rm':
|
||||||
|
for i in range(2, len(sys.argv)):
|
||||||
|
rm(sys.argv[i])
|
Loading…
Reference in New Issue
Block a user