Skip to content

Commit c8a2315

Browse files
committed
Merge pull request #17 from thijsdezoete/dev/versioning
Fix pypi packaging
2 parents bf3df99 + 054d83a commit c8a2315

File tree

6 files changed

+39
-11
lines changed

6 files changed

+39
-11
lines changed

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ language: python
44

55
python:
66
- "2.7"
7-
- "2.6"
8-
- "pypy"
7+
# - "2.6" we're using argparse which isn't compatible with py2.6
8+
# - "pypy" also not there for pypy apparently..
99

1010
# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
1111
install: pip install -r requirements.txt
1212

1313
# command to run tests, e.g. python setup.py test
14-
script: python setup.py test
14+
script: python setup.py test

HISTORY.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
History
44
-------
55

6+
0.1.1 (2013-08-30)
7+
++++++++++++++++++
8+
9+
* Preparing package for sdist releases
10+
611
0.1.0 (2013-08-30)
712
++++++++++++++++++
813

9-
* First release on PyPI.
14+
* First release on PyPI.

MANIFEST.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ include AUTHORS.rst
22
include CONTRIBUTING.rst
33
include HISTORY.rst
44
include LICENSE
5-
include README.rst
5+
include README.rst
6+
include mysql_statsd/preprocessors/*

mysql_statsd/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33

44
__author__ = 'Jasper Capel'
55
__email__ = '[email protected]'
6-
__version__ = '0.1.0'
6+
__version__ = '0.1.1'
7+
from mysql_statsd import MysqlStatsd

mysql_statsd/mysql_statsd.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,24 @@ class MysqlStatsd():
2323
def __init__(self):
2424
"""Program entry point"""
2525
op = argparse.ArgumentParser()
26-
op.add_argument("-c", "--config", dest="file", default="/etc/mysql-statsd.conf", help="Configuration file")
26+
op.add_argument("-c", "--config", dest="cfile", default="/etc/mysql-statsd.conf", help="Configuration file")
2727
op.add_argument("-d", "--debug", dest="debug", help="Debug mode", default=False, action="store_true")
2828

2929
# TODO switch the default to True, and make it fork by default in init script.
3030
op.add_argument("-f", "--foreground", dest="foreground", help="Dont fork main program", default=False, action="store_true")
3131

3232
opt = op.parse_args()
33-
self.get_config(opt.file)
33+
self.get_config(opt.cfile)
34+
35+
if not self.config:
36+
sys.exit(op.print_help())
37+
38+
try:
39+
logfile = self.config.get('daemon').get('logfile', '/tmp/daemon.log')
40+
except AttributeError:
41+
logfile = sys.stdout
42+
pass
3443

35-
logfile = self.config.get('daemon').get('logfile', '/tmp/daemon.log')
3644
if not opt.foreground:
3745
self.daemonize(stdin='/dev/null', stdout=logfile, stderr=logfile)
3846

@@ -58,7 +66,13 @@ def __init__(self):
5866

5967
def get_config(self, config_file):
6068
cnf = ConfigParser()
61-
cnf.read(config_file)[0]
69+
try:
70+
cnf.read(config_file)[0]
71+
except IndexError:
72+
# Return None so we can display help...
73+
self.config = None # Just to be safe..
74+
return None
75+
6276
self.config = {}
6377
for section in cnf.sections():
6478
self.config[section] = {}

setup.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
setup(
2121
name='mysql-statsd',
22-
version='0.1.0',
22+
version='0.1.1',
2323
description='Daemon that gathers statistics from MySQL and sends them to statsd.',
2424
long_description=readme + '\n\n' + history,
2525
author='Jasper Capel, Thijs de Zoete',
@@ -29,8 +29,15 @@
2929
'mysql_statsd',
3030
],
3131
package_dir={'mysql_statsd': 'mysql_statsd'},
32+
entry_points={
33+
'console_scripts': [
34+
'mysql_statsd = mysql_statsd:mysql_statsd.MysqlStatsd'
35+
]
36+
},
3237
include_package_data=True,
3338
install_requires=[
39+
'MySQL-python==1.2.5',
40+
'pystatsd==0.1.10',
3441
],
3542
license="BSD",
3643
zip_safe=False,

0 commit comments

Comments
 (0)