Repository with sources and generator of https://larlet.fr/david/ https://larlet.fr/david/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Makefile 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. .DEFAULT_GOAL := help
  2. RED=\033[0;31m
  3. GREEN=\033[0;32m
  4. ORANGE=\033[0;33m
  5. BLUE=\033[0;34m
  6. NC=\033[0m # No Color
  7. .PHONY: install
  8. install: ## Install the dependencies
  9. @echo "${GREEN}🤖 Installing dependencies${NC}"
  10. python3 -m pip install --upgrade pip
  11. python3 -m pip install --editable .
  12. .PHONY: dev
  13. dev: install ## Install the development dependencies
  14. python3 -m pip install --editable ".[dev]"
  15. .PHONY: deps
  16. deps: ## Generate dependencies from pyproject.toml
  17. @echo "${GREEN}🤖 Updating requirements${NC}"
  18. python3 -m piptools compile --upgrade --quiet --resolver=backtracking --output-file=requirements.txt pyproject.toml
  19. python3 -m piptools compile --upgrade --quiet --resolver=backtracking --extra=dev --output-file=requirements-dev.txt pyproject.toml
  20. .PHONY: lint
  21. lint: ## Ensure code consistency
  22. @echo "${GREEN}🤖 Linting code${NC}"
  23. @ruff site.py --fix
  24. @black . --quiet
  25. @djlint david/templates/article_2020.html \
  26. david/templates/base_2020.html \
  27. david/templates/blogroll.html \
  28. david/templates/profil.html \
  29. david/templates/recherche.html \
  30. david/templates/tag_2021.html \
  31. --reformat --quiet --format-js --format-css
  32. .PHONY: build
  33. build: ## Generate the site
  34. @python site.py pages tags feed home
  35. .PHONY: publish
  36. publish: ## Make heavy actions
  37. @python site.py search blogroll
  38. .PHONY: blogroll
  39. blogroll: ## Generate the blogroll
  40. @python site.py blogroll
  41. .PHONY: live
  42. live: ## Rebuild contents on file change.
  43. @echo "${ORANGE}⚠️ You need http://eradman.com/entrproject/${NC}"
  44. ls david/2024/_sources/* | entr -r make build
  45. .PHONY: toot
  46. toot: ## Pre-write the Mastodon message.
  47. @python site.py toot
  48. .PHONY: help
  49. help:
  50. @python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
  51. # See https://daniel.feldroy.com/posts/autodocumenting-makefiles
  52. define PRINT_HELP_PYSCRIPT # start of Python section
  53. import re, sys
  54. output = []
  55. # Loop through the lines in this file
  56. for line in sys.stdin:
  57. # if the line has a command and a comment start with
  58. # two pound signs, add it to the output
  59. match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
  60. if match:
  61. target, help = match.groups()
  62. output.append("\033[36m%-10s\033[0m %s" % (target, help))
  63. # Sort the output in alphanumeric order
  64. output.sort()
  65. # Print the help result
  66. print('\n'.join(output))
  67. endef
  68. export PRINT_HELP_PYSCRIPT # End of python section