From fe38a154b93ffa7adef02878cc9a12d736f5fe72 Mon Sep 17 00:00:00 2001 From: Tim McCormack Date: Tue, 9 May 2023 22:19:44 +0000 Subject: [PATCH] fix: Use short version of BROWSER command in django-ida Makefile This matches the other Makefiles (and fixes the `docs` target) Also, add docs target to .PHONY. --- .../{{cookiecutter.repo_name}}/Makefile | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/cookiecutter-django-ida/{{cookiecutter.repo_name}}/Makefile b/cookiecutter-django-ida/{{cookiecutter.repo_name}}/Makefile index 53a3c7be..f6643e30 100644 --- a/cookiecutter-django-ida/{{cookiecutter.repo_name}}/Makefile +++ b/cookiecutter-django-ida/{{cookiecutter.repo_name}}/Makefile @@ -1,6 +1,6 @@ .DEFAULT_GOAL := help -.PHONY: help clean requirements ci_requirements dev_requirements \ +.PHONY: help clean docs requirements ci_requirements dev_requirements \ validation_requirements doc_requirements prod_requirements static shell \ test coverage isort_check isort style lint quality pii_check validate \ migrate html_coverage upgrade extract_translation dummy_translations \ @@ -9,17 +9,8 @@ detect_changed_source_translations validate_translations check_keywords \ install_transifex_client -define BROWSER_PYSCRIPT -import os, webbrowser, sys -try: - from urllib import pathname2url -except: - from urllib.request import pathname2url - -webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1]))) -endef -export BROWSER_PYSCRIPT -BROWSER := python -c "$$BROWSER_PYSCRIPT" +# For opening files in a browser. Use like: $(BROWSER)relative/path/to/file.html +BROWSER := python -m webbrowser file://$(CURDIR)/ # Generates a help message. Borrowed from https://github.com/pydanny/cookiecutter-djangopackage. help: ## display this help message @@ -68,7 +59,7 @@ test: clean ## run tests and generate coverage report # To be run from CI context coverage: clean pytest --cov-report html - $(BROWSER) htmlcov/index.html + $(BROWSER)htmlcov/index.html isort_check: ## check that isort has been run isort --check-only {{cookiecutter.project_name}}/