├── doc-requirements.txt ├── doc ├── index.rst ├── changelog.rst ├── Makefile └── conf.py ├── .travis.yml ├── .gitignore ├── LICENSE ├── setup.py ├── README.rst ├── test.py └── gallows.py /doc-requirements.txt: -------------------------------------------------------------------------------- 1 | Sphinx>=1.1.2 2 | releases>=0.6.1 3 | -------------------------------------------------------------------------------- /doc/index.rst: -------------------------------------------------------------------------------- 1 | .. Gallows documentation master file, created by 2 | sphinx-quickstart on Fri Jan 23 02:27:47 2015. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to Gallows's documentation! 7 | =================================== 8 | 9 | .. include:: ../README.rst 10 | 11 | Contents 12 | -------- 13 | 14 | .. toctree:: 15 | 16 | changelog 17 | 18 | 19 | Indices and tables 20 | ================== 21 | 22 | * :ref:`genindex` 23 | * :ref:`modindex` 24 | * :ref:`search` 25 | 26 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | python: 3 | - "2.6" 4 | - "2.7" 5 | - "3.2" 6 | - "3.3" 7 | - "3.4" 8 | 9 | install: 10 | - pip install coverage 11 | - pip install python-coveralls 12 | 13 | script: coverage run --source=gallows.py setup.py test 14 | 15 | after_success: 16 | - coveralls 17 | 18 | deploy: 19 | provider: pypi 20 | user: vijaykumar 21 | password: 22 | secure: gSJMMPUd5+Trg4vhcKrbAjcryzreH5ie/vPuym8iuqVYn9jBUeOxBmZSvLH9aIskvG4Bf9gzu4dw7sLB1updh/RazcsVGzR0aO0kwZP5Y2IQTtnHH6R51ESIi6yW9N+T8hbYca34UOPPvo2xduN4vG1PCPmI2W4AQ/hhWAP95vE= 23 | on: 24 | tags: true 25 | all_branches: true -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | 5 | # C extensions 6 | *.so 7 | 8 | # Distribution / packaging 9 | .Python 10 | env/ 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | lib/ 17 | lib64/ 18 | parts/ 19 | sdist/ 20 | var/ 21 | *.egg-info/ 22 | .installed.cfg 23 | *.egg 24 | 25 | # PyInstaller 26 | # Usually these files are written by a python script from a template 27 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 28 | *.manifest 29 | *.spec 30 | 31 | # Installer logs 32 | pip-log.txt 33 | pip-delete-this-directory.txt 34 | 35 | # Unit test / coverage reports 36 | htmlcov/ 37 | .tox/ 38 | .coverage 39 | .cache 40 | nosetests.xml 41 | coverage.xml 42 | 43 | # Translations 44 | *.mo 45 | *.pot 46 | 47 | # Django stuff: 48 | *.log 49 | 50 | # Sphinx documentation 51 | docs/_build/ 52 | 53 | # PyBuilder 54 | target/ 55 | -------------------------------------------------------------------------------- /doc/changelog.rst: -------------------------------------------------------------------------------- 1 | Changelog 2 | ========= 3 | 4 | * :feature:`39` Added support to autogenerate entry points. 5 | 6 | * :support:`37` Added badge for supported Python version. 7 | 8 | * :release:`0.6.0 <14-02-2015>` 9 | 10 | * :support:`22` Added Trove classifiers to setup.py. 11 | 12 | * :support:`37` Added PyPI version and RTD badges. 13 | 14 | * :feature:`48` Improved comparison for yes / no in play_again(). 15 | 16 | * :release:`0.5.0 <29-01-2015>` 17 | 18 | * :support:`46` Added long_description to setup.py, this will appear 19 | as package description on PyPI. 20 | 21 | * :release:`0.4.0 <23-01-2015>` 22 | 23 | * :support:`44` Updated README.rst to reflect the current usage and 24 | development procedures. 25 | 26 | * :support:`43` Add doc-requirements.txt to install requirements to 27 | build the documentation. This is required for building the 28 | documentation on RTD. 29 | 30 | * :support:`36` Added a changelog file, based on 31 | https://github.com/bitprophet/releases Created a sphinx 32 | configuration to build it. 33 | 34 | * :support:`38` Converted README.md to README.rst, so that it shows up 35 | on PyPI. 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014, Al Sweigart 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | 25 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from setuptools import setup 4 | 5 | def readme(): 6 | return open("README.rst").read() 7 | 8 | setup(name='gallows', 9 | version='0.6.0', 10 | description=("The word game Hangman based on 'Invent Your " 11 | "Own Computer Games with Python'."), 12 | long_description=readme(), 13 | author='Vijay Kumar B.', 14 | author_email='vijaykumar@bravegnu.org', 15 | url='http://github.com/chennaipy/hangman', 16 | license="BSD 2-Clause", 17 | py_modules=['gallows'], 18 | entry_points={ 19 | 'console_scripts': ['gallows=gallows:main'] 20 | }, 21 | install_requires=[ 22 | 'six', 23 | ], 24 | tests_require=[ 25 | 'unittest2', 26 | 'mock', 27 | ], 28 | test_suite="test", 29 | classifiers=[ 30 | 'Development Status :: 5 - Production/Stable', 31 | 'Environment :: Console', 32 | 'Intended Audience :: End Users/Desktop', 33 | 'Intended Audience :: Education', 34 | 'License :: OSI Approved :: BSD License', 35 | 'Natural Language :: English', 36 | 'Operating System :: MacOS :: MacOS X', 37 | 'Operating System :: Microsoft :: Windows', 38 | 'Operating System :: POSIX', 39 | 'Programming Language :: Python :: 2.6', 40 | 'Programming Language :: Python :: 2.7', 41 | 'Programming Language :: Python :: 3.2', 42 | 'Programming Language :: Python :: 3.3', 43 | 'Programming Language :: Python :: 3.4', 44 | 'Topic :: Games/Entertainment :: Puzzle Games', 45 | ]) 46 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | Gallows 2 | ======= 3 | 4 | .. image:: https://travis-ci.org/Chennaipy/hangman.svg?branch=master 5 | :target: https://travis-ci.org/Chennaipy/hangman 6 | 7 | .. image:: https://img.shields.io/coveralls/Chennaipy/hangman.svg?style=flat 8 | :target: https://coveralls.io/r/Chennaipy/hangman 9 | 10 | .. image:: https://pypip.in/version/gallows/badge.svg?style=flat 11 | :target: https://pypi.python.org/pypi/gallows/ 12 | :alt: Latest Version 13 | 14 | .. image:: https://readthedocs.org/projects/gallows/badge/?version=latest 15 | :target: https://readthedocs.org/projects/gallows/?badge=latest 16 | :alt: Documentation Status 17 | 18 | .. image:: https://pypip.in/py_versions/gallows/badge.svg?style=flat 19 | :target: https://pypi.python.org/pypi/gallows/ 20 | :alt: Supported Python versions 21 | 22 | The goal of this project is to learn and implement the best practices, 23 | in writing and maintaining a Python project. For this purpose, we use 24 | a simple Hangman game program, from the book `"Invent Your Own 25 | Computer Games with Python" `_. 26 | 27 | Usage 28 | ----- 29 | 30 | The game can be installed using the following command :: 31 | 32 | $ pip install gallows 33 | 34 | Once installed the game can be played using the following command :: 35 | 36 | $ gallows 37 | 38 | Development 39 | ----------- 40 | 41 | After cloning the repository, install the game in development mode 42 | using the following command :: 43 | 44 | $ python3 setup.py develop 45 | 46 | You can modify the program and then test it by using the following 47 | command :: 48 | 49 | $ gallows 50 | 51 | You can execute the unit tests, using the following command :: 52 | 53 | $ python3 setup.py test 54 | 55 | You can build the documentation, using the following commands :: 56 | 57 | $ pip install -r doc-requirements.txt 58 | $ cd doc 59 | $ make html 60 | 61 | -------------------------------------------------------------------------------- /test.py: -------------------------------------------------------------------------------- 1 | """Unit test cases for hangman game.""" 2 | import unittest2 as unittest 3 | 4 | try: 5 | from unittest.mock import patch 6 | except ImportError: 7 | from mock import patch 8 | 9 | import gallows 10 | 11 | 12 | class HangmanTestCase(unittest.TestCase): 13 | """Test case for hangman game.""" 14 | 15 | def setUp(self): 16 | randchoice_patcher = patch("gallows.random.choice") 17 | self.choice = randchoice_patcher.start() 18 | self.addCleanup(randchoice_patcher.stop) 19 | 20 | print_patcher = patch("gallows.xprint") 21 | self.xprint = print_patcher.start() 22 | self.addCleanup(print_patcher.stop) 23 | 24 | input_patcher = patch("gallows.input") 25 | self.input = input_patcher.start() 26 | self.addCleanup(input_patcher.stop) 27 | 28 | def test_win(self): 29 | """Test user win scenario.""" 30 | self.choice.return_value = "ant" 31 | self.input.side_effect = list("ant" "n") 32 | 33 | gallows.main() 34 | 35 | self.xprint.assert_any_call('Yes! The secret word is "ant"! ' 36 | 'You have won!') 37 | 38 | def test_lose(self): 39 | """Test user lose scenario.""" 40 | self.choice.return_value = "ant" 41 | self.input.side_effect = list("bcdefg" "n") 42 | 43 | gallows.main() 44 | 45 | self.xprint.assert_any_call('You have run out of guesses!') 46 | 47 | def test_two_game(self): 48 | """Test two winning game plays.""" 49 | from itertools import chain 50 | self.choice.side_effect = ["ant", "baboon"] 51 | self.input.side_effect = chain(list("ant"), ["yes"], list("babon"), ["no"]) 52 | 53 | gallows.main() 54 | 55 | self.xprint.assert_any_call('Yes! The secret word is "ant"! ' 56 | 'You have won!') 57 | self.xprint.assert_any_call('Yes! The secret word is "baboon"! ' 58 | 'You have won!') 59 | 60 | def test_out_of_order(self): 61 | """Test win scenario with out of order input of letters.""" 62 | self.choice.return_value = "ant" 63 | self.input.side_effect = list("tan" "n") 64 | 65 | gallows.main() 66 | 67 | self.xprint.assert_any_call('Yes! The secret word is "ant"! ' 68 | 'You have won!') 69 | 70 | def test_numeric_input(self): 71 | """Test error message when user inputs numbers.""" 72 | self.choice.return_value = "ant" 73 | self.input.side_effect = list("a2nt" "n") 74 | 75 | gallows.main() 76 | 77 | self.xprint.assert_any_call('Please enter a LETTER.') 78 | 79 | def test_multiple_char_input(self): 80 | """Test error message when user inputs multiple characters.""" 81 | self.choice.return_value = "ant" 82 | self.input.side_effect = ["a", "nt", "n", "t", ] + ["n"] 83 | 84 | gallows.main() 85 | 86 | self.xprint.assert_any_call('Please enter a single letter.') 87 | 88 | def test_same_letter_twice(self): 89 | """Test error message when user enters same letter twice.""" 90 | self.choice.return_value = "ant" 91 | self.input.side_effect = list("anntn") 92 | 93 | gallows.main() 94 | 95 | self.xprint.assert_any_call("You have already guessed that letter. " 96 | "Choose again.") 97 | 98 | 99 | if __name__ == "__main__": 100 | unittest.main() 101 | -------------------------------------------------------------------------------- /gallows.py: -------------------------------------------------------------------------------- 1 | from six import print_ as xprint 2 | from six.moves import input 3 | import random 4 | 5 | HANGMANPICS = [''' 6 | 7 | +---+ 8 | | | 9 | | 10 | | 11 | | 12 | | 13 | =========''', ''' 14 | 15 | +---+ 16 | | | 17 | O | 18 | | 19 | | 20 | | 21 | =========''', ''' 22 | 23 | +---+ 24 | | | 25 | O | 26 | | | 27 | | 28 | | 29 | =========''', ''' 30 | 31 | +---+ 32 | | | 33 | O | 34 | /| | 35 | | 36 | | 37 | =========''', ''' 38 | 39 | +---+ 40 | | | 41 | O | 42 | /|\ | 43 | | 44 | | 45 | =========''', ''' 46 | 47 | +---+ 48 | | | 49 | O | 50 | /|\ | 51 | / | 52 | | 53 | =========''', ''' 54 | 55 | +---+ 56 | | | 57 | O | 58 | /|\ | 59 | / \ | 60 | | 61 | ========='''] 62 | 63 | 64 | words = ('ant baboon badger bat bear beaver camel cat clam cobra cougar ' 65 | 'coyote crow deer dog donkey duck eagle ferret fox frog goat ' 66 | 'goose hawk lion lizard llama mole monkey moose mouse mule newt ' 67 | 'otter owl panda parrot pigeon python rabbit ram rat raven ' 68 | 'rhino salmon seal shark sheep skunk sloth snake spider ' 69 | 'stork swan tiger toad trout turkey turtle weasel whale wolf ' 70 | 'wombat zebra ').split() 71 | 72 | 73 | class Hangman: 74 | def __init__(self, words): 75 | """Initializes the game state 76 | 77 | Selects the secret word for the game by a random choice 78 | from a list of words. 79 | 80 | Args: 81 | words (list of strings): List of words to choose from 82 | """ 83 | 84 | self._missed_letters = '' 85 | self._correct_letters = '' 86 | self._secret_word = random.choice(words) 87 | self._game_is_done = False 88 | 89 | def _display_board(self): 90 | """Displays the current status of the game that is being played.""" 91 | 92 | xprint(HANGMANPICS[len(self._missed_letters)]) 93 | xprint() 94 | 95 | xprint('Missed letters:', end=' ') 96 | for letter in self._missed_letters: 97 | xprint(letter, end=' ') 98 | xprint() 99 | 100 | blanks = '_' * len(self._secret_word) 101 | 102 | # replace blanks with correctly guessed letters 103 | for i in range(len(self._secret_word)): 104 | if self._secret_word[i] in self._correct_letters: 105 | blanks = blanks[:i] + self._secret_word[i] + blanks[i+1:] 106 | 107 | # show the secret word with spaces in between each letter 108 | for letter in blanks: 109 | xprint(letter, end=' ') 110 | xprint() 111 | 112 | def _get_guess(self, already_guessed): 113 | """Gets the input from the user. 114 | 115 | Makes sure that the input entered is a letter and 116 | the letter entered is not already guessed by the user. 117 | """ 118 | 119 | while True: 120 | xprint('Guess a letter.') 121 | guess = input().lower() 122 | if len(guess) != 1: 123 | xprint('Please enter a single letter.') 124 | elif guess in already_guessed: 125 | xprint('You have already guessed that letter. Choose again.') 126 | elif guess not in 'abcdefghijklmnopqrstuvwxyz': 127 | xprint('Please enter a LETTER.') 128 | else: 129 | return guess 130 | 131 | def _check_win(self): 132 | """Returns True if the user has won, False otherwise. 133 | 134 | Checks if the user has correctly guessed the secret word. 135 | """ 136 | 137 | for i in range(len(self._secret_word)): 138 | if self._secret_word[i] not in self._correct_letters: 139 | return False 140 | 141 | xprint('Yes! The secret word is "{0}"! ' 142 | 'You have won!'.format(self._secret_word)) 143 | 144 | return True 145 | 146 | def _check_lost(self): 147 | """Returns True if the user has lost, False otherwise. 148 | 149 | Alerts the user if all his chances have been used, without 150 | guessing the secret word. 151 | """ 152 | 153 | if len(self._missed_letters) == len(HANGMANPICS) - 1: 154 | self._display_board() 155 | 156 | missed = len(self._missed_letters) 157 | correct = len(self._correct_letters) 158 | word = self._secret_word 159 | xprint('You have run out of guesses!') 160 | xprint('After {0} missed guesses and {1} correct guesses, ' 161 | 'the word was "{2}"'.format(missed, correct, word)) 162 | 163 | return True 164 | 165 | return False 166 | 167 | def run(self): 168 | """Initialises the game play and coordinates the game activities.""" 169 | 170 | xprint('H A N G M A N') 171 | 172 | while not self._game_is_done: 173 | self._display_board() 174 | 175 | guessed_letters = self._missed_letters + self._correct_letters 176 | guess = self._get_guess(guessed_letters) 177 | 178 | if guess in self._secret_word: 179 | self._correct_letters = self._correct_letters + guess 180 | self._game_is_done = self._check_win() 181 | else: 182 | self._missed_letters = self._missed_letters + guess 183 | self._game_is_done = self._check_lost() 184 | 185 | 186 | def play_again(): 187 | """Returns True if the player wants to play again, False otherwise.""" 188 | 189 | xprint('Do you want to play again? (yes or no)') 190 | return input().lower() == 'yes' 191 | 192 | 193 | def main(): 194 | """Main application entry point.""" 195 | 196 | current_game = Hangman(words) 197 | 198 | while True: 199 | current_game.run() 200 | if play_again(): 201 | current_game = Hangman(words) 202 | else: 203 | break 204 | 205 | if __name__ == "__main__": 206 | main() 207 | -------------------------------------------------------------------------------- /doc/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | PAPER = 8 | BUILDDIR = _build 9 | 10 | # User-friendly check for sphinx-build 11 | ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) 12 | $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) 13 | endif 14 | 15 | # Internal variables. 16 | PAPEROPT_a4 = -D latex_paper_size=a4 17 | PAPEROPT_letter = -D latex_paper_size=letter 18 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 19 | # the i18n builder cannot share the environment and doctrees with the others 20 | I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 21 | 22 | .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext 23 | 24 | help: 25 | @echo "Please use \`make ' where is one of" 26 | @echo " html to make standalone HTML files" 27 | @echo " dirhtml to make HTML files named index.html in directories" 28 | @echo " singlehtml to make a single large HTML file" 29 | @echo " pickle to make pickle files" 30 | @echo " json to make JSON files" 31 | @echo " htmlhelp to make HTML files and a HTML help project" 32 | @echo " qthelp to make HTML files and a qthelp project" 33 | @echo " devhelp to make HTML files and a Devhelp project" 34 | @echo " epub to make an epub" 35 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" 36 | @echo " latexpdf to make LaTeX files and run them through pdflatex" 37 | @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" 38 | @echo " text to make text files" 39 | @echo " man to make manual pages" 40 | @echo " texinfo to make Texinfo files" 41 | @echo " info to make Texinfo files and run them through makeinfo" 42 | @echo " gettext to make PO message catalogs" 43 | @echo " changes to make an overview of all changed/added/deprecated items" 44 | @echo " xml to make Docutils-native XML files" 45 | @echo " pseudoxml to make pseudoxml-XML files for display purposes" 46 | @echo " linkcheck to check all external links for integrity" 47 | @echo " doctest to run all doctests embedded in the documentation (if enabled)" 48 | 49 | clean: 50 | rm -rf $(BUILDDIR)/* 51 | 52 | html: 53 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 54 | @echo 55 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." 56 | 57 | dirhtml: 58 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml 59 | @echo 60 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." 61 | 62 | singlehtml: 63 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml 64 | @echo 65 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." 66 | 67 | pickle: 68 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle 69 | @echo 70 | @echo "Build finished; now you can process the pickle files." 71 | 72 | json: 73 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json 74 | @echo 75 | @echo "Build finished; now you can process the JSON files." 76 | 77 | htmlhelp: 78 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp 79 | @echo 80 | @echo "Build finished; now you can run HTML Help Workshop with the" \ 81 | ".hhp project file in $(BUILDDIR)/htmlhelp." 82 | 83 | qthelp: 84 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp 85 | @echo 86 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \ 87 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:" 88 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Gallows.qhcp" 89 | @echo "To view the help file:" 90 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Gallows.qhc" 91 | 92 | devhelp: 93 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp 94 | @echo 95 | @echo "Build finished." 96 | @echo "To view the help file:" 97 | @echo "# mkdir -p $$HOME/.local/share/devhelp/Gallows" 98 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Gallows" 99 | @echo "# devhelp" 100 | 101 | epub: 102 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub 103 | @echo 104 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub." 105 | 106 | latex: 107 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 108 | @echo 109 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." 110 | @echo "Run \`make' in that directory to run these through (pdf)latex" \ 111 | "(use \`make latexpdf' here to do that automatically)." 112 | 113 | latexpdf: 114 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 115 | @echo "Running LaTeX files through pdflatex..." 116 | $(MAKE) -C $(BUILDDIR)/latex all-pdf 117 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 118 | 119 | latexpdfja: 120 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 121 | @echo "Running LaTeX files through platex and dvipdfmx..." 122 | $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja 123 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 124 | 125 | text: 126 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text 127 | @echo 128 | @echo "Build finished. The text files are in $(BUILDDIR)/text." 129 | 130 | man: 131 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man 132 | @echo 133 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man." 134 | 135 | texinfo: 136 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 137 | @echo 138 | @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." 139 | @echo "Run \`make' in that directory to run these through makeinfo" \ 140 | "(use \`make info' here to do that automatically)." 141 | 142 | info: 143 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 144 | @echo "Running Texinfo files through makeinfo..." 145 | make -C $(BUILDDIR)/texinfo info 146 | @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." 147 | 148 | gettext: 149 | $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale 150 | @echo 151 | @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." 152 | 153 | changes: 154 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes 155 | @echo 156 | @echo "The overview file is in $(BUILDDIR)/changes." 157 | 158 | linkcheck: 159 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck 160 | @echo 161 | @echo "Link check complete; look for any errors in the above output " \ 162 | "or in $(BUILDDIR)/linkcheck/output.txt." 163 | 164 | doctest: 165 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest 166 | @echo "Testing of doctests in the sources finished, look at the " \ 167 | "results in $(BUILDDIR)/doctest/output.txt." 168 | 169 | xml: 170 | $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml 171 | @echo 172 | @echo "Build finished. The XML files are in $(BUILDDIR)/xml." 173 | 174 | pseudoxml: 175 | $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml 176 | @echo 177 | @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." 178 | -------------------------------------------------------------------------------- /doc/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Gallows documentation build configuration file, created by 4 | # sphinx-quickstart on Fri Jan 23 02:27:47 2015. 5 | # 6 | # This file is execfile()d with the current directory set to its 7 | # containing dir. 8 | # 9 | # Note that not all possible configuration values are present in this 10 | # autogenerated file. 11 | # 12 | # All configuration values have a default; values that are commented out 13 | # serve to show the default. 14 | 15 | import sys 16 | import os 17 | 18 | # If extensions (or modules to document with autodoc) are in another directory, 19 | # add these directories to sys.path here. If the directory is relative to the 20 | # documentation root, use os.path.abspath to make it absolute, like shown here. 21 | #sys.path.insert(0, os.path.abspath('.')) 22 | 23 | # -- General configuration ------------------------------------------------ 24 | 25 | # If your documentation needs a minimal Sphinx version, state it here. 26 | #needs_sphinx = '1.0' 27 | 28 | # Add any Sphinx extension module names here, as strings. They can be 29 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 30 | # ones. 31 | extensions = ['releases'] 32 | 33 | # Add any paths that contain templates here, relative to this directory. 34 | templates_path = ['_templates'] 35 | 36 | # The suffix of source filenames. 37 | source_suffix = '.rst' 38 | 39 | # The encoding of source files. 40 | #source_encoding = 'utf-8-sig' 41 | 42 | # The master toctree document. 43 | master_doc = 'index' 44 | 45 | # General information about the project. 46 | project = u'Gallows' 47 | copyright = u'2015, Vijay Kumar B.' 48 | 49 | # The version info for the project you're documenting, acts as replacement for 50 | # |version| and |release|, also used in various other places throughout the 51 | # built documents. 52 | # 53 | # The short X.Y version. 54 | version = '0.3.0' 55 | # The full version, including alpha/beta/rc tags. 56 | release = '0.3.0' 57 | 58 | # The language for content autogenerated by Sphinx. Refer to documentation 59 | # for a list of supported languages. 60 | #language = None 61 | 62 | # There are two options for replacing |today|: either, you set today to some 63 | # non-false value, then it is used: 64 | #today = '' 65 | # Else, today_fmt is used as the format for a strftime call. 66 | #today_fmt = '%B %d, %Y' 67 | 68 | # List of patterns, relative to source directory, that match files and 69 | # directories to ignore when looking for source files. 70 | exclude_patterns = ['_build'] 71 | 72 | # The reST default role (used for this markup: `text`) to use for all 73 | # documents. 74 | #default_role = None 75 | 76 | # If true, '()' will be appended to :func: etc. cross-reference text. 77 | #add_function_parentheses = True 78 | 79 | # If true, the current module name will be prepended to all description 80 | # unit titles (such as .. function::). 81 | #add_module_names = True 82 | 83 | # If true, sectionauthor and moduleauthor directives will be shown in the 84 | # output. They are ignored by default. 85 | #show_authors = False 86 | 87 | # The name of the Pygments (syntax highlighting) style to use. 88 | pygments_style = 'sphinx' 89 | 90 | # A list of ignored prefixes for module index sorting. 91 | #modindex_common_prefix = [] 92 | 93 | # If true, keep warnings as "system message" paragraphs in the built documents. 94 | #keep_warnings = False 95 | 96 | 97 | # -- Options for HTML output ---------------------------------------------- 98 | 99 | # The theme to use for HTML and HTML Help pages. See the documentation for 100 | # a list of builtin themes. 101 | html_theme = 'default' 102 | 103 | # Theme options are theme-specific and customize the look and feel of a theme 104 | # further. For a list of options available for each theme, see the 105 | # documentation. 106 | #html_theme_options = {} 107 | 108 | # Add any paths that contain custom themes here, relative to this directory. 109 | #html_theme_path = [] 110 | 111 | # The name for this set of Sphinx documents. If None, it defaults to 112 | # " v documentation". 113 | #html_title = None 114 | 115 | # A shorter title for the navigation bar. Default is the same as html_title. 116 | #html_short_title = None 117 | 118 | # The name of an image file (relative to this directory) to place at the top 119 | # of the sidebar. 120 | #html_logo = None 121 | 122 | # The name of an image file (within the static path) to use as favicon of the 123 | # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 124 | # pixels large. 125 | #html_favicon = None 126 | 127 | # Add any paths that contain custom static files (such as style sheets) here, 128 | # relative to this directory. They are copied after the builtin static files, 129 | # so a file named "default.css" will overwrite the builtin "default.css". 130 | html_static_path = ['_static'] 131 | 132 | # Add any extra paths that contain custom files (such as robots.txt or 133 | # .htaccess) here, relative to this directory. These files are copied 134 | # directly to the root of the documentation. 135 | #html_extra_path = [] 136 | 137 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, 138 | # using the given strftime format. 139 | #html_last_updated_fmt = '%b %d, %Y' 140 | 141 | # If true, SmartyPants will be used to convert quotes and dashes to 142 | # typographically correct entities. 143 | #html_use_smartypants = True 144 | 145 | # Custom sidebar templates, maps document names to template names. 146 | #html_sidebars = {} 147 | 148 | # Additional templates that should be rendered to pages, maps page names to 149 | # template names. 150 | #html_additional_pages = {} 151 | 152 | # If false, no module index is generated. 153 | #html_domain_indices = True 154 | 155 | # If false, no index is generated. 156 | #html_use_index = True 157 | 158 | # If true, the index is split into individual pages for each letter. 159 | #html_split_index = False 160 | 161 | # If true, links to the reST sources are added to the pages. 162 | #html_show_sourcelink = True 163 | 164 | # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. 165 | #html_show_sphinx = True 166 | 167 | # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. 168 | #html_show_copyright = True 169 | 170 | # If true, an OpenSearch description file will be output, and all pages will 171 | # contain a tag referring to it. The value of this option must be the 172 | # base URL from which the finished HTML is served. 173 | #html_use_opensearch = '' 174 | 175 | # This is the file name suffix for HTML files (e.g. ".xhtml"). 176 | #html_file_suffix = None 177 | 178 | # Output file base name for HTML help builder. 179 | htmlhelp_basename = 'Gallowsdoc' 180 | 181 | 182 | # -- Options for LaTeX output --------------------------------------------- 183 | 184 | latex_elements = { 185 | # The paper size ('letterpaper' or 'a4paper'). 186 | #'papersize': 'letterpaper', 187 | 188 | # The font size ('10pt', '11pt' or '12pt'). 189 | #'pointsize': '10pt', 190 | 191 | # Additional stuff for the LaTeX preamble. 192 | #'preamble': '', 193 | } 194 | 195 | # Grouping the document tree into LaTeX files. List of tuples 196 | # (source start file, target name, title, 197 | # author, documentclass [howto, manual, or own class]). 198 | latex_documents = [ 199 | ('index', 'Gallows.tex', u'Gallows Documentation', 200 | u'Vijay Kumar B.', 'manual'), 201 | ] 202 | 203 | # The name of an image file (relative to this directory) to place at the top of 204 | # the title page. 205 | #latex_logo = None 206 | 207 | # For "manual" documents, if this is true, then toplevel headings are parts, 208 | # not chapters. 209 | #latex_use_parts = False 210 | 211 | # If true, show page references after internal links. 212 | #latex_show_pagerefs = False 213 | 214 | # If true, show URL addresses after external links. 215 | #latex_show_urls = False 216 | 217 | # Documents to append as an appendix to all manuals. 218 | #latex_appendices = [] 219 | 220 | # If false, no module index is generated. 221 | #latex_domain_indices = True 222 | 223 | 224 | # -- Options for manual page output --------------------------------------- 225 | 226 | # One entry per manual page. List of tuples 227 | # (source start file, name, description, authors, manual section). 228 | man_pages = [ 229 | ('index', 'gallows', u'Gallows Documentation', 230 | [u'Vijay Kumar B.'], 1) 231 | ] 232 | 233 | # If true, show URL addresses after external links. 234 | #man_show_urls = False 235 | 236 | 237 | # -- Options for Texinfo output ------------------------------------------- 238 | 239 | # Grouping the document tree into Texinfo files. List of tuples 240 | # (source start file, target name, title, author, 241 | # dir menu entry, description, category) 242 | texinfo_documents = [ 243 | ('index', 'Gallows', u'Gallows Documentation', 244 | u'Vijay Kumar B.', 'Gallows', 'One line description of project.', 245 | 'Miscellaneous'), 246 | ] 247 | 248 | # Documents to append as an appendix to all manuals. 249 | #texinfo_appendices = [] 250 | 251 | # If false, no module index is generated. 252 | #texinfo_domain_indices = True 253 | 254 | # How to display URL addresses: 'footnote', 'no', or 'inline'. 255 | #texinfo_show_urls = 'footnote' 256 | 257 | # If true, do not generate a @detailmenu in the "Top" node's menu. 258 | #texinfo_no_detailmenu = False 259 | 260 | # releases plugin settings 261 | releases_github_path = 'chennaipy/hangman' 262 | --------------------------------------------------------------------------------