Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

Makefile 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. VENV = venv
  2. PYTEST = $(PWD)/$(VENV)/bin/py.test
  3. # These targets are not files
  4. .PHONY: build_sandbox clean compile_translations coverage css docs extract_translations help install install-python \
  5. install-test install-js lint release retest sandbox_clean sandbox_image sandbox test todo venv
  6. help: ## Display this help message
  7. @echo "Please use \`make <target>\` where <target> is one of"
  8. @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; \
  9. {printf "\033[36m%-40s\033[0m %s\n", $$1, $$2}'
  10. ##################
  11. # Install commands
  12. ##################
  13. install: install-python install-test install-js ## Install requirements for local development and production
  14. install-python: ## Install python requirements
  15. pip install -r requirements.txt
  16. install-test: ## Install test requirements
  17. pip install -e .[test]
  18. install-migrations-testing-requirements: ## Install migrations testing requirements
  19. pip install -r requirements_migrations.txt
  20. install-js: ## Install js requirements
  21. npm install
  22. venv: ## Create a virtual env and install test and production requirements
  23. virtualenv --python=$(shell which python3) $(VENV)
  24. $(VENV)/bin/pip install -e .[test]
  25. $(VENV)/bin/pip install -r docs/requirements.txt
  26. #############################
  27. # Sandbox management commands
  28. #############################
  29. sandbox: install build_sandbox ## Install requirements and create a sandbox
  30. build_sandbox: sandbox_clean sandbox_load_user sandbox_load_data ## Creates a sandbox from scratch
  31. sandbox_clean: ## Clean sandbox images,cache,static and database
  32. # Remove media
  33. -rm -rf sandbox/public/media/images
  34. -rm -rf sandbox/public/media/cache
  35. -rm -rf sandbox/public/static
  36. -rm -f sandbox/db.sqlite
  37. # Create database
  38. sandbox/manage.py migrate
  39. sandbox_load_user: ## Load user data into sandbox
  40. sandbox/manage.py loaddata sandbox/fixtures/auth.json
  41. sandbox_load_data: ## Import fixtures and collect static
  42. # Import some fixtures. Order is important as JSON fixtures include primary keys
  43. sandbox/manage.py loaddata sandbox/fixtures/child_products.json
  44. sandbox/manage.py oscar_import_catalogue sandbox/fixtures/*.csv
  45. sandbox/manage.py oscar_import_catalogue_images sandbox/fixtures/images.tar.gz
  46. sandbox/manage.py oscar_populate_countries --initial-only
  47. sandbox/manage.py loaddata sandbox/fixtures/pages.json sandbox/fixtures/ranges.json sandbox/fixtures/offers.json
  48. sandbox/manage.py loaddata sandbox/fixtures/orders.json sandbox/fixtures/promotions.json
  49. sandbox/manage.py clear_index --noinput
  50. sandbox/manage.py update_index catalogue
  51. sandbox/manage.py thumbnail cleanup
  52. sandbox/manage.py collectstatic --noinput
  53. sandbox_image: ## Build latest docker image of django-oscar-sandbox
  54. docker build -t django-oscar-sandbox:latest .
  55. ##################
  56. # Tests and checks
  57. ##################
  58. test: venv ## Run tests
  59. $(PYTEST)
  60. retest: venv ## Run failed tests only
  61. $(PYTEST) --lf
  62. coverage: venv ## Generate coverage report
  63. $(PYTEST) --cov=oscar --cov-report=term-missing
  64. lint: ## Run flake8 and isort checks
  65. flake8 src/oscar/
  66. flake8 tests/
  67. isort -q --recursive --diff src/
  68. isort -q --recursive --diff tests/
  69. test_migrations: install-migrations-testing-requirements ## Tests migrations
  70. cd sandbox && ./test_migrations.sh
  71. #######################
  72. # Translations Handling
  73. #######################
  74. extract_translations: ## Extract strings and create source .po files
  75. cd src/oscar; django-admin.py makemessages -a
  76. compile_translations: ## Compile translation files and create .mo files
  77. cd src/oscar; django-admin.py compilemessages
  78. ######################
  79. # Project Management
  80. ######################
  81. css: install-js ## Compile css files
  82. npm run build
  83. clean: ## Remove files not in source control
  84. find . -type f -name "*.pyc" -delete
  85. rm -rf nosetests.xml coverage.xml htmlcov *.egg-info *.pdf dist violations.txt
  86. docs: venv ## Compile docs
  87. make -C docs html SPHINXBUILD=$(PWD)/$(VENV)/bin/sphinx-build
  88. todo: ## Look for areas of the code that need updating when some event has taken place (like Oscar dropping support for a Django version)
  89. -grep -rnH TODO *.txt
  90. -grep -rnH TODO src/oscar/apps/
  91. -grep -rnH "django.VERSION" src/oscar/apps
  92. release: clean ## Creates release
  93. pip install twine wheel
  94. rm -rf dist/*
  95. python setup.py sdist bdist_wheel
  96. twine upload -s dist/*