Example #1
0
def pull_subs(path):

    subs = fsquery.makecontentlist(path, True, False, False, True, False, None)
    subs = filter_sub_files(subs)

    report = []
    anyfailed = False

    for s in subs:

        rs = git_repo_query.get_remotes(s)
        bs = git_repo_query.get_branches(s)

        af, r = git_pull.do_pull(s, rs, bs)
        anyfailed |= af
        report += r

    print(os.linesep)
    for rp in report:
        print(rp)
    print(os.linesep)

    if anyfailed:
        print("%sErrors detected, see above.%s" % (terminal_colors.TTY_RED, terminal_colors.TTY_WHITE))
    else:
        print("%sAll succeeded.%s" % (terminal_colors.TTY_GREEN, terminal_colors.TTY_WHITE))
Example #2
0
def check_tabs(path, rem_exts, rem_roots, rem_files):

    files = fsquery.makecontentlist(path, True, True, False, False, False, None)
    files = filter_tabs(files, rem_exts, rem_roots, rem_files)

    bad_files = []

    for f in files:
        if detect_tabs(f):
            bad_files.append(f)

    if len(bad_files) > 0:
        print("BAD FILES - TABS:")
        for f in bad_files:
            print(f)
Example #3
0
def make_repo_list(path):

    """ make_repo_list
    returns a list of git repositories found in the given base path
    """

    if path is None:
        return None

    ret_list = fsquery.makecontentlist(path, True, False, True, False, True, [])
    ret_list = filter_git_only(ret_list)
    ret_list = pluck_dotgit(ret_list)
    if len(ret_list) > 0:
        return ret_list
    else:
        return None
Example #4
0
def check_auth_envvar():

    MVAUTH = ""
    try:
        MVAUTH = os.environ['MVAUTH']
    except KeyError:
        print_error("MVAUTH is not defined. Aborting.")
        return False

    if not os.path.exists(MVAUTH):
        print_error("MVAUTH points to nonexistent path.")
        return False

    files_probe = fsquery.makecontentlist(MVAUTH, True, True, True, True, True, "")

    result = True
    for f in files_probe:
        if not check_permission(f):
            print_error("%s has bad permissions." % f)
            result = False

    return result
        track_found = track_found.replace("&", "&") # clementine stuff.
        tracks.append(track_found)

        ls = le # advance to the next location

    return tracks

def proc(plfile):
    tracks = convert_clementine_playlist_to_python_list(plfile)
    i=0
    for t in tracks:
        i+=1
        if not os.path.exists(t):
            print("(index %s): %s of playlist %s does not exist!" % (i, os.path.basename(t), os.path.basename(plfile)))
    print("\n")

if __name__ == "__main__":
    if len(sys.argv) < 2:
        puaq()

    path_playlists = os.path.abspath(sys.argv[1])
    if not os.path.exists(path_playlists):
        print("%s does not exist." % path_playlists)
        sys.exit(1)
    
    playlists = fsquery.makecontentlist(path_playlists, False, True, False, False, False, "xspf")
    for p in playlists:
        print("Processing %s..." % p)
        proc(p)
 
Example #6
0
        sys.exit(2)
 
    if len(sys.argv) > 4:
        # optional passphrase also specified
        passphrase = sys.argv[4]
    else:
        # optional passphrase not specified. lets read it from console interactively
        passphrase = getpass.getpass("Type in...\n")

   
    path_temp_used = os.path.join(path_temp_base, os.path.basename(__file__) + "_temp_DELETE_ME_NOW")
    path_utils.scratchfolder(path_temp_used)

    ext_list_aux = []
    ext_list_aux.append(extension)
    filelist = fsquery.makecontentlist(path_files, True, True, False, True, False, ext_list_aux)

    report = []
    for f in filelist:
        if not decrypt.symmetric_decrypt(f, os.path.join(path_temp_used, os.path.basename(f) + ".tmp"), passphrase):
            report.append(f + " FAILED")

    print("\nWill print the report...:")
    for r in report:
        print(r)
    if len(report) == 0:
        print("All passed!")
    else:
        print("\nThere were %s errors." % len(report))

    try:
Example #7
0
#!/usr/bin/env python

# this is Filtered AG (silversearcher)

import os
import sys
import fsquery
from subprocess import check_output

if __name__ == "__main__":
    if len(sys.argv) < 4:
        print("Usage: %s path search extensions " % os.path.basename(__file__))
        sys.exit(1)
    ret = fsquery.makecontentlist(sys.argv[1], True, True, False, False, False, sys.argv[3:])
    for r in ret:
        try:
            out = check_output(["ag", sys.argv[2], r])
        except OSError as oe:
            print("Failed calling ag. Make sure silversearcher-ag is installed.")
            exit(1)
        if not len(out):
            continue
        print("\033[94m%s" % r)
        print("\033[0m%s" % out)