def make_dirs(dir, owner=None, config=None): if config and config.install_prefix: dir = config.install_prefix + dir if type(owner) in (unicode, str): owner = user_lookup(owner) if not os.path.exists(dir): par_dir = os.path.dirname(dir) make_dirs(par_dir, owner) os.mkdir(dir, 0755) if owner is not None: chown(dir, owner)
def install(config, **kwargs): args = args_with_defaults(kwargs, config, ('target', 'base', 'files', 'owner', 'mode', 'include', 'exclude', 'filter'), conf_prefix='install_') if type(args.files) in (str, unicode): args.files = [args.files] if isinstance(args.filter, Filter): args.filter = [args.filter] if config.install_prefix: args.target = config.install_prefix + args.target args.verbose = getattr(config, 'install_verbose') args.filename_filter = FilenameFilter(args.include, args.exclude) if args.base: args.base = normjoin(config.base_dir, args.base) else: args.base = config.base_dir args.owner = user_lookup(args.owner) for pat in args.files: print 'installing %s to %s' % (normjoin(args.base, pat), args.target) for src in glob(args.base, pat): recursive_copy(args, src)
def install(config, **kwargs): args = args_with_defaults(kwargs, config, ('target', 'base', 'files', 'owner', 'mode', 'include', 'exclude', 'filter'), conf_prefix = 'install_') if type(args.files) in (str, unicode): args.files = [args.files] if isinstance(args.filter, Filter): args.filter = [args.filter] if config.install_prefix: args.target = config.install_prefix + args.target args.verbose = getattr(config, 'install_verbose') args.filename_filter = FilenameFilter(args.include, args.exclude) if args.base: args.base = normjoin(config.base_dir, args.base) else: args.base = config.base_dir args.owner = user_lookup(args.owner) for pat in args.files: print 'installing %s to %s' % (normjoin(args.base, pat), args.target) for src in glob(args.base, pat): recursive_copy(args, src)
def chown(filename, owner): if type(owner) in (unicode, str): owner = user_lookup(owner) os.chown(filename, *owner)