xenv / xenv /

This defines the main 'xe' entry point to the xenv. Below, the parser
definition describes the usage and UI for interacting with an xenv.
import os
import sys

from argparse import ArgumentParser
from xenv.models import Xenv, Package

def with_root(f):
    def wrap(args):
        xenv = Xenv(root=args.root)
        f(xenv, args)
    return wrap

def run_cmd(xenv, args):

def create_xenv_cmd(xenv, args):

def install_package_cmd(xenv, args):
    pkg = Package(, args.version, args.repo)

def uninstall_package_cmd(xenv, args):
    pkg = Package(, args.version)

class CLI(object):
    description = '''Utilize a specific executable environment (xenv) for running applications'''

    def __init__(self):
        self.parser = ArgumentParser(description=self.description)
        self.parser.add_argument('--root', '-r',
                                 help='Override the XE_ROOT env var.')

        self.subs = self.parser.add_subparsers(help='sub command help')

        # Create a new xenv
        create = self.subs.add_parser('create', help='Create a new xenv')
        create.add_argument('root', help='The root of the xenv')

        # run a command via the xenv
        run = self.subs.add_parser('run', prefix_chars='!',
                                   help='Run a command from the xenv')
        run.add_argument('cmd', type=str, nargs='*', action='append',
                         help='The command and flags to run via the xenv')

        # install a package
        install_pkg = self.subs.add_parser('install',
                                           help='Install a package in an xenv')
        install_pkg.add_argument('name', help='The package to install')
        install_pkg.add_argument('version', help='The version to install')
        install_pkg.add_argument('--repo', '-b', default='file://',
                         help='The base URL of the package. \
                               The default is the current directory')

        # uninstall a package
        uninstall_pkg = self.subs.add_parser('uninstall',
                                             help='Uninstall a package')
        uninstall_pkg.add_argument('name', help='The package to uninstall')
        uninstall_pkg.add_argument('version', help='The version to uninstall')

    def run(self, args=None):
        if args:
            return self.parser.parse_args(args)
        return self.parser.parse_known_args()

def _run(args):
    if args.root:
        args.root = os.path.abspath(args.root)
    if args.func:

def xe():
    cli = CLI()
    args, extras =

def xepython():
    cli = CLI()
    cargs = ['run', 'python']
    if len(sys.argv) > 1:
    args =