Browse Source

Basic framework for a proper python package

git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@9267 ddd99763-3ecb-0310-9145-efcb8ce7c51f
tags/bxinterval-last
Jim Paris 11 years ago
parent
commit
5844afed0b
8 changed files with 86 additions and 0 deletions
  1. +20
    -0
      README
  2. +26
    -0
      bin/nilm-test.py
  3. +10
    -0
      setup.py
  4. +3
    -0
      src/nilmdb/__init__.py
  5. BIN
      src/nilmdb/__init__.pyc
  6. +15
    -0
      src/nilmdb/interval.py
  7. BIN
      src/nilmdb/interval.pyc
  8. +12
    -0
      todo.txt

+ 20
- 0
README View File

@@ -0,0 +1,20 @@
To install,


"python setup.py install"

"sudo" might be needed because this script installs the nerdconfig and intelhex
packages to the system package directory. It also installs "nerdconfig.py" to
the python scripts binary directory. On some systems this is not in the
system path, so adding it might be necessary.

For the most part, typing "nerdconfig.py" after installation should work.
Typing nerdconfig.py --help should give a description of the various options.

A CSV file will maintain a master directory of all used unique identifiers.
This package interfaces with command line Subversion to maintain a master list
of serial numbers. Presently the Subversion feature is disabled by default.
The code remains in case it is desired. It will need updating to point to
wherever the appropriate SVN repository is located.


+ 26
- 0
bin/nilm-test.py View File

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

from nilmdb import Interval
from optparse import OptionParser
import sys

version = "1.0"

parser = OptionParser()
parser.add_option("-d", "--db", dest="database", metavar="DATABASE",
help="location of sqlite database")
parser.add_option("-V", "--version", dest="version", default=False, action="store_true",
help="print version then exit")

(options, args) = parser.parse_args()

if (options.version):
print "This script version: " + version
sys.exit(0)

if options.database is None:
print "Error: database is mandatory"
sys.exit(1)

print "Database is " + options.database


+ 10
- 0
setup.py View File

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

from distutils.core import setup

setup(name = 'foo',
version = '1.0',
scripts = [ 'bin/nilm-test.py' ],
packages = [ 'nilmdb' ],
package_dir = { 'nilmdb' : 'src/nilmdb' }
)

+ 3
- 0
src/nilmdb/__init__.py View File

@@ -0,0 +1,3 @@
from interval import Interval

del interval

BIN
src/nilmdb/__init__.pyc View File


+ 15
- 0
src/nilmdb/interval.py View File

@@ -0,0 +1,15 @@
import datetime

class Interval(object):
"""Represents an interval of time"""

def __init__(self, start, end):
self.start = start
self.end = end

def __getattr__(self, name):
return { }

def __setattr__(self, name):
raise Exception("__setattr__ " + name + "called")

BIN
src/nilmdb/interval.pyc View File


+ 12
- 0
todo.txt View File

@@ -0,0 +1,12 @@
Interval management
- Define an interval type
- Define a set of intervals
- Return an optimal intersection of two sets of intervals

Database
- Store/retrieve intervals in databsae
- Basic "add interval" "remove interval" type operations
- Return all intervals that overlap with a supplied interval




Loading…
Cancel
Save