Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(846)

Side by Side Diff: third_party/markdown/__version__.py

Issue 93743005: Support markdown template for html editor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix path without dir Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/markdown/__main__.py ('k') | third_party/markdown/blockparser.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #
2 # markdown/__version__.py
3 #
4 # version_info should conform to PEP 386
5 # (major, minor, micro, alpha/beta/rc/final, #)
6 # (1, 1, 2, 'alpha', 0) => "1.1.2.dev"
7 # (1, 2, 0, 'beta', 2) => "1.2b2"
8 version_info = (2, 3, 1, 'final', 0)
9
10 def _get_version():
11 " Returns a PEP 386-compliant version number from version_info. "
12 assert len(version_info) == 5
13 assert version_info[3] in ('alpha', 'beta', 'rc', 'final')
14
15 parts = 2 if version_info[2] == 0 else 3
16 main = '.'.join(map(str, version_info[:parts]))
17
18 sub = ''
19 if version_info[3] == 'alpha' and version_info[4] == 0:
20 # TODO: maybe append some sort of git info here??
21 sub = '.dev'
22 elif version_info[3] != 'final':
23 mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'c'}
24 sub = mapping[version_info[3]] + str(version_info[4])
25
26 return str(main + sub)
27
28 version = _get_version()
OLDNEW
« no previous file with comments | « third_party/markdown/__main__.py ('k') | third_party/markdown/blockparser.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698