Makefile 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. ########################################################
  2. # Makefile for OpenShift: Atomic Quick Installer
  3. #
  4. # useful targets (not all implemented yet!):
  5. # make clean -- Clean up garbage
  6. # make ci ------------------- Execute CI steps (for travis or jenkins)
  7. ########################################################
  8. # > VARIABLE = value
  9. #
  10. # Normal setting of a variable - values within it are recursively
  11. # expanded when the variable is USED, not when it's declared.
  12. #
  13. # > VARIABLE := value
  14. #
  15. # Setting of a variable with simple expansion of the values inside -
  16. # values within it are expanded at DECLARATION time.
  17. ########################################################
  18. NAME := oo-install
  19. TESTPACKAGE := oo-install
  20. SHORTNAME := ooinstall
  21. # This doesn't evaluate until it's called. The -D argument is the
  22. # directory of the target file ($@), kinda like `dirname`.
  23. ASCII2MAN = a2x -D $(dir $@) -d manpage -f manpage $<
  24. MANPAGES := docs/man/man1/atomic-openshift-installer.1
  25. VERSION := 1.3
  26. sdist: clean
  27. python setup.py sdist
  28. rm -fR $(SHORTNAME).egg-info
  29. clean:
  30. @find . -type f -regex ".*\.py[co]$$" -delete
  31. @find . -type f \( -name "*~" -or -name "#*" \) -delete
  32. @rm -fR build dist rpm-build MANIFEST htmlcov .coverage cover ooinstall.egg-info oo-install
  33. @rm -fR $(NAME)env
  34. # To force a rebuild of the docs run 'touch' on any *.in file under
  35. # docs/man/man1/
  36. docs: $(MANPAGES)
  37. # Regenerate %.1.asciidoc if %.1.asciidoc.in has been modified more
  38. # recently than %.1.asciidoc.
  39. %.1.asciidoc: %.1.asciidoc.in
  40. sed "s/%VERSION%/$(VERSION)/" $< > $@
  41. # Regenerate %.1 if %.1.asciidoc or VERSION has been modified more
  42. # recently than %.1. (Implicitly runs the %.1.asciidoc recipe)
  43. %.1: %.1.asciidoc
  44. $(ASCII2MAN)
  45. viewcover:
  46. xdg-open cover/index.html
  47. # Conditional virtualenv building strategy taken from this great post
  48. # by Marcel Hellkamp:
  49. # http://blog.bottlepy.org/2012/07/16/virtualenv-and-makefiles.html
  50. venv: oo-installenv/bin/activate
  51. oo-installenv/bin/activate: test-requirements.txt
  52. @echo "#############################################"
  53. @echo "# Creating a virtualenv"
  54. @echo "#############################################"
  55. test -d venv || virtualenv $(NAME)env
  56. . $(NAME)env/bin/activate && pip install setuptools==17.1.1
  57. . $(NAME)env/bin/activate && pip install -r test-requirements.txt
  58. touch $(NAME)env/bin/activate
  59. # If there are any special things to install do it here
  60. # . $(NAME)env/bin/activate && INSTALL STUFF
  61. ci-unittests:
  62. @echo "#############################################"
  63. @echo "# Running Unit Tests in virtualenv"
  64. @echo "#############################################"
  65. . $(NAME)env/bin/activate && python setup.py nosetests
  66. @echo "VIEW CODE COVERAGE REPORT WITH 'xdg-open cover/index.html' or run 'make viewcover'"
  67. ci-pylint:
  68. @echo "#############################################"
  69. @echo "# Running PyLint Tests in virtualenv"
  70. @echo "#############################################"
  71. . $(NAME)env/bin/activate && python -m pylint --rcfile ../git/.pylintrc $(shell find ../ -name $(NAME)env -prune -o -name test -prune -o -name "*.py" -print) 2>&1 | grep -E -v '(locally-disabled|file-ignored)'
  72. ci-list-deps:
  73. @echo "#############################################"
  74. @echo "# Listing all pip deps"
  75. @echo "#############################################"
  76. . $(NAME)env/bin/activate && pip freeze
  77. ci-flake8:
  78. @echo "#############################################"
  79. @echo "# Running Flake8 Compliance Tests in virtualenv"
  80. @echo "#############################################"
  81. . $(NAME)env/bin/activate && flake8 --config=setup.cfg ../ --exclude="utils,../inventory"
  82. . $(NAME)env/bin/activate && python setup.py flake8
  83. ci: venv ci-list-deps ci-unittests ci-flake8 ci-pylint
  84. @echo
  85. @echo "##################################################################################"
  86. @echo "VIEW CODE COVERAGE REPORT WITH 'xdg-open cover/index.html' or run 'make viewcover'"
  87. @echo "To clean your test environment run 'make clean'"
  88. @echo "Other targets you may run with 'make': 'ci-pylint', 'ci-unittests', 'ci-flake8'"