Skip to content

Commit

Permalink
Improved version retrieval in setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jrwdunham committed Nov 10, 2017
1 parent 3caf782 commit d5a1645
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,31 @@
from codecs import open
from os import path

from metsrw import __version__

HERE = path.abspath(path.dirname(__file__))


# Get the long description from the relevant file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
with open(path.join(HERE, 'README.md'), encoding='utf-8') as f:
long_description = f.read()


def get_version():
version = '0.1.0'
with open(path.join(HERE, 'metsrw', '__init__.py')) as fi:
for line in fi:
if line.startswith('__version__'):
parts = line.strip().split()
try:
version = parts[2].replace("'", '').replace('"', '').strip()
except (IndexError, AttributeError):
continue
return version


setup(
name='metsrw',
version=__version__,
version=get_version(),

description='Library for dealing with METS files.',
long_description=long_description,
Expand Down

0 comments on commit d5a1645

Please sign in to comment.