Conditions | 2 |
Total Lines | 11 |
Code Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import os |
||
13 | def get_version(package_name, version_file='_version.py'): |
||
14 | """ |
||
15 | Retrieve the package version from a version file in the package root. |
||
16 | |||
17 | :param package_name: |
||
18 | :param version_file: version file name (inside package root) |
||
19 | :return: package version |
||
20 | """ |
||
21 | filename = os.path.join(os.path.dirname(__file__), package_name, version_file) |
||
22 | with open(filename, 'rb') as fp: |
||
23 | return fp.read().decode('utf8').split('=')[1].strip(" \n'") |
||
24 | |||
44 |