コード例 #1
0
 def pid(self):
     if not os.path.exists(self.__pid_path):
         raise "pid file is not found in %s" % self.__pid_path
     if subprocess.call('ps -p $(<$s)' % self.__pid_path, shell=True) != 0:
         raise "process with pid=%s not found" % commands.get_output('cat %s' % self.__pid_path)
     pid = commands.getoutput('cat %s' % self.__pid_path)
     return pid
コード例 #2
0
 def pid(self):
     if not os.path.exists(self.__pid_path):
         raise "pid file is not found in %s" % self.__pid_path
     if subprocess.call('ps -p $(<$s)' % self.__pid_path, shell=True) != 0:
         raise "process with pid=%s not found" % commands.get_output(
             'cat %s' % self.__pid_path)
     pid = commands.getoutput('cat %s' % self.__pid_path)
     return pid
コード例 #3
0
def get_hg_output(cmd, **kwargs):
    """
    Runs hg with the given arguments and sets HGPLAIN in the environment to
    enforce consistent output.
    Equivalent to:
        env = {}
        env['HGPLAIN'] = '1'
        return get_output(['hg'] + cmd, env=env, **kwargs)
    """
    if 'env' in kwargs:
        env = kwargs['env']
        del kwargs['env']
    else:
        env = {}
    env['HGPLAIN'] = '1'
    return get_output(['hg'] + cmd, env=env, **kwargs)
コード例 #4
0
from commands import getoutput as get_output
import sys

# things installed manually, don't delete plox
EXCEPTIONS = ['mpage', 'vundle']

DRY_RUN = False
if len(sys.argv) > 1 :
    if sys.argv[1] == "-n":
        DRY_RUN = True

vimrc_bundles = get_output("""cat vimrc | grep Bundle | sed '/^"/d' | \
                awk '{print $2}' | sed "s/'//g" """).split('\n')

dir_bundles = get_output("""find bundle/ -maxdepth 1 -type d | sed "s:^bundle/::g" """).split('\n')

if DRY_RUN :
    print "On dry run"

for directory in dir_bundles:
    directory = directory.lower()

    # if the directory (bundle) isn't in vimrc or our exceptions, remove it
    if not any(directory in bundle.lower() for bundle in vimrc_bundles) \
            and not any(directory in exception for exception in EXCEPTIONS):
        command = "rm -rf bundle/%s" % directory
        print command
        if not DRY_RUN:
            get_output(command)