from distutils.core import setup
import pkg_resources

import sys

requires = ['six']
if sys.version_info < (2, 7):
    requires.append('argparse')

version = pkg_resources.require("fitparse")[0].version

setup(
    name='fitparse',
    version=version,
    description='Python library to parse ANT/Garmin .FIT files',
    author='David Cooper, Kévin Gomez',
    author_email='dave@kupesoft.com, contact@kevingomez.fr',
    url='https://github.com/K-Phoen/python-fitparse',
    license=open('LICENSE').read(),
    packages=['fitparse'],
    scripts=['scripts/fitdump'],  # Don't include generate_profile.py
    install_requires=requires,
)

# -*- coding: utf-8 -*-

import re
import sys

from distutils.core import setup

requires = ['six']
if sys.version_info < (2, 7):
    requires.append('argparse')

with open('fitparse/__init__.py', 'r') as fd:
    version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
                        fd.read(), re.MULTILINE).group(1)

setup(
    name='fitparse',
    version=version,
    description='Python library to parse ANT/Garmin .FIT files',
    author='David Cooper, Kévin Gomez',
    author_email='dave@kupesoft.com, contact@kevingomez.fr',
    url='https://github.com/K-Phoen/python-fitparse',
    license=open('LICENSE').read(),
    packages=['fitparse'],
    scripts=['scripts/fitdump'],  # Don't include generate_profile.py
    install_requires=requires,
)

Read the __version__ from the fitparse/__init__.py without importing it
Read the __version__ from the fitparse/__init__.py without importing it

It avoids having to read an extra VERSION file in the module code itself
and leaves all the ugliness in setup.py, where ugliness belongs. This
is the same technique that the requests module uses.
