# -*- coding: utf-8 -*-
import sys, os, re
from datetime import date

def load_properties(filepath, sep='=', comment_char='#'):
    """
    Read the file passed as parameter as a properties file.
    """
    props = {}
    with open(filepath, "rt") as f:
        for line in f:
            l = line.strip()
            if l and not l.startswith(comment_char):
                key_value = l.split(sep)
                key = key_value[0].strip()
                value = sep.join(key_value[1:]).strip().strip('"')
                props[key] = value
    return props


# Load the properties file.
properties = load_properties(os.path.dirname(os.path.abspath(__file__)) + '/../../../gradle.properties')

# Set the basic project information.
project = 'Armeria'
project_short = 'Armeria'
copyright = properties['inceptionYear'] + '-' + str(date.today().year) + ', LINE Corporation'

# Set the project version and release.
# Use the last known stable release if the current version ends with '-SNAPSHOT'.
if re.match(r'^.*-SNAPSHOT$', properties['version']):
    release = '0.35.1'
else:
    release = properties['version']
version = re.match(r'^[0-9]+\.[0-9]+', release).group(0)

# Export the loaded properties and some useful values into epilogs
rst_epilog = '\n'
rst_epilog += '.. |baseurl| replace:: http://line.github.io/armeria/\n'
for k in properties.keys():
    v = properties[k]
    if k in [ 'release', 'version' ]:
        continue
    rst_epilog += '.. |' + k + '| replace:: ' + v + '\n'
rst_epilog += '\n'

needs_sphinx = '1.0'
extensions = ['sphinx.ext.autodoc']
templates_path = ['_templates']
source_suffix = '.rst'
source_encoding = 'utf-8-sig'
master_doc = 'index'
exclude_trees = ['.build']
add_function_parentheses = True
pygments_style = 'tango'
master_doc = 'index'

sys.path.append(os.path.abspath('_themes'))
html_theme = 'sphinx_rtd_theme'
html_theme_path = ['_themes']
html_short_title = project_short
html_static_path = ['_static']
html_use_smartypants = True
html_use_index = True
html_show_sourcelink = False
htmlhelp_basename = project_short

# -*- coding: utf-8 -*-
import sys, os, re
from datetime import date

def load_properties(filepath, sep='=', comment_char='#'):
    """
    Read the file passed as parameter as a properties file.
    """
    props = {}
    with open(filepath, "rt") as f:
        for line in f:
            l = line.strip()
            if l and not l.startswith(comment_char):
                key_value = l.split(sep)
                key = key_value[0].strip()
                value = sep.join(key_value[1:]).strip().strip('"')
                props[key] = value
    return props


# Load the properties file.
properties = load_properties(os.path.dirname(os.path.abspath(__file__)) + '/../../../gradle.properties')

# Set the basic project information.
project = 'Armeria'
project_short = 'Armeria'
copyright = properties['inceptionYear'] + '-' + str(date.today().year) + ', LINE Corporation'

# Set the project version and release.
# Use the last known stable release if the current version ends with '-SNAPSHOT'.
if re.match(r'^.*-SNAPSHOT$', properties['version']):
    release = '0.35.2'
else:
    release = properties['version']
version = re.match(r'^[0-9]+\.[0-9]+', release).group(0)

# Export the loaded properties and some useful values into epilogs
rst_epilog = '\n'
rst_epilog += '.. |baseurl| replace:: http://line.github.io/armeria/\n'
for k in properties.keys():
    v = properties[k]
    if k in [ 'release', 'version' ]:
        continue
    rst_epilog += '.. |' + k + '| replace:: ' + v + '\n'
rst_epilog += '\n'

needs_sphinx = '1.0'
extensions = ['sphinx.ext.autodoc']
templates_path = ['_templates']
source_suffix = '.rst'
source_encoding = 'utf-8-sig'
master_doc = 'index'
exclude_trees = ['.build']
add_function_parentheses = True
pygments_style = 'tango'
master_doc = 'index'

sys.path.append(os.path.abspath('_themes'))
html_theme = 'sphinx_rtd_theme'
html_theme_path = ['_themes']
html_short_title = project_short
html_static_path = ['_static']
html_use_smartypants = True
html_use_index = True
html_show_sourcelink = False
htmlhelp_basename = project_short

Update the project version to 0.36.0-SNAPSHOT