diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..52e0d743 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,27 @@ +# Check this file before committing a new version: +# http://lint.travis-ci.org/ + +language: python + +python: + - "2.7" + +before_install: + - uname -a + - free -m + - df -h + - ulimit -a + - python -V + +virtualenv: + system_site_packages: true + +# command to install dependencies +install: + - sudo apt-get update -qq + - if [[ $TRAVIS_PYTHON_VERSION == "2.7" ]]; then sudo apt-get install python-matplotlib python-scipy; fi + - pip install -r pip-requirements.txt + +# run tests +script: + - ./run-tests diff --git a/pip-requirements.txt b/pip-requirements.txt new file mode 100644 index 00000000..35c5e144 --- /dev/null +++ b/pip-requirements.txt @@ -0,0 +1,5 @@ +--index-url https://pypi.python.org/simple/ + +pep8 +nose +-e . diff --git a/postpic/__init__.py b/postpic/__init__.py index c7de5a14..7825e9a1 100644 --- a/postpic/__init__.py +++ b/postpic/__init__.py @@ -27,9 +27,25 @@ import analyzer import plotting -__version__ = '0.0.0' +__all__ = ['datareader', 'analyzer', 'plotting'] -# Use Git description for __version__ if present +# read version from installed metadata +from pkg_resources import get_distribution, DistributionNotFound +try: + import os.path + _dist = get_distribution('postpic') + # Normalize case for Windows systems + dist_loc = os.path.normcase(_dist.location) + here = os.path.normcase(__file__) + if not here.startswith(os.path.join(dist_loc, 'postpic')): + # not installed, but there is another version that *is* + raise DistributionNotFound +except DistributionNotFound: + __version__ = 'Please install this project with setup.py' +else: + __version__ = _dist.version + +# add Git description for __version__ if present try: import subprocess as sub import os.path diff --git a/setup.py b/setup.py index 76556696..92261cde 100755 --- a/setup.py +++ b/setup.py @@ -16,11 +16,9 @@ # along with postpic. If not, see . # from setuptools import setup -from postpic import __version__ - setup(name='postpic', - version=__version__, + version='0.0.0', author='Stephan Kuschel', author_email='stephan.kuschel@gmail.de', description='The open source particle-in-cell post processor.',