build: Update makefile testjs to open the browser

This commit is contained in:
Alexis Métaireau 2023-12-16 13:15:03 +01:00
parent 813b283a29
commit 396cbd34b4
2 changed files with 16 additions and 2 deletions

View file

@ -1,5 +1,7 @@
.DEFAULT_GOAL := help
JS_TEST_URL := http://localhost:8001/umap/static/umap/test/index.html
.PHONY: install
install: ## Install the dependencies
python3 -m pip install --upgrade pip
@ -74,7 +76,19 @@ vendors:
installjs:
npm install
testjs: node_modules
@echo "See the tests at http://localhost:8001/umap/static/umap/test/" && python -m http.server 8001
@{ \
trap 'kill $$PID; exit' INT; \
python -m http.server 8001 & \
PID=$$!; \
sleep 1; \
echo "Opening $(JS_TEST_URL)"; \
if command -v python -m webbrowser > /dev/null 2>&1; then \
python -m webbrowser "$(JS_TEST_URL)"; \
else \
echo "Please open $(JS_TEST_URL) in your web browser"; \
fi; \
wait $$PID; \
}
tx_push:
tx push -s
tx_pull:

View file

@ -16,7 +16,7 @@ from .managers import PublicManager
# Did not find a clean way to do this in Django
# - creating a Proxy model would mean replacing get_user_model by this proxy model
# in every template
# - extending User model woulc mean a non trivial migration
# - extending User model would mean a non trivial migration
def display_name(self):
return settings.USER_DISPLAY_NAME.format(**self.__dict__)