From 4899645f052464101a5f43c124865a5bb6d0b27f Mon Sep 17 00:00:00 2001 From: Yamashita Yuu Date: Sun, 19 Aug 2012 00:25:43 +0900 Subject: [PATCH] setup tox. --- .gitignore | 12 +++++++----- README.md | 2 ++ fluent/handler.py | 6 +++++- setup.py | 9 +++++++-- tox.ini | 12 ++++++++++++ 5 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore index 94f51e2..921cbbd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,9 @@ .Python -bin/ -include/ -lib/ -share/ -src/ +*.swp +*.swo *.pyc +*.pyo +/*.egg-info +/.tox +/build +/dist diff --git a/README.md b/README.md index c64c71c..d0c9687 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,8 @@ This library is distributed as 'fluent-logger' python package. Please execute th $ pip install fluent-logger +On Python 2.5, you have to install 'simplejson' in addition. + ## Configuration Fluent daemon must be lauched with the following configuration: diff --git a/fluent/handler.py b/fluent/handler.py index 116eb1d..70016e1 100644 --- a/fluent/handler.py +++ b/fluent/handler.py @@ -4,7 +4,11 @@ import msgpack import socket import threading -import json + +try: + import json +except ImportError: + import simplejson as json from fluent import sender diff --git a/setup.py b/setup.py index f7ab407..2e46270 100755 --- a/setup.py +++ b/setup.py @@ -1,8 +1,12 @@ #!/usr/bin/python -from distutils.core import setup from os import path +try: + from setuptools import setup +except ImportError: + from distutils.core import setup + README = path.abspath(path.join(path.dirname(__file__), 'README.md')) desc = 'A Python logging handler for Fluentd event collector' @@ -24,5 +28,6 @@ 'Programming Language :: Python :: 3', 'Development Status :: 4 - Beta', 'Intended Audience :: Developers', - ] + ], + test_suite='tests' ) diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..715920d --- /dev/null +++ b/tox.ini @@ -0,0 +1,12 @@ +[tox] +envlist = py25, py26, py27 + +[testenv] +commands=python setup.py test + +[testenv:py25] +deps = simplejson + +[testenv:py26] + +[testenv:py27]