gotta save those 2.9 seconds

This commit is contained in:
bleck9999 2021-10-16 11:43:14 +01:00
parent e96ea63479
commit e87301e160
No known key found for this signature in database
GPG Key ID: D0CA0C41DB616843
2 changed files with 5 additions and 3 deletions

View File

@ -113,9 +113,9 @@ $(BUILDDIR)/$(TARGET)/script/builtin.c: scripts/*.te
@mkdir -p "$(@D)"
@mkdir -p "$(BUILDDIR)/$(TARGET)/scripts"
ifeq ($(OS),Windows_NT)
@py ts-minifier.py -d "$(BUILDDIR)/$(TARGET)/scripts" $(wildcard scripts/*.te)
@py ts-minifier.py --such-meme -d "$(BUILDDIR)/$(TARGET)/scripts" $(wildcard scripts/*.te)
@py te2c.py "$(BUILDDIR)/$(TARGET)/script/builtin" "$(BUILDDIR)/$(TARGET)/scripts"
else
@python3 ts-minifier.py -d "$(BUILDDIR)/$(TARGET)/scripts" $(wildcard scripts/*.te)
@python3 ts-minifier.py --such-meme -d "$(BUILDDIR)/$(TARGET)/scripts" $(wildcard scripts/*.te)
@python3 te2c.py "$(BUILDDIR)/$(TARGET)/script/builtin" "$(BUILDDIR)/$(TARGET)/scripts"
endif

View File

@ -427,6 +427,8 @@ if __name__ == '__main__':
"and attempt to generate shorter names for reused variables \ndefault: false")
argparser.add_argument("-v", action="store_true", default=False,
help="prints even more information to the console than usual")
argparser.add_argument("--such-meme", action="store_true", default=False,
help="replaces destination file if it already exists \ndefault: false")
args = argparser.parse_args()
files = args.source
@ -448,7 +450,7 @@ if __name__ == '__main__':
logging.info("Stripping whitespace (pass 2)")
r = whitespacent(r)
file = path.splitext(path.basename(file))[0]
if path.exists(path.join(dest, f"{file}.te")):
if path.exists(path.join(dest, f"{file}.te")) and not args.such_meme:
f = open(path.join(dest, f"{file}_min.te"), 'w')
else:
f = open(path.join(dest, f"{file}.te"), 'w')