Skip to content

Commit 0f10309

Browse files
committed
Add __version__ tag to vhdeps
1 parent d3b2fa1 commit 0f10309

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

setup.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
11
#!/usr/bin/env python3
22

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

67
def read(fname):
7-
with open(os.path.join(os.path.dirname(__file__), fname)) as f:
8-
return f.read()
8+
with open(os.path.join(os.path.dirname(__file__), fname)) as fildes:
9+
return fildes.read()
10+
11+
def get_version():
12+
with open('vhdeps/__init__.py', 'r') as fildes:
13+
for line in fildes:
14+
match = re.match("__version__ = '([^']+)'\n", line)
15+
if match:
16+
return match.group(1)
17+
raise ValueError('Could not find package version')
918

1019
setup(
1120
name = "vhdeps",
12-
version = "0.0.3",
21+
version = get_version(),
1322
author = "Jeroen van Straten",
1423
author_email = "[email protected]",
1524
description = (

vhdeps/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
import vhdeps.vhdl as vhdl
2424
import vhdeps.target as targets
2525

26+
__version__ = '0.0.3'
27+
2628
def run_cli(args=None):
2729
"""Runs the vhdeps CLI. The command-line arguments are taken from `args`
2830
when specified, or `sys.argv` by default. The return value is the exit code

0 commit comments

Comments
 (0)