Home | History | Annotate | Download | only in markdown
      1 # markdown is released under the BSD license
      2 # Copyright 2007, 2008 The Python Markdown Project (v. 1.7 and later)
      3 # Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b)
      4 # Copyright 2004 Manfred Stienstra (the original version)
      5 # 
      6 # All rights reserved.
      7 # 
      8 # Redistribution and use in source and binary forms, with or without
      9 # modification, are permitted provided that the following conditions are met:
     10 # 
     11 # *   Redistributions of source code must retain the above copyright
     12 #     notice, this list of conditions and the following disclaimer.
     13 # *   Redistributions in binary form must reproduce the above copyright
     14 #     notice, this list of conditions and the following disclaimer in the
     15 #     documentation and/or other materials provided with the distribution.
     16 # *   Neither the name of the <organization> nor the
     17 #     names of its contributors may be used to endorse or promote products
     18 #     derived from this software without specific prior written permission.
     19 # 
     20 # THIS SOFTWARE IS PROVIDED BY THE PYTHON MARKDOWN PROJECT ''AS IS'' AND ANY
     21 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     22 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
     23 # DISCLAIMED. IN NO EVENT SHALL ANY CONTRIBUTORS TO THE PYTHON MARKDOWN PROJECT
     24 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     25 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     26 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     27 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     28 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     29 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     30 # POSSIBILITY OF SUCH DAMAGE.
     31 #
     32 # markdown/__version__.py
     33 #
     34 # version_info should conform to PEP 386 
     35 # (major, minor, micro, alpha/beta/rc/final, #)
     36 # (1, 1, 2, 'alpha', 0) => "1.1.2.dev"
     37 # (1, 2, 0, 'beta', 2) => "1.2b2"
     38 version_info = (2, 3, 1, 'final', 0)
     39 
     40 def _get_version():
     41     " Returns a PEP 386-compliant version number from version_info. "
     42     assert len(version_info) == 5
     43     assert version_info[3] in ('alpha', 'beta', 'rc', 'final')
     44 
     45     parts = 2 if version_info[2] == 0 else 3
     46     main = '.'.join(map(str, version_info[:parts]))
     47 
     48     sub = ''
     49     if version_info[3] == 'alpha' and version_info[4] == 0:
     50         # TODO: maybe append some sort of git info here??
     51         sub = '.dev'
     52     elif version_info[3] != 'final':
     53         mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'c'}
     54         sub = mapping[version_info[3]] + str(version_info[4])
     55 
     56     return str(main + sub)
     57 
     58 version = _get_version()
     59