xenv / xenv /

Eric Larson 0d9bf57 

import os
from paver.easy import path
from subprocess import Popen, call

class XenvFS(object):
    '''The xenv filesystem object provides the specification for the
    xenv filesystem. This will allow finding directories, establishing
    the PATH when calling a command along with locations for specific
    def __init__(self, root=None):
        self.root = path(root or '.')

    def create_base_env(self):
        mk_bin = ['ln', '-s', '/usr/bin',
                  self.root / 'bin']

        (self.root / 'local').mkdir()
        call(['ln', '-s', '/usr/local/bin',
              self.root.abspath() / 'local' / 'bin'])
    def create_venv(self):
        venv = self.root.abspath() / 'usr'
        cmd = 'virtualenv --no-site-packages %s' % venv

    def path(self):
        '''Return the path hiearchy'''
        return ':'.join([
                (self.root / 'usr' / 'bin').abspath(),
                (self.root / 'usr' / 'local' / 'bin').abspath(),
                (self.root / 'bin').abspath(),

class Xenv(object):
    def __init__(self, root=None):
        self.xenv_fs = XenvFS(root)

    def run(self, cmd):
        env = {
            'PATH': self.xenv_fs.path()
        call(cmd, env=env)

    def create(self):

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.