Skip to content

Commit 09a6fcd

Browse files
committed
Add __version__ and use it in setup.py
1 parent b0dec75 commit 09a6fcd

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

emrichen/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
from .template import Template
33
from .tags import Var
44

5+
__version__ = '0.2.1'
6+
57

68
__all__ = ['Context', 'Template', 'Var', 'emrichen']
79

setup.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11
#!/usr/bin/env python
22

33
import os
4+
import re
45
from setuptools import find_packages, setup
56

7+
source_dir = os.path.abspath(os.path.dirname(__file__))
68

7-
with open(os.path.join(os.path.abspath(os.path.dirname(__file__)), 'README.md'), encoding='utf-8') as f:
9+
10+
with open(os.path.join(source_dir, 'emrichen', '__init__.py'), 'r') as f:
11+
version = re.search("__version__ = ['\"]([^'\"]+)['\"]", f.read()).group(1)
12+
13+
14+
with open(os.path.join(source_dir, 'README.md'), encoding='utf-8') as f:
815
long_description = f.read()
916

17+
1018
setup(
1119
name='emrichen',
12-
version='0.2.1',
20+
version=version,
1321
description='Template engine for YAML & JSON',
1422
long_description=long_description,
1523
long_description_content_type='text/markdown',

0 commit comments

Comments
 (0)