# HG changeset patch # User RhodeCode Admin # Date 2023-03-06 11:55:11 # Node ID 6fb7c99d387360005b1351b066ac553f4332c780 # Parent 933cfceff30ec2d04882be6b88e4bc5c6e87eb79 makefile: remove nix stuff, added self-document version diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile @@ -1,72 +1,134 @@ -.PHONY: clean docs docs-clean docs-cleanup test test-clean test-only test-only-postgres test-only-mysql web-build generate-pkgs pip-packages build-nix +# set by: PATH_TO_OUTDATED_PACKAGES=/some/path/outdated_packages.py +OUTDATED_PACKAGES = ${PATH_TO_OUTDATED_PACKAGES} NODE_PATH=./node_modules WEBPACK=./node_binaries/webpack GRUNT=./node_binaries/grunt -# set by: PATH_TO_OUTDATED_PACKAGES=/some/path/outdated_packages.py -OUTDATED_PACKAGES = ${PATH_TO_OUTDATED_PACKAGES} +.PHONY: clean +## Cleanup compiled and cache py files clean: make test-clean find . -type f \( -iname '*.c' -o -iname '*.pyc' -o -iname '*.so' -o -iname '*.orig' \) -exec rm '{}' ';' + +.PHONY: test +## run test-clean and tests test: make test-clean make test-only + +.PHONY:test-clean +## run test-clean and tests test-clean: rm -rf coverage.xml htmlcov junit.xml pylint.log result find . -type d -name "__pycache__" -prune -exec rm -rf '{}' ';' find . -type f \( -iname '.coverage.*' \) -exec rm '{}' ';' + +.PHONY: test-only +## Run tests only without cleanup test-only: PYTHONHASHSEED=random \ - py.test -x -vv -r xw -p no:sugar --cov=rhodecode \ - --cov-report=term-missing --cov-report=html \ - rhodecode + py.test -x -vv -r xw -p no:sugar \ + --cov-report=term-missing --cov-report=html \ + --cov=rhodecode rhodecode +.PHONY: test-only-mysql +## run tests against mysql test-only-mysql: PYTHONHASHSEED=random \ - py.test -x -vv -r xw -p no:sugar --cov=rhodecode \ - --cov-report=term-missing --cov-report=html \ + py.test -x -vv -r xw -p no:sugar \ + --cov-report=term-missing --cov-report=html \ --ini-config-override='{"app:main": {"sqlalchemy.db1.url": "mysql://root:qweqwe@localhost/rhodecode_test?charset=utf8"}}' \ - rhodecode + --cov=rhodecode rhodecode + +.PHONY: test-only-postgres +## run tests against postgres test-only-postgres: PYTHONHASHSEED=random \ - py.test -x -vv -r xw -p no:sugar --cov=rhodecode \ - --cov-report=term-missing --cov-report=html \ + py.test -x -vv -r xw -p no:sugar \ + --cov-report=term-missing --cov-report=html \ --ini-config-override='{"app:main": {"sqlalchemy.db1.url": "postgresql://postgres:qweqwe@localhost/rhodecode_test"}}' \ - rhodecode + --cov=rhodecode rhodecode - +.PHONY: docs +## build docs docs: (cd docs; nix-build default.nix -o result; make clean html) + +.PHONY: docs-clean +## Cleanup docs docs-clean: (cd docs; make clean) + +.PHONY: docs-cleanup +## Cleanup docs docs-cleanup: (cd docs; make cleanup) + +.PHONY: web-build +## Build JS packages static/js web-build: NODE_PATH=$(NODE_PATH) $(GRUNT) -generate-pkgs: - nix-shell pkgs/shell-generate.nix --command "pip2nix generate --licenses --no-binary :all:" +.PHONY: pip-packages +## show outdated packages pip-packages: python ${OUTDATED_PACKAGES} -generate-js-pkgs: - rm -rf node_modules && \ - nix-shell pkgs/shell-generate.nix --command "node2nix --input package.json -o pkgs/node-packages.nix -e pkgs/node-env.nix -c pkgs/node-default.nix -d --flatten --nodejs-12" && \ - sed -i -e 's/http:\/\//https:\/\//g' pkgs/node-packages.nix + +.PHONY: sdist +## Build sdist +sdist: + python setup.py sdist + + +# Default command on calling make +.DEFAULT_GOAL := show-help -generate-license-meta: - nix-build pkgs/license-generate.nix -o result-license && \ - cat result-license/licenses.json | python -m json.tool > rhodecode/config/licenses.json - -build-nix: - nix-build --show-trace --option sandbox false --option max-jobs 4 --option cores 4 +.PHONY: show-help +show-help: + @echo "$$(tput bold)Available rules:$$(tput sgr0)" + @echo + @sed -n -e "/^## / { \ + h; \ + s/.*//; \ + :doc" \ + -e "H; \ + n; \ + s/^## //; \ + t doc" \ + -e "s/:.*//; \ + G; \ + s/\\n## /---/; \ + s/\\n/ /g; \ + p; \ + }" ${MAKEFILE_LIST} \ + | LC_ALL='C' sort --ignore-case \ + | awk -F '---' \ + -v ncol=$$(tput cols) \ + -v indent=19 \ + -v col_on="$$(tput setaf 6)" \ + -v col_off="$$(tput sgr0)" \ + '{ \ + printf "%s%*s%s ", col_on, -indent, $$1, col_off; \ + n = split($$2, words, " "); \ + line_length = ncol - indent; \ + for (i = 1; i <= n; i++) { \ + line_length -= length(words[i]) + 1; \ + if (line_length <= 0) { \ + line_length = ncol - indent - length(words[i]) - 1; \ + printf "\n%*s ", -indent, " "; \ + } \ + printf "%s ", words[i]; \ + } \ + printf "\n"; \ + }'