_example_ update
This commit is contained in:
parent
877c434ccb
commit
d6551e1ff2
@ -1,20 +1,30 @@
|
|||||||
EXAMPLES = $(wildcard *.py)
|
# pylibs examples Makefile: Version 1.0 (2025-08-15)
|
||||||
FIRSTLOGS = ${EXAMPLES:.py=_1.log}
|
|
||||||
LASTLOGS = ${EXAMPLES:.py=_2.log}
|
.ONESHELL:
|
||||||
|
SHELL = /usr/bin/bash
|
||||||
|
MAKEFLAGS += --no-print-directory
|
||||||
|
.SILENT:
|
||||||
|
|
||||||
|
INTERPRETER = python3
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
.SECONDAY: $(FIRSTLOGS)
|
EXAMPLES := $(wildcard *.py)
|
||||||
|
EXAMPLES := $(filter-out config.py, $(EXAMPLES))
|
||||||
|
LOGFILES := ${EXAMPLES:.py=.log}
|
||||||
|
|
||||||
all: $(LASTLOGS)
|
all: $(LOGFILES)
|
||||||
|
|
||||||
%_1.log: %.py
|
-include __make.d__/*.mk
|
||||||
rm -f *.json *.pickle
|
|
||||||
python3 $< > $@
|
|
||||||
|
|
||||||
%_2.log: %.py %_1.log
|
%.py_local:
|
||||||
python3 $< > $@
|
|
||||||
rm -f *.json *.pickle
|
%.log: %.py
|
||||||
|
$(MAKE) $<_local
|
||||||
|
echo -e "\e[1m * Running example $<\e[0m"
|
||||||
|
$(INTERPRETER) $< > $@
|
||||||
|
|
||||||
|
localclean:
|
||||||
|
clean: localclean
|
||||||
|
echo -e "\e[1m * Example logs...\e[0m"
|
||||||
|
rm -f $(LOGFILES)
|
||||||
|
|
||||||
clean:
|
|
||||||
@echo "\e[1m * Example logs...\e[0m"
|
|
||||||
@rm -f $(FIRSTLOGS) $(LASTLOGS) *.json *.pickle
|
|
||||||
|
9
_examples_/__make.d__/clean.mk
Normal file
9
_examples_/__make.d__/clean.mk
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
.ONESHELL:
|
||||||
|
SHELL = /usr/bin/bash
|
||||||
|
MAKEFLAGS += --no-print-directory
|
||||||
|
.SILENT:
|
||||||
|
|
||||||
|
localclean:
|
||||||
|
echo -e "\e[1m * Example cache files...\e[0m"
|
||||||
|
rm -f cache.json cache.pickle
|
||||||
|
|
@ -1 +0,0 @@
|
|||||||
..
|
|
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python
|
import sys # nopep8
|
||||||
# -*- coding: UTF-8 -*-
|
sys.path.append('../..') # nopep8
|
||||||
|
|
||||||
import caching
|
import caching
|
||||||
import logging
|
import logging
|
||||||
@ -55,6 +55,7 @@ class test_slow_data(object):
|
|||||||
self.print_n_sleep("__five__")
|
self.print_n_sleep("__five__")
|
||||||
return 'five'
|
return 'five'
|
||||||
|
|
||||||
|
|
||||||
class test_slow_data_cached(test_slow_data):
|
class test_slow_data_cached(test_slow_data):
|
||||||
def __init__(self, *args, **kwargs) -> None:
|
def __init__(self, *args, **kwargs) -> None:
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
@ -79,4 +80,3 @@ if __name__ == "__main__":
|
|||||||
for key in data.keys():
|
for key in data.keys():
|
||||||
print(data.get(key))
|
print(data.get(key))
|
||||||
print('--------------------------------\nThe execution time was %.1fs' % (time.time()-tm))
|
print('--------------------------------\nThe execution time was %.1fs' % (time.time()-tm))
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python
|
import sys # nopep8
|
||||||
# -*- coding: UTF-8 -*-
|
sys.path.append('../..') # nopep8
|
||||||
|
|
||||||
import caching
|
import caching
|
||||||
import logging
|
import logging
|
||||||
@ -55,6 +55,7 @@ class test_slow_data(object):
|
|||||||
self.print_n_sleep("__five__")
|
self.print_n_sleep("__five__")
|
||||||
return 'five'
|
return 'five'
|
||||||
|
|
||||||
|
|
||||||
class test_slow_data_cached(test_slow_data):
|
class test_slow_data_cached(test_slow_data):
|
||||||
def __init__(self, *args, **kwargs) -> None:
|
def __init__(self, *args, **kwargs) -> None:
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user