# Path: moa/sysConf.py
# USERCONFIGFILE = os.path.join(os.path.expanduser('~'),
#                               '.config', 'moa', 'config')
# SYSCONFIGFILE = os.path.join('etc', 'moa', 'config')
# def _interpret_var(v):
#     def __init__(self):
#     def getUser(self):
#     def saveUser(self, conf):
#     def getVersion(self):
# class SysConf(Yaco.Yaco):


import glob
import os
import re
import shutil
import sys
import tarfile
import moa.args
import moa.logger
import moa.ui
from moa.sysConf import sysConf
@moa.args.command
def archive(job, args):
    """
    Archive a job, or tree with jobs for later reuse.

    This command stores only those files that are necessary for
    execution of this job, that is: templates & configuration. In &
    output files, and any other file are ignored. An exception to this
    are all files that start with 'moa. If the `name` is omitted, it
    is derived from the `jobid` parameter.

    It is possible to run this command recursively with the `-r`
    parameter - in which case all (moa job containing) subdirectories
    are included in the archive.
    """

    if args.name:
        archiveName = args.name
    else:
        archiveName = job.conf.get('jobid', None)
        if archiveName is None:
            moa.ui.exitError('When not in a moa job, you must define an ' +
                             'archive name')

    if args.template:
        if ('/' in archiveName):
            moa.ui.exitError(
                "You can not specify a path when using --template")

        archivePath = os.path.abspath(os.path.expanduser(

# Path: moa/sysConf.py
# USERCONFIGFILE = os.path.join(os.path.expanduser('~'),
#                               '.config', 'moa', 'config')
# SYSCONFIGFILE = os.path.join('etc', 'moa', 'config')
# def _interpret_var(v):
#     def __init__(self):
#     def getUser(self):
#     def saveUser(self, conf):
#     def getVersion(self):
# class SysConf(Yaco.Yaco):


# Path: moa/plugin/system/moautil.py
import glob
import os
import re
import shutil
import sys
import tarfile
import moa.args
import moa.logger
import moa.ui
from moa.sysConf import sysConf

@moa.args.command
def archive(job, args):
    """
    Archive a job, or tree with jobs for later reuse.

    This command stores only those files that are necessary for
    execution of this job, that is: templates & configuration. In &
    output files, and any other file are ignored. An exception to this
    are all files that start with 'moa. If the `name` is omitted, it
    is derived from the `jobid` parameter.

    It is possible to run this command recursively with the `-r`
    parameter - in which case all (moa job containing) subdirectories
    are included in the archive.
    """

    if args.name:
        archiveName = args.name
    else:
        archiveName = job.conf.get('jobid', None)
        if archiveName is None:
            moa.ui.exitError('When not in a moa job, you must define an ' +
                             'archive name')

    if args.template:
        if ('/' in archiveName):
            moa.ui.exitError(
                "You can not specify a path when using --template")

        archivePath = os.path.abspath(os.path.expanduser(

            sysConf.plugins.moautil.get('dir', '~/.config/moa/archive')))