Skip to content

Commit

Permalink
Revert "Merge remote-tracking branch 'origin/master'"
Browse files Browse the repository at this point in the history
This reverts commit b9da9c7, reversing
changes made to 9201b28.
  • Loading branch information
eth0izzle committed Nov 25, 2017
1 parent b9da9c7 commit 39e94f6
Show file tree
Hide file tree
Showing 13 changed files with 10 additions and 56 deletions.
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@
.idea
.virtualenv
__pycache__
*.egg-info
dist/
build/
*.pyc
*.pyc
1 change: 0 additions & 1 deletion MANIFEST.in

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 7 additions & 11 deletions needl/main.py → needl.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import os, sys, time, argparse, logging
import daemon, daemon.pidfile
import needl, needl.tasks as scheduler
import pkg_resources


DEFAULT_DATADIR = pkg_resources.resource_filename('needl', 'data')
DEFAULT_CONFFILE = pkg_resources.resource_filename('needl', 'data/settings.yaml')

def main():
parser = argparse.ArgumentParser(description=needl.__description__)
parser.add_argument('--datadir', default=DEFAULT_DATADIR, help='Data directory')
parser.add_argument('--config', default=DEFAULT_CONFFILE, help='Configuration file path')
parser.add_argument('--datadir', default=os.getcwd() + '/data', help='Data directory')
parser.add_argument('-d', '--daemon', action='store_true', help='Run as a deamon')
parser.add_argument('-v', '--verbose', action='store_true', help='Increase logging')
parser.add_argument('--logfile', type=argparse.FileType('a'), default=sys.stdout, help='Log to this file. Default is stdout.')
Expand All @@ -21,10 +16,7 @@ def main():
args.logfile = open('/tmp/needl.log', 'a')

needl.init(args)
if args.daemon:
daemonize(args.logfile, args.pidfile)
else:
start()
daemonize(args.logfile, args.pidfile) if args.daemon else start()


def daemonize(logfile, pidfile):
Expand All @@ -33,7 +25,7 @@ def daemonize(logfile, pidfile):
with daemon.DaemonContext(working_directory=os.getcwd(),
stderr=logfile,
umask=0o002,
pidfile=daemon.pidfile.PIDLockFile(pidfile)):
pidfile=daemon.pidfile.PIDLockFile(pidfile)) as dc:

start()

Expand Down Expand Up @@ -63,3 +55,7 @@ def stop():

logging.shutdown()
sys.exit()


if __name__ == "__main__":
main()
4 changes: 2 additions & 2 deletions needl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ def init(_args):
global settings, args
args = _args

with open(args.config) as f:
with open(args.datadir + '/settings.yaml', 'r') as f:
settings = yaml.load(f)

logging.basicConfig(stream=args.logfile,
level=logging.DEBUG if args.verbose else logging.INFO,
format='(%(levelname)s) [%(module)s->%(funcName)s]: %(message)s')
format='(%(levelname)s) [%(module)s->%(funcName)s]: %(message)s')
38 changes: 0 additions & 38 deletions setup.py

This file was deleted.

0 comments on commit 39e94f6

Please sign in to comment.