15d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)# markdown is released under the BSD license
25d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)# Copyright 2007, 2008 The Python Markdown Project (v. 1.7 and later)
35d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)# Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b)
45d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)# Copyright 2004 Manfred Stienstra (the original version)
55d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#
65d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)# All rights reserved.
75d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#
85d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)# Redistribution and use in source and binary forms, with or without
95d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)# modification, are permitted provided that the following conditions are met:
105d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#
115d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)# *   Redistributions of source code must retain the above copyright
125d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#     notice, this list of conditions and the following disclaimer.
135d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)# *   Redistributions in binary form must reproduce the above copyright
145d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#     notice, this list of conditions and the following disclaimer in the
155d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#     documentation and/or other materials provided with the distribution.
165d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)# *   Neither the name of the <organization> nor the
175d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#     names of its contributors may be used to endorse or promote products
185d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#     derived from this software without specific prior written permission.
195d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#
205d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)# THIS SOFTWARE IS PROVIDED BY THE PYTHON MARKDOWN PROJECT ''AS IS'' AND ANY
215d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
225d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
235d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)# DISCLAIMED. IN NO EVENT SHALL ANY CONTRIBUTORS TO THE PYTHON MARKDOWN PROJECT
245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
255d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
265d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
285d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
295d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
305d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)# POSSIBILITY OF SUCH DAMAGE.
315d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#
325d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)# markdown/__version__.py
335d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#
345d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)# version_info should conform to PEP 386
355d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)# (major, minor, micro, alpha/beta/rc/final, #)
365d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)# (1, 1, 2, 'alpha', 0) => "1.1.2.dev"
375d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)# (1, 2, 0, 'beta', 2) => "1.2b2"
385d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)version_info = (2, 3, 1, 'final', 0)
395d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
405d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)def _get_version():
415d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    " Returns a PEP 386-compliant version number from version_info. "
425d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    assert len(version_info) == 5
435d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    assert version_info[3] in ('alpha', 'beta', 'rc', 'final')
445d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
455d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    parts = 2 if version_info[2] == 0 else 3
465d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    main = '.'.join(map(str, version_info[:parts]))
475d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
485d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    sub = ''
495d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    if version_info[3] == 'alpha' and version_info[4] == 0:
505d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)        # TODO: maybe append some sort of git info here??
515d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)        sub = '.dev'
525d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    elif version_info[3] != 'final':
535d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)        mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'c'}
545d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)        sub = mapping[version_info[3]] + str(version_info[4])
555d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
565d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    return str(main + sub)
575d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
585d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)version = _get_version()
59