mana-core-pyjobtransformscore / share /

#!/usr/bin/env python
# usage: expand_files [options] [files] [options] [files]
# Return a list of filenames with the package name prepended
# Files will be collected from source dirs, and prepended with the
# destination dir.
# Options:
# -r=<rootdir>: Root directory of the package. Is used to search for the
#           files in the correct package.
# -s=<srcdir>: Default source directory. Will be used if no directory is
#          specified before a filename. This option can be inserted
#          in between the filenames.
# -d=<destdir>: destination directory. Will be prepended to each filename.
#          Can be inserted in between the filenames. The last one before
#          a filename will be used.
import sys,os,glob
srcdir = os.curdir
destdir = ''
for args in sys.argv[1:]:
    for arg in args.split():
        if arg.startswith('-s='):
            # get a new default directory
        elif arg.startswith('-d='):
        elif arg.startswith('-r='):
            argdir = os.path.dirname(arg)
            if not argdir: argdir = srcdir
            argname = os.path.basename(arg)
            fullpath = os.path.normpath( os.path.join( rootdir,'cmt',argdir,argname) )
            filelist = glob.glob( fullpath )
            files += [ os.path.join(destdir,os.path.basename(f)) \
                       for f in filelist ]

if files:
    print ' '.join( files )
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.