Skip to content

Commit

Permalink
Fix setup.py version retrieval
Browse files Browse the repository at this point in the history
  • Loading branch information
jrwdunham committed Apr 9, 2018
1 parent 850fa15 commit 13dab0c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
.pytest_cache/

# C extensions
*.so
Expand Down
29 changes: 21 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,37 @@
https://github.com/pypa/sampleproject
"""

# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
import codecs
from os import path
import re

from metsrw import __version__
from setuptools import setup, find_packages

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


def read(*parts):
with codecs.open(path.join(here, *parts), 'r') as fp:
return fp.read()


def find_version(*file_paths):
version_file = read(*file_paths)
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
version_file, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")


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


setup(
name='metsrw',
version=__version__,
version=find_version('metsrw', '__init__.py'),

description='Library for dealing with METS files.',
long_description=long_description,
Expand All @@ -48,7 +61,7 @@

packages=find_packages(exclude=['docs', 'fixtures', 'requirements', 'tests*']),

install_requires=['lxml', 'six'],
install_requires=['future', 'lxml', 'six'],

include_package_data=True
)

0 comments on commit 13dab0c

Please sign in to comment.