Skip to content

Commit

Permalink
version to 0.11.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Fiers committed Oct 13, 2012
1 parent df7e81e commit 8fc89bc
Show file tree
Hide file tree
Showing 13 changed files with 224 additions and 123 deletions.
29 changes: 27 additions & 2 deletions Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
Moa 0.11.1 / 2012-10-14
==========================

* lots of (pep8) cleanup
* git repositories as templates
* reworked templates/providers
* new moa.cli for all CLI code
* allowing a default title
* fixed a few unittests
* started using pelican for static website generation - in progress
* reworked changelogs & blog messages - now stored in ./doc/*
* better openlava actor
* Not using os.getcwd - prevent dereferencing of symlinks
* uses TTYtter to send tweets
* better autogenerated changelog messages
* writes exec scripts to ./.moa/tmp now - easier to track
* retains title when running moa new
* better plugin structure - distinguish between job & system plugins
* start drawing images of moa workflows
* track versioning
* moved `fileset` code to the core
* moa mv now works
* new argparse structure - better command line interface
* remoteLogger logs to mysql

Moa 0.10.15 / 2012-01-30
==========================

Expand Down Expand Up @@ -87,7 +112,7 @@ Moa 0.10.10 / 2011-05-10
==========================

* jinja2 version of the ncbi template
* recursively defined variables are adapted if they appear to be
* recursively defined variables are adapted if they appear to be
a relative path
* rearranged plugin management
* many small fixes improving recursive & multithreaded operation
Expand Down Expand Up @@ -125,7 +150,7 @@ Moa 0.10.7 / 2011-04-27

* fixed a bug confusing the ~/.moa config dir with a proper moa job

Moa 0.10.6 / 2011-04-27
Moa 0.10.6 / 2011-04-27
=======================

* debian pacakaging is deprecated
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.11.0
0.11.1
3 changes: 2 additions & 1 deletion bin/moa_template_setup
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ def process_dir():
else:
print "README.md exists - use '-f' to overwrite"

os.system('git add README.md COPYING')
os.system('git add -f README.md COPYING')
os.system('git add -f template *.jinja2')

print "possible commands that might need to be executed"
print "writing README.md"
Expand Down
43 changes: 22 additions & 21 deletions lib/python/Yaco/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
>>> x = Yaco()
>>> x.a.b.c.d = 1
>>> assert(x.a.b.c.d == 1)
works - `a`, `b` and `c` are assumed to be `Yaco` dictionaries and d
is give value `1`. This makes populating data structures easy.
Expand Down Expand Up @@ -67,6 +67,7 @@
import yaml
import pprint


class Yaco(dict):
"""
Rather loosely based on http://code.activestate.com/recipes/473786/ (r1)
Expand All @@ -78,13 +79,13 @@ class Yaco(dict):
>>> v= Yaco({'a':1})
>>> assert(v.a == 1)
>>> assert(v['a'] == 1)
"""

def __init__(self, data={}):
"""
Constructor
:param data: data to initialize the Yaco structure with
:type data: dict
"""
Expand All @@ -96,7 +97,7 @@ def __init__(self, data={}):
def __str__(self):
"""
Map the structure to a string
>>> v= Yaco({'a':1})
>>> assert(str(v.a) == '1')
"""
Expand All @@ -105,7 +106,7 @@ def __str__(self):
def __setattr__(self, key, value):
"""
Set the value of a key
>>> v= Yaco()
>>> v.a = 18
>>> assert(v.a == 18)
Expand All @@ -114,7 +115,7 @@ def __setattr__(self, key, value):
>>> assert(v.a == 72)
>>> v.a = {'b' : 5}
>>> assert(v.a.b == 5)
>>> assert(v.a.b == 5)
>>> v.a = {'c' : {'d' : 19}}
>>> assert(v.a.b == 5)
Expand Down Expand Up @@ -152,15 +153,15 @@ def __setattr__(self, key, value):
super(Yaco, self).__setitem__(key, new_value)
else:
super(Yaco, self).__setitem__(key, value)

def has_key(self, key):
rv = super(Yaco, self).has_key(key)
return rv

def __getattr__(self, key):
"""
>>> v= Yaco()
>>> v.a = 18
>>> v.a = 18
>>> assert(v.a == 18)
>>> assert(isinstance(v.a, int))
"""
Expand All @@ -173,7 +174,7 @@ def __getattr__(self, key):
rv = Yaco()
super(Yaco, self).__setitem__(key, rv)
return rv

def __delitem__(self, name):
return super(Yaco, self).__delitem__(name)

Expand All @@ -182,7 +183,7 @@ def simple(self):
"""
return a simplified representation of this
Yaco struct - remove Yaco from the equation - and
all object reference. Leave only bool, float, str,
all object reference. Leave only bool, float, str,
lists, tuples and dicts
>>> x = Yaco()
Expand All @@ -208,7 +209,7 @@ def _returnSimple(item):
return str(item)

return _returnSimple(self)

def _list_parser(self, old_list):
"""
Recursively parse a list & replace all dicts with Yaco objects
Expand All @@ -231,7 +232,7 @@ def update(self, data):
>>> assert(v.a[3][1].b == 12)
"""
if not data: return
if not data: return
for key, value in data.items():
#if isinstance(value, Yaco):
# raise Exception("Wow - updating with a Yaco - "+
Expand All @@ -244,7 +245,7 @@ def update(self, data):
else:
super(Yaco, self).__setitem__(key, Yaco(value))
elif isinstance(value, list):
#parse the list to see if there are dicts - which need to be translated to Yaco objects
#parse the list to see if there are dicts - which need to be translated to Yaco objects
new_value = self._list_parser(value)
super(Yaco, self).__setitem__(key, new_value)
else:
Expand All @@ -256,7 +257,7 @@ def update(self, data):
def copy(self):
ch = Yaco(self)
return ch

def load(self, from_file):
"""
Load this dict from_file
Expand All @@ -280,7 +281,7 @@ def pretty(self):
Return data as a pprint.pformatted string
"""
return pprint.pformat(self.get_data())

def get_data(self):
"""
Prepare & parse data for export
Expand All @@ -299,7 +300,7 @@ def get_data(self):
>>> assert(d.has_key('a') == True)
>>> assert(d.has_key('b') == False)
>>> assert(d.has_key('_c') == False)
"""
data = {}
_priv = self.get('_private', [])
Expand All @@ -313,17 +314,17 @@ def get_data(self):
val = val.get_data()
data[k] = val
return data

def save(self, to_file, doNotSave=[]):
"""
"""
"""
with open(to_file, 'w') as F:
data = self.get_data()
for k in data.keys():
if k in doNotSave:
del data[k]

F.write(yaml.dump(data, default_flow_style=False))

if __name__ == "__main__":
Expand Down
18 changes: 10 additions & 8 deletions lib/python/moa/resources.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env python
# Copyright 2009-2011 Mark Fiers
# The New Zealand Institute for Plant & Food Research
#
#
# This file is part of Moa - http://github.com/mfiers/Moa
#
#
# Licensed under the GPL license (see 'COPYING')
#
#
"""
moa.resources
-------------
Expand All @@ -25,8 +25,9 @@ def resourceExists(what):
__name__, os.path.join('..', what)) \
or \
pkg_resources.resource_exists(
__name__, os.path.join('..', '..', '..', what))

__name__, os.path.join('..', '..', '..', what))


def getResource(what):
"""
Gets a data file from the moa package.
Expand All @@ -35,20 +36,21 @@ def getResource(what):
either three dirs up, or only one. This depends on if this a
pypi (one dir up) package or the git package (three dirs up)
"""

try:
res = pkg_resources.resource_string(__name__, os.path.join('..', what))
except IOError:
#this is the git-package structure - bit inconvenient really
#this seems to be the package structure - bit inconvenient really
res = pkg_resources.resource_string(
__name__, os.path.join('..','..','..', what))
return res


def listResource(what):
"""
List a directory
"""

if pkg_resources.resource_isdir(__name__, os.path.join('..', what)):
what = os.path.join('..', what)
else:
Expand Down
30 changes: 17 additions & 13 deletions lib/python/moa/sysConf.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Copyright 2009-2011 Mark Fiers
# The New Zealand Institute for Plant & Food Research
#
#
# This file is part of Moa - http://github.com/mfiers/Moa
#
#
# Licensed under the GPL license (see 'COPYING')
#
#
"""
moa.sysConf
-----------
Expand All @@ -16,42 +16,46 @@
import os

import Yaco

import moa.logger as l
import moa.resources
import moa.plugin

sysConf = None

USERCONFIGFILE = os.path.join(os.path.expanduser('~'),
'.config', 'moa', 'config')
'.config', 'moa', 'config')


class SysConf(Yaco.Yaco):


def __init__(self):

super(SysConf, self).__init__(moa.resources.getResource('etc/config'))

if os.path.exists('/etc/moa/config'):
with open('/etc/moa/config') as F:
super(SysConf, self).__init__(F.read())
else:
#try the local package
super(SysConf, self).__init__(
moa.resources.getResource('etc/config'))

l.debug("Loading system config: %s" % USERCONFIGFILE)
if os.path.exists(USERCONFIGFILE):
self.load(USERCONFIGFILE)

#assign a runId
runid = '.moa/last_run_id'
if os.path.exists(runid):
lri = open(runid).read().strip()
else:
lri = 1



def getVersion(self):
"""
Return the version number of this Moa instance
"""
return moa.resources.getResource('VERSION').strip()


if sysConf == None:

if sysConf is None:
sysConf = SysConf()
12 changes: 0 additions & 12 deletions lib/ruff/snippets.jinja2

This file was deleted.

0 comments on commit 8fc89bc

Please sign in to comment.