Makefile 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. PEPEXCLUDES := E501,E121,E124
  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 $(NAME)env
  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. virtualenv:
  49. @echo "#############################################"
  50. @echo "# Creating a virtualenv"
  51. @echo "#############################################"
  52. virtualenv $(NAME)env
  53. . $(NAME)env/bin/activate && pip install setuptools==17.1.1
  54. . $(NAME)env/bin/activate && pip install -r test-requirements.txt
  55. # If there are any special things to install do it here
  56. # . $(NAME)env/bin/activate && INSTALL STUFF
  57. ci-unittests:
  58. @echo "#############################################"
  59. @echo "# Running Unit Tests in virtualenv"
  60. @echo "#############################################"
  61. . $(NAME)env/bin/activate && nosetests -v --with-coverage --cover-html --cover-min-percentage=70 --cover-package=$(SHORTNAME) test/
  62. @echo "VIEW CODE COVERAGE REPORT WITH 'xdg-open cover/index.html' or run 'make viewcover'"
  63. ci-pylint:
  64. @echo "#############################################"
  65. @echo "# Running PyLint Tests in virtualenv"
  66. @echo "#############################################"
  67. . $(NAME)env/bin/activate && python -m pylint --rcfile ../git/.pylintrc src/ooinstall/cli_installer.py src/ooinstall/oo_config.py src/ooinstall/openshift_ansible.py src/ooinstall/variants.py ../callback_plugins/openshift_quick_installer.py ../roles/openshift_certificate_expiry/library/openshift_cert_expiry.py
  68. ci-list-deps:
  69. @echo "#############################################"
  70. @echo "# Listing all pip deps"
  71. @echo "#############################################"
  72. . $(NAME)env/bin/activate && pip freeze
  73. ci-pyflakes:
  74. @echo "#################################################"
  75. @echo "# Running Pyflakes Compliance Tests in virtualenv"
  76. @echo "#################################################"
  77. . $(NAME)env/bin/activate && pyflakes src/ooinstall/*.py
  78. . $(NAME)env/bin/activate && pyflakes ../callback_plugins/openshift_quick_installer.py
  79. . $(NAME)env/bin/activate && pyflakes ../roles/openshift_certificate_expiry/library/openshift_cert_expiry.py
  80. ci-pep8:
  81. @echo "#############################################"
  82. @echo "# Running PEP8 Compliance Tests in virtualenv"
  83. @echo "#############################################"
  84. . $(NAME)env/bin/activate && pep8 --ignore=$(PEPEXCLUDES) src/$(SHORTNAME)/
  85. . $(NAME)env/bin/activate && pep8 --ignore=$(PEPEXCLUDES) ../callback_plugins/openshift_quick_installer.py
  86. # This one excludes E402 because it is an ansible module and the
  87. # boilerplate import statement is expected to be at the bottom
  88. . $(NAME)env/bin/activate && pep8 --ignore=$(PEPEXCLUDES),E402 ../roles/openshift_certificate_expiry/library/openshift_cert_expiry.py
  89. ci: clean virtualenv ci-list-deps ci-pep8 ci-pylint ci-pyflakes ci-unittests
  90. :