Skip to content

Commit

Permalink
Corrected version acquisition.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernardo-MG committed Jun 9, 2015
1 parent ad51745 commit 2f41a0d
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 22 deletions.
2 changes: 1 addition & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"year": "2015",
"version": "0.1.0",
"_copy_without_render": [
"_templates/layout.html"
"layout.html"
]
}
18 changes: 18 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# -*- coding: utf-8 -*-
import ast
import re
import sys
import io
from os.path import dirname
from os.path import join
from os import path

from setuptools import find_packages, setup
from setuptools.command.test import test as test_command
Expand All @@ -15,10 +18,25 @@

__license__ = 'MIT'

# Regular expression for the version
_version_re = re.compile(r'__version__\s+=\s+(.*)')

# Test requirements
_tests_require = ['tox']

# Path to the project's root
here = path.abspath(path.dirname(__file__))

# Gets the long description from the readme
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()

# Gets the version for the source folder __init__.py file
with open('cwr/__init__.py', 'rb', encoding='utf-8') as f:
version = f.read()
version = _version_re.search(version).group(1)
version = str(ast.literal_eval(version.rstrip()))


# Gets the long description from the readme
def read(*names, **kwargs):
Expand Down
19 changes: 0 additions & 19 deletions {{cookiecutter.repo_name}}/docs/source/_templates/layout.html

This file was deleted.

21 changes: 19 additions & 2 deletions {{cookiecutter.repo_name}}/docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,26 @@
import re
import sys
import os
import datetime
from codecs import open
from os import path

# -- Version --------------------------------------------------------------

# Regular expression for the version
_version_re = re.compile(r'__version__\s+=\s+(.*)')

# Path to the project's root
here = path.abspath(path.dirname(__file__))

# Gets the long description from the readme
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()

# Gets the version for the source folder __init__.py file
with open('cwr/__init__.py', 'rb', encoding='utf-8') as f:
version_lib = f.read()
version_lib = _version_re.search(version_lib).group(1)
version_lib = str(ast.literal_eval(version_lib.rstrip()))

# -- Code location --------------------------------------------------------

Expand Down Expand Up @@ -50,7 +67,7 @@
# The version info for the project.
#
# Semantic version value.
version = {{ cookiecutter.package_name }}.__version__
version = version_lib
# The full version, including alpha/beta/rc tags.
release = version

Expand Down

0 comments on commit 2f41a0d

Please sign in to comment.