Browse Source

Convert nilmtool.py into a setuptools-generated script

At install time, the script "/usr/bin/nilmtool" will be created.
tags/nilmdb-1.0
Jim Paris 9 years ago
parent
commit
f01e781469
5 changed files with 17 additions and 9 deletions
  1. +5
    -0
      README.txt
  2. +1
    -1
      nilmdb/cmdline/__init__.py
  3. +6
    -2
      nilmdb/cmdline/cmdline.py
  4. +0
    -6
      nilmtool.py
  5. +5
    -0
      setup.py

+ 5
- 0
README.txt View File

@@ -8,3 +8,8 @@ Prerequisites:
Install:

python setup.py install

Usage:

nilmdb-server --help
nilmtool --help

+ 1
- 1
nilmdb/cmdline/__init__.py View File

@@ -1,3 +1,3 @@
"""nilmdb.cmdline"""

from nilmdb.cmdline.cmdline import Cmdline
from nilmdb.cmdline.cmdline import Cmdline, main

+ 6
- 2
nilmdb/cmdline/cmdline.py View File

@@ -28,8 +28,8 @@ class JimArgumentParser(argparse.ArgumentParser):

class Cmdline(object):

def __init__(self, argv):
self.argv = argv
def __init__(self, argv = None):
self.argv = argv or sys.argv[1:]
self.client = None

def arg_time(self, toparse):
@@ -154,3 +154,7 @@ class Cmdline(object):

self.client.close()
sys.exit(retval)

# Entry point for the "nilmtool" script
def main(): # pragma: no cover
nilmdb.cmdline.Cmdline().run()

+ 0
- 6
nilmtool.py View File

@@ -1,6 +0,0 @@
#!/usr/bin/python

import nilmdb
import sys

nilmdb.cmdline.Cmdline(sys.argv[1:]).run()

+ 5
- 0
setup.py View File

@@ -44,6 +44,11 @@ setup(name='nilmdb',
'nilmdb.client',
'nilmdb.cmdline',
],
entry_points = {
'console_scripts': [
'nilmtool = nilmdb.cmdline:main',
],
},
ext_modules = cython_modules,
zip_safe = False,
)

Loading…
Cancel
Save