Makefile 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. VENV := $(NAME)env
  20. TESTPACKAGE := oo-install
  21. SHORTNAME := ooinstall
  22. # This doesn't evaluate until it's called. The -D argument is the
  23. # directory of the target file ($@), kinda like `dirname`.
  24. ASCII2MAN = a2x -D $(dir $@) -d manpage -f manpage $<
  25. MANPAGES := docs/man/man1/atomic-openshift-installer.1
  26. VERSION := 1.3
  27. sdist: clean
  28. python setup.py sdist
  29. rm -fR $(SHORTNAME).egg-info
  30. clean:
  31. @find . -type f -regex ".*\.py[co]$$" -delete
  32. @find . -type f \( -name "*~" -or -name "#*" \) -delete
  33. @rm -fR build dist rpm-build MANIFEST htmlcov .coverage cover ooinstall.egg-info oo-install
  34. @rm -fR $(VENV)
  35. # To force a rebuild of the docs run 'touch' on any *.in file under
  36. # docs/man/man1/
  37. docs: $(MANPAGES)
  38. # Regenerate %.1.asciidoc if %.1.asciidoc.in has been modified more
  39. # recently than %.1.asciidoc.
  40. %.1.asciidoc: %.1.asciidoc.in
  41. sed "s/%VERSION%/$(VERSION)/" $< > $@
  42. # Regenerate %.1 if %.1.asciidoc or VERSION has been modified more
  43. # recently than %.1. (Implicitly runs the %.1.asciidoc recipe)
  44. %.1: %.1.asciidoc
  45. $(ASCII2MAN)
  46. viewcover:
  47. xdg-open cover/index.html
  48. # Conditional virtualenv building strategy taken from this great post
  49. # by Marcel Hellkamp:
  50. # http://blog.bottlepy.org/2012/07/16/virtualenv-and-makefiles.html
  51. $(VENV): $(VENV)/bin/activate
  52. $(VENV)/bin/activate: test-requirements.txt
  53. @echo "#############################################"
  54. @echo "# Creating a virtualenv"
  55. @echo "#############################################"
  56. test -d $(VENV) || virtualenv $(VENV)
  57. . $(VENV)/bin/activate && pip install setuptools==17.1.1
  58. . $(VENV)/bin/activate && pip install -r test-requirements.txt
  59. touch $(VENV)/bin/activate
  60. # If there are any special things to install do it here
  61. # . $(VENV)/bin/activate && INSTALL STUFF
  62. ci-unittests: $(VENV)
  63. @echo "#############################################"
  64. @echo "# Running Unit Tests in virtualenv"
  65. @echo "#############################################"
  66. . $(VENV)/bin/activate && python setup.py nosetests
  67. @echo "VIEW CODE COVERAGE REPORT WITH 'xdg-open cover/index.html' or run 'make viewcover'"
  68. ci-pylint: $(VENV)
  69. @echo "#############################################"
  70. @echo "# Running PyLint Tests in virtualenv"
  71. @echo "#############################################"
  72. . $(VENV)/bin/activate && python -m pylint --rcfile ../git/.pylintrc $(shell find ../ -name $(VENV) -prune -o -name ooinstall.egg-info -prune -o -name test -prune -o -name "*.py" -print)
  73. ci-list-deps: $(VENV)
  74. @echo "#############################################"
  75. @echo "# Listing all pip deps"
  76. @echo "#############################################"
  77. . $(VENV)/bin/activate && pip freeze
  78. ci-flake8: $(VENV)
  79. @echo "#############################################"
  80. @echo "# Running Flake8 Compliance Tests in virtualenv"
  81. @echo "#############################################"
  82. . $(VENV)/bin/activate && flake8 --config=setup.cfg ../ --exclude="utils,../inventory"
  83. . $(VENV)/bin/activate && python setup.py flake8
  84. ci: ci-list-deps ci-unittests ci-flake8 ci-pylint
  85. @echo
  86. @echo "##################################################################################"
  87. @echo "VIEW CODE COVERAGE REPORT WITH 'xdg-open cover/index.html' or run 'make viewcover'"
  88. @echo "To clean your test environment run 'make clean'"
  89. @echo "Other targets you may run with 'make': 'ci-pylint', 'ci-unittests', 'ci-flake8'"