#!/usr/bin/env python
from setuptools import setup
setup(
  name = 'cs.fstags',
  author = 'Cameron Simpson',
  author_email = 'cs@cskk.id.au',
  version = '20220311',
  url = 'https://bitbucket.org/cameron_simpson/css/commits/all',
  description =
    ('Simple filesystem based file tagging and the associated `fstags` command '    
 'line script.'),
  long_description =
    ('Simple filesystem based file tagging\n'    
 'and the associated `fstags` command line script.\n'    
 '\n'    
 '*Latest release 20220311*:\n'    
 '* New TaggedPath.infer_tags() method to compute and return the inferred '    
 'TagSet.\n'    
 '* New "fstags infer pathname" command.\n'    
 '\n'    
 'Many basic tasks can be performed with the `fstags` command line utility,\n'    
 'documented under the `FSTagsCommand` class below.\n'    
 '\n'    
 'Why `fstags`?\n'    
 'By storing the tags in a separate file we:\n'    
 '* can store tags without modifying a file\n'    
 "* do not need to know the file's format,\n"    
 '  or even whether that format supports metadata\n'    
 '* can process tags on any kind of file\n'    
 '* because tags are inherited from parent directories,\n'    
 '  tags can be automatically acquired merely by arranging your file tree\n'    
 '\n'    
 'Tags are stored in the file `.fstags` in each directory;\n'    
 'there is a line for each entry in the directory\n'    
 'consisting of the directory entry name and the associated tags.\n'    
 '\n'    
 'Tags may be "bare", or have a value.\n'    
 "If there is a value it is expressed with an equals (`'='`)\n"    
 'followed by the JSON encoding of the value.\n'    
 '\n'    
 'The tags for a file are the union of its direct tags\n'    
 'and all relevant ancestor tags,\n'    
 'with priority given to tags closer to the file.\n'    
 '\n'    
 'For example, a media file for a television episode with the pathname\n'    
 '`/path/to/series-name/season-02/episode-name--s02e03--something.mp4`\n'    
 'might have the tags:\n'    
 '\n'    
 '    series_title="Series Full Name"\n'    
 '    season=2\n'    
 '    sf\n'    
 '    episode=3\n'    
 '    episode_title="Full Episode Title"\n'    
 '\n'    
 'obtained from the following `.fstags` entries:\n'    
 '* tag file `/path/to/.fstags`:\n'    
 '\n'    
 '    series-name sf series_title="Series Full Name"\n'    
 '\n'    
 '* tag file `/path/to/series-name/.fstags`:\n'    
 '\n'    
 '  season-02 season=2\n'    
 '\n'    
 '* tag file `/path/to/series-name/season-02/.fstags`:\n'    
 '\n'    
 '  episode-name--s02e03--something.mp4 episode=3 episode_title="Full Episode '    
 'Title"\n'    
 '\n'    
 '## `fstags` Examples ##\n'    
 '\n'    
 '### Backing up a media tree too big for the removable drives ###\n'    
 '\n'    
 'Walk the media tree for files tagged for backup to `archive2`:\n'    
 '\n'    
 '    fstags find /path/to/media backup=archive2\n'    
 '\n'    
 'Walk the media tree for files not assigned to a backup archive:\n'    
 '\n'    
 '    fstags find /path/to/media -backup\n'    
 '\n'    
 'Backup the `archive2` files using `rsync`:\n'    
 '\n'    
 '    fstags find --for-rsync /path/to/media backup=archive2 \\\n'    
 '    | rsync -ia --include-from=- /path/to/media /path/to/backup_archive2\n'    
 '\n'    
 '## Class `CascadeRule`\n'    
 '\n'    
 'A cascade rule of possible source tag names to provide a target tag.\n'    
 '\n'    
 '*Method `CascadeRule.infer_tag(self, *a, **kw)`*:\n'    
 'Apply the rule to the `TagSet` `tagset`.\n'    
 'Return a new `Tag(self.target,value)`\n'    
 'for the first cascade `value` found in `tagset`,\n'    
 'or `None` if there is no match.\n'    
 '\n'    
 '## Class `FSTags(cs.resources.MultiOpenMixin, '    
 'cs.context.ContextManagerMixin)`\n'    
 '\n'    
 'A class to examine filesystem tags.\n'    
 '\n'    
 '*Method `FSTags.__getitem__(self, *a, **kw)`*:\n'    
 'Return the `TaggedPath` for `abspath(path)`.\n'    
 '\n'    
 '*Method `FSTags.apply_tag_choices(self, tag_choices, paths)`*:\n'    
 'Apply the `tag_choices` to `paths`.\n'    
 '\n'    
 'Parameters:\n'    
 '* `tag_choices`:\n'    
 '  an iterable of `Tag` or an equality `TagBasedTest`.\n'    
 '  Each item applies or removes a `Tag`\n'    
 "  from each path's direct tags.\n"    
 '* `paths`:\n'    
 '  an iterable of filesystem paths.\n'    
 '\n'    
 '*Method `FSTags.attach_path(self, attach, srcpath, dstpath, *, force=False, '    
 'crop_ok=False)`*:\n'    
 'Attach `srcpath` to `dstpath` using the `attach` callable.\n'    
 '\n'    
 'Parameters:\n'    
 '* `attach`: callable accepting `attach(srcpath,dstpath)`\n'    
 '  to do the desired attachment,\n'    
 '  such as a copy, link or move\n'    
 '* `srcpath`: the source filesystem object\n'    
 '* `dstpath`: the destination filesystem object\n'    
 '* `crop_ok`: if true and the OS raises `OSError(ENAMETOOLONG)`\n'    
 '  attempt to crop the name before the file extension and retry\n'    
 '* `force`: default `False`.\n'    
 '  If true and the destination exists\n'    
 '  try to remove it before calling `attach`.\n'    
 '  Otherwise if the destination exists\n'    
 '  raise a `ValueError`.\n'    
 '\n'    
 '*Method `FSTags.cascade_tags(self, tags, cascade_rules=None)`*:\n'    
 'Yield `Tag`s\n'    
 'which cascade from the `TagSet` `tags`\n'    
 'via `cascade_rules` (an iterable of `CascadeRules`).\n'    
 '\n'    
 '*Method `FSTags.copy(self, *a, **kw)`*:\n'    
 'Copy `srcpath` to `dstpath`.\n'    
 '\n'    
 '*Method `FSTags.dir_tagfile(self, *a, **kw)`*:\n'    
 'Return the `FSTagsTagFile` associated with `dirpath`.\n'    
 '\n'    
 '*Method `FSTags.edit_dirpath(self, *a, **kw)`*:\n'    
 'Edit the filenames and tags in a directory.\n'    
 '\n'    
 'If `all_names` is true, include names commencing with a dot,\n'    
 'otherwise exclude them.\n'    
 '\n'    
 '*Method `FSTags.export_xattrs(self, paths)`*:\n'    
 'Import the extended attributes of `paths`\n'    
 'and use them to update the fstags.\n'    
 '\n'    
 '*Method `FSTags.find(self, path, tag_tests, use_direct_tags=False, '    
 'U=None)`*:\n'    
 'Walk the file tree from `path`\n'    
 'searching for files matching the supplied `tag_tests`.\n'    
 'Yield the matching file paths.\n'    
 '\n'    
 'Parameters:\n'    
 '* `path`: the top of the file tree to walk\n'    
 '* `tag_tests`: a sequence of `TagBasedTest`s\n'    
 '* `use_direct_tags`: test the direct_tags if true,\n'    
 '  otherwise the all_tags.\n'    
 '  Default: `False`\n'    
 '\n'    
 '*Method `FSTags.find_ontology(self, dirpath, ontbase=None)`*:\n'    
 'Locate an ontology for the directory `dirpath`.\n'    
 'The optional `ontbase` may override the relative path to the file,\n'    
 'default is `self.ontology_filepath`.\n'    
 'Return a `TagOntology` or `None` if not found.\n'    
 '\n'    
 '*Method `FSTags.find_ontpath(self, dirpath, ontbase=None)`*:\n'    
 'Locate an ontology file for the directory `dirpath`.\n'    
 'The optional `ontbase` may override the relative path to the file,\n'    
 'default is `self.ontology_filepath`.\n'    
 'Return the found ontology file or `None` if not found.\n'    
 '\n'    
 '*Method `FSTags.import_xattrs(self, paths)`*:\n'    
 'Update the extended attributes of `paths`\n'    
 'from their fstags.\n'    
 '\n'    
 '*Method `FSTags.link(self, *a, **kw)`*:\n'    
 'Link `srcpath` to `dstpath`.\n'    
 '\n'    
 '*Method `FSTags.move(self, *a, **kw)`*:\n'    
 'Move `srcpath` to `dstpath`.\n'    
 '\n'    
 '*Property `FSTags.ontology`*:\n'    
 'The primary `TagsOntology`, or `None` if `self.ontology_filepath` was '    
 '`None`.\n'    
 '\n'    
 '*Property `FSTags.ontology_filepath`*:\n'    
 'The ontology file basename.\n'    
 '\n'    
 '*Method `FSTags.ontology_for(self, *a, **kw)`*:\n'    
 'Return the `TagsOntology` associated with `path`.\n'    
 'Returns `None` if an ontology cannot be found.\n'    
 '\n'    
 '*Method `FSTags.open_ontology(self, ontpath)`*:\n'    
 'Open the contology file at `ontpath`.\n'    
 '\n'    
 '*Method `FSTags.path_tagfiles(self, filepath)`*:\n'    
 'Generator yielding a sequence of `(FSTagsTagFile,name)` pairs\n'    
 'where `name` is the key within the `FSTagsTagFile`\n'    
 'for the `FSTagsTagFile`s affecting `filepath`\n'    
 'in order from the root to `dirname(filepath)`.\n'    
 '\n'    
 '*Method `FSTags.resolve_format_string(self, *a, **kw)`*:\n'    
 'See if `format_string` looks like `[`*clausename*`]`*entryname*.\n'    
 'if so, return the corresponding config entry string,\n'    
 'otherwise return `format_string` unchanged.\n'    
 '\n'    
 '*Method `FSTags.scrub(self, path)`*:\n'    
 'Scrub tags for names which do not exist in the filesystem.\n'    
 '\n'    
 '*Method `FSTags.shutdown(self)`*:\n'    
 'Save any modified tag files on shutdown.\n'    
 '\n'    
 '*Method `FSTags.startup(self)`*:\n'    
 'Stub for startup.\n'    
 '\n'    
 '*Method `FSTags.sync(self, *a, **kw)`*:\n'    
 'Flush modified tag files.\n'    
 '\n'    
 '*Method `FSTags.tagfile_for(self, filepath)`*:\n'    
 'Return the `FSTagsTagFile` storing the `Tag`s for `filepath`.\n'    
 '\n'    
 '*Property `FSTags.tagsfile_basename`*:\n'    
 'The tag file basename.\n'    
 '\n'    
 '*Method `FSTags.test(self, path, tag_tests, use_direct_tags=False)`*:\n'    
 'Test a path against `tag_tests`.\n'    
 '\n'    
 'Parameters:\n'    
 '* `path`: path to test\n'    
 '* `tag_tests`: an iterable of `TagBasedTest`s\n'    
 '* `use_direct_tags`: test the `direct_tags` if true,\n'    
 '  otherwise the `all_tags`.\n'    
 '  Default: `False`\n'    
 '\n'    
 '## Class `FSTagsCommand(cs.cmdutils.BaseCommand, '    
 'cs.tagset.TagsCommandMixin)`\n'    
 '\n'    
 '`fstags` main command line utility.\n'    
 '\n'    
 'Command line usage:\n'    
 '\n'    
 '    Usage: fstags [-o ontology] subcommand [...]\n'    
 '      -o ontology   Specify the path to an ontology file.\n'    
 '      Subcommands:\n'    
 '        autotag paths...\n'    
 '          Tag paths based on rules from the rc file.\n'    
 '        cp [-finv] srcpath dstpath, cp [-finv] srcpaths... dstdirpath\n'    
 '          POSIX cp(1) equivalent, but also copying tags:\n'    
 '          copy files and their tags into targetdir.\n'    
 '          -f  Force: remove destination if it exists.\n'    
 '          -i  Interactive: fail if the destination exists.\n'    
 '          -n  No remove: fail if the destination exists.\n'    
 '          -v  Verbose: show copied files.\n'    
 '        cptags srcpath dstpath\n'    
 '          Copy the direct tags from srcpath to dstpath.\n'    
 '        edit [-ad] [path]\n'    
 "          Edit the direct tagsets of path, default: '.'\n"    
 '          If path is a directory, provide the tags of its entries.\n'    
 '          Otherwise edit just the tags for path.\n'    
 '          -a    List all names in directory edit mode; normally\n'    
 '                names commencing with a dot are omitted.\n'    
 '          -d    Treat directories like files: edit just its tags.\n'    
 '        export [-a] [--direct] path {tag[=value]|-tag}...\n'    
 '          Export tags for files from path matching all the constraints.\n'    
 '          -a        Export all paths, not just those with tags.\n'    
 '          --direct  Export the direct tags instead of the computed tags.\n'    
 '          The output is in the same CSV format as that from "sqltags '    
 'export",\n'    
 '          with the following columns:\n'    
 "          * unixtime: the file's st_mtime from os.stat.\n"    
 '          * id: empty\n'    
 '          * name: the file path\n'    
 "          * tags: the file's direct or indirect tags\n"    
 '        find [--direct] [--for-rsync] [-o output_format] path '    
 '{tag[=value]|-tag}...\n'    
 '          List files from path matching all the constraints.\n'    
 '          --direct    Use direct tags instead of all tags.\n'    
 '          --for-rsync Instead of listing matching paths, emit a\n'    
 '                      sequence of rsync(1) patterns suitable for use with\n'    
 '                      --include-from in order to do a selective rsync of '    
 'the\n'    
 '                      matched paths.\n'    
 '          -o output_format\n'    
 '                      Use output_format as a Python format string to lay '    
 'out\n'    
 '                      the listing.\n'    
 '                      Default: {filepath}\n'    
 '        help [-l] [subcommand-names...]\n'    
 '          Print the full help for the named subcommands,\n'    
 '          or for all subcommands if no names are specified.\n'    
 '          -l  Long help even if no subcommand-names provided.\n'    
 '        import {-|srcpath}...\n'    
 '          Import CSV data in the format emitted by "export".\n'    
 '          Each argument is a file path or "-", indicating standard input.\n'    
 '        infer pathname\n'    
 '          Print the base and inferred tags for pathname.\n'    
 '        json_import --prefix=tag_prefix {-|path} {-|tags.json}\n'    
 '          Apply JSON data to path.\n'    
 '          A path named "-" indicates that paths should be read from\n'    
 '          the standard input.\n'    
 '          The JSON tag data come from the file "tags.json"; the name\n'    
 '          "-" indicates that the JSON data should be read from the\n'    
 '          standard input.\n'    
 '        ln [-finv] srcpath dstpath, ln [-finv] srcpaths... dstdirpath\n'    
 '          POSIX ln(1) equivalent, but also copying the tags:\n'    
 '          link files and their tags into targetdir.\n'    
 '          -f  Force: remove destination if it exists.\n'    
 '          -i  Interactive: fail if the destination exists.\n'    
 '          -n  No remove: fail if the destination exists.\n'    
 '          -v  Verbose: show linked files.\n'    
 '        ls [-d] [--direct] [-o output_format] [paths...]\n'    
 '          List files from paths and their tags.\n'    
 '          -d          Treat directories like files, do not recurse.\n'    
 '          --direct    List direct tags instead of all tags.\n'    
 '          -l          Long format.\n'    
 '          -o output_format\n'    
 '                      Use output_format as a Python format string to lay '    
 'out\n'    
 '                      the listing.\n'    
 '                      Default: {filepath:json} {tags}\n'    
 '        mv [-finv] srcpath dstpath, mv [-finv] srcpaths... dstdirpath\n'    
 '          POSIX mv(1) equivalent, but also copying the tags:\n'    
 '          move files and their tags into targetdir.\n'    
 '          -f  Force: remove destination if it exists.\n'    
 '          -i  Interactive: fail if the destination exists.\n'    
 '          -n  No remove: fail if the destination exists.\n'    
 '          -v  Verbose: show moved files.\n'    
 '        ns [-d] [--direct] [paths...]\n'    
 '          Report on the available primary namespace fields for formatting.\n'    
 '          Note that because the namespace used for formatting has\n'    
 '          inferred field names there are also unshown secondary field\n'    
 '          names available in format strings.\n'    
 '          -d          Treat directories like files, do not recurse.\n'    
 '          --direct    List direct tags instead of all tags.\n'    
 '        ont [subcommand [args...]]\n'    
 '          With no arguments, print the ontology.\n'    
 '        rename -n newbasename_format paths...\n'    
 '          Rename paths according to a format string.\n'    
 '          -n newbasename_format\n'    
 '              Use newbasename_format as a Python format string to\n'    
 '              compute the new basename for each path.\n'    
 '        scrub paths...\n'    
 '          Remove all tags for missing paths.\n'    
 '          If a path is a directory, scrub the immediate paths in the '    
 'directory.\n'    
 '        tag {-|path} {tag[=value]|-tag}...\n'    
 '          Tag a path with multiple tags.\n'    
 '          With the form "-tag", remove that tag from the direct tags.\n'    
 '          A path named "-" indicates that paths should be read from the\n'    
 '          standard input.\n'    
 '        tagfile tagfile_path [subcommand ...]\n'    
 '          Subcommands:\n'    
 '            tag tagset_name {tag[=value]|-tag}...\n'    
 '              Directly modify tag_name within the tag file tagfile_path.\n'    
 '        tagpaths {tag[=value]|-tag} {-|paths...}\n'    
 '          Tag multiple paths.\n'    
 '          With the form "-tag", remove the tag from the immediate tags.\n'    
 '          A single path named "-" indicates that paths should be read\n'    
 '          from the standard input.\n'    
 '        test [--direct] path {tag[=value]|-tag}...\n'    
 '          Test whether the path matches all the constraints.\n'    
 '          --direct    Use direct tags instead of all tags.\n'    
 '        xattr_export {-|paths...}\n'    
 '          Import tag information from extended attributes.\n'    
 '        xattr_import {-|paths...}\n'    
 '          Update extended attributes from tags.\n'    
 '\n'    
 '*Method `FSTagsCommand.apply_defaults(self)`*:\n'    
 'Set up the default values in `options`.\n'    
 '\n'    
 '*Method `FSTagsCommand.apply_opt(self, opt, val)`*:\n'    
 'Apply command line option.\n'    
 '\n'    
 '*Method `FSTagsCommand.cmd_autotag(self, argv)`*:\n'    
 'Usage: {cmd} paths...\n'    
 'Tag paths based on rules from the rc file.\n'    
 '\n'    
 '*Method `FSTagsCommand.cmd_cp(self, argv)`*:\n'    
 'Usage: {cmd} [-finv] srcpath dstpath, {cmd} [-finv] srcpaths... dstdirpath\n'    
 'POSIX cp(1) equivalent, but also copying tags:\n'    
 'copy files and their tags into targetdir.\n'    
 '-f  Force: remove destination if it exists.\n'    
 '-i  Interactive: fail if the destination exists.\n'    
 '-n  No remove: fail if the destination exists.\n'    
 '-v  Verbose: show copied files.\n'    
 '\n'    
 '*Method `FSTagsCommand.cmd_cptags(self, argv)`*:\n'    
 'Usage: {cmd} srcpath dstpath\n'    
 'Copy the direct tags from srcpath to dstpath.\n'    
 '\n'    
 '*Method `FSTagsCommand.cmd_edit(self, argv)`*:\n'    
 'Usage: {cmd} [-ad] [path]\n'    
 "Edit the direct tagsets of path, default: '.'\n"    
 'If path is a directory, provide the tags of its entries.\n'    
 'Otherwise edit just the tags for path.\n'    
 '-a    List all names in directory edit mode; normally\n'    
 '      names commencing with a dot are omitted.\n'    
 '-d    Treat directories like files: edit just its tags.\n'    
 '\n'    
 '*Method `FSTagsCommand.cmd_export(self, argv)`*:\n'    
 'Usage: {cmd} [-a] [--direct] path {{tag[=value]|-tag}}...\n'    
 'Export tags for files from path matching all the constraints.\n'    
 '-a        Export all paths, not just those with tags.\n'    
 '--direct  Export the direct tags instead of the computed tags.\n'    
 'The output is in the same CSV format as that from "sqltags export",\n'    
 'with the following columns:\n'    
 "* unixtime: the file's st_mtime from os.stat.\n"    
 '* id: empty\n'    
 '* name: the file path\n'    
 "* tags: the file's direct or indirect tags\n"    
 '\n'    
 '*Method `FSTagsCommand.cmd_find(self, argv)`*:\n'    
 'Usage: {cmd} [--direct] [--for-rsync] [-o output_format] path '    
 '{{tag[=value]|-tag}}...\n'    
 'List files from path matching all the constraints.\n'    
 '--direct    Use direct tags instead of all tags.\n'    
 '--for-rsync Instead of listing matching paths, emit a\n'    
 '            sequence of rsync(1) patterns suitable for use with\n'    
 '            --include-from in order to do a selective rsync of the\n'    
 '            matched paths.\n'    
 '-o output_format\n'    
 '            Use output_format as a Python format string to lay out\n'    
 '            the listing.\n'    
 '            Default: {FIND_OUTPUT_FORMAT_DEFAULT}\n'    
 '\n'    
 '*Method `FSTagsCommand.cmd_import(self, argv)`*:\n'    
 'Usage: {cmd} {{-|srcpath}}...\n'    
 'Import CSV data in the format emitted by "export".\n'    
 'Each argument is a file path or "-", indicating standard input.\n'    
 '\n'    
 '*Method `FSTagsCommand.cmd_infer(self, argv)`*:\n'    
 'Usage: {cmd} pathname\n'    
 'Print the base and inferred tags for pathname.\n'    
 '\n'    
 '*Method `FSTagsCommand.cmd_json_import(self, argv)`*:\n'    
 'Usage: json_import --prefix=tag_prefix {{-|path}} {{-|tags.json}}\n'    
 'Apply JSON data to path.\n'    
 'A path named "-" indicates that paths should be read from\n'    
 'the standard input.\n'    
 'The JSON tag data come from the file "tags.json"; the name\n'    
 '"-" indicates that the JSON data should be read from the\n'    
 'standard input.\n'    
 '\n'    
 '*Method `FSTagsCommand.cmd_ln(self, argv)`*:\n'    
 'Usage: {cmd} [-finv] srcpath dstpath, {cmd} [-finv] srcpaths... dstdirpath\n'    
 'POSIX ln(1) equivalent, but also copying the tags:\n'    
 'link files and their tags into targetdir.\n'    
 '-f  Force: remove destination if it exists.\n'    
 '-i  Interactive: fail if the destination exists.\n'    
 '-n  No remove: fail if the destination exists.\n'    
 '-v  Verbose: show linked files.\n'    
 '\n'    
 '*Method `FSTagsCommand.cmd_ls(self, argv)`*:\n'    
 'Usage: {cmd} [-d] [--direct] [-o output_format] [paths...]\n'    
 'List files from paths and their tags.\n'    
 '-d          Treat directories like files, do not recurse.\n'    
 '--direct    List direct tags instead of all tags.\n'    
 '-l          Long format.\n'    
 '-o output_format\n'    
 '            Use output_format as a Python format string to lay out\n'    
 '            the listing.\n'    
 '            Default: {LS_OUTPUT_FORMAT_DEFAULT}\n'    
 '\n'    
 '*Method `FSTagsCommand.cmd_mv(self, argv)`*:\n'    
 'Usage: {cmd} [-finv] srcpath dstpath, {cmd} [-finv] srcpaths... dstdirpath\n'    
 'POSIX mv(1) equivalent, but also copying the tags:\n'    
 'move files and their tags into targetdir.\n'    
 '-f  Force: remove destination if it exists.\n'    
 '-i  Interactive: fail if the destination exists.\n'    
 '-n  No remove: fail if the destination exists.\n'    
 '-v  Verbose: show moved files.\n'    
 '\n'    
 '*Method `FSTagsCommand.cmd_ns(self, argv)`*:\n'    
 'Usage: {cmd} [-d] [--direct] [paths...]\n'    
 'Report on the available primary namespace fields for formatting.\n'    
 'Note that because the namespace used for formatting has\n'    
 'inferred field names there are also unshown secondary field\n'    
 'names available in format strings.\n'    
 '-d          Treat directories like files, do not recurse.\n'    
 '--direct    List direct tags instead of all tags.\n'    
 '\n'    
 '*Method `FSTagsCommand.cmd_ont(self, argv)`*:\n'    
 'Ontology operations.\n'    
 '\n'    
 'Usage: {cmd} [subcommand [args...]]\n'    
 '  With no arguments, print the ontology.\n'    
 '\n'    
 '*Method `FSTagsCommand.cmd_rename(self, argv)`*:\n'    
 'Usage: {cmd} -n newbasename_format paths...\n'    
 'Rename paths according to a format string.\n'    
 '-n newbasename_format\n'    
 '    Use newbasename_format as a Python format string to\n'    
 '    compute the new basename for each path.\n'    
 '\n'    
 '*Method `FSTagsCommand.cmd_scrub(self, argv)`*:\n'    
 'Usage: {cmd} paths...\n'    
 'Remove all tags for missing paths.\n'    
 'If a path is a directory, scrub the immediate paths in the directory.\n'    
 '\n'    
 '*Method `FSTagsCommand.cmd_tag(self, argv)`*:\n'    
 'Usage: {cmd} {{-|path}} {{tag[=value]|-tag}}...\n'    
 'Tag a path with multiple tags.\n'    
 'With the form "-tag", remove that tag from the direct tags.\n'    
 'A path named "-" indicates that paths should be read from the\n'    
 'standard input.\n'    
 '\n'    
 '*Method `FSTagsCommand.cmd_tagfile(self, argv)`*:\n'    
 'Usage: {cmd} tagfile_path [subcommand ...]\n'    
 'Subcommands:\n'    
 '  tag tagset_name {{tag[=value]|-tag}}...\n'    
 '    Directly modify tag_name within the tag file tagfile_path.\n'    
 '\n'    
 '*Method `FSTagsCommand.cmd_tagpaths(self, argv)`*:\n'    
 'Usage: {cmd} {{tag[=value]|-tag}} {{-|paths...}}\n'    
 'Tag multiple paths.\n'    
 'With the form "-tag", remove the tag from the immediate tags.\n'    
 'A single path named "-" indicates that paths should be read\n'    
 'from the standard input.\n'    
 '\n'    
 '*Method `FSTagsCommand.cmd_test(self, argv)`*:\n'    
 'Usage: {cmd} [--direct] path {{tag[=value]|-tag}}...\n'    
 'Test whether the path matches all the constraints.\n'    
 '--direct    Use direct tags instead of all tags.\n'    
 '\n'    
 '*Method `FSTagsCommand.cmd_xattr_export(self, argv)`*:\n'    
 'Usage: {cmd} {{-|paths...}}\n'    
 'Import tag information from extended attributes.\n'    
 '\n'    
 '*Method `FSTagsCommand.cmd_xattr_import(self, argv)`*:\n'    
 'Usage: {cmd} {{-|paths...}}\n'    
 'Update extended attributes from tags.\n'    
 '\n'    
 '*Method `FSTagsCommand.import_csv_file(self, f, *, convert_name=None)`*:\n'    
 'Import CSV data from the file `f`.\n'    
 '\n'    
 'Parameters:\n'    
 '* `f`: the source CSV file\n'    
 '* `convert_name`: a callable to convert each input name\n'    
 '  into a file path; the default is to use the input name directly\n'    
 '\n'    
 '*Method `FSTagsCommand.run_context(self)`*:\n'    
 'Push the `FSTags`.\n'    
 '\n'    
 '## Class `FSTagsConfig`\n'    
 '\n'    
 'A configuration for fstags.\n'    
 '\n'    
 '*Method `FSTagsConfig.__init__(self, rcfilepath=None)`*:\n'    
 'Initialise the config.\n'    
 '\n'    
 'Parameters:\n'    
 '* `rcfilepath`: the path to the confguration file\n'    
 "  If `None`, default to `'~/.fstagsrc'` (from `RCFILE`).\n"    
 '\n'    
 '*Method `FSTagsConfig.cascade_rules_from_config(config)`*:\n'    
 'Return a list of the `[cascade]` tag rules from the config.\n'    
 '\n'    
 '*Method `FSTagsConfig.filename_rules_from_config(config)`*:\n'    
 'Return a list of the `[filename_autotag]` tag rules from the config.\n'    
 '\n'    
 '*Method `FSTagsConfig.load_config(rcfilepath)`*:\n'    
 'Read an rc file, return a `ConfigParser` instance.\n'    
 '\n'    
 '*Property `FSTagsConfig.tagsfile_basename`*:\n'    
 "The tags filename, default `'.fstags'`.\n"    
 '\n'    
 '## Class `FSTagsTagFile(cs.tagset.TagFile, cs.obj.SingletonMixin, '    
 'cs.tagset.BaseTagSets, cs.resources.MultiOpenMixin, '    
 'cs.context.ContextManagerMixin, collections.abc.MutableMapping, '    
 'collections.abc.Mapping, collections.abc.Collection, collections.abc.Sized, '    
 'collections.abc.Iterable, collections.abc.Container, HasFSTagsMixin)`\n'    
 '\n'    
 'A `FSTagsTagFile` indexing `TagSet`s for file paths\n'    
 "which lives in the file path's directory.\n"    
 '\n'    
 '*Method `FSTagsTagFile.TagSetClass(self, name: str) -> '    
 'cs.fstags.TaggedPath`*:\n'    
 'factory to create a `TaggedPath` from a `name`.\n'    
 '\n'    
 '*Property `FSTagsTagFile.dirpath`*:\n'    
 'Return the path of the directory associated with this `FSTagsTagFile`.\n'    
 '\n'    
 '## Function `get_xattr_value(filepath, xattr_name)`\n'    
 '\n'    
 'Read the extended attribute `xattr_name` of `filepath`.\n'    
 'Return the extended attribute value as a string,\n'    
 'or `None` if the attribute does not exist.\n'    
 '\n'    
 'Parameters:\n'    
 '* `filepath`: the filesystem path to update\n'    
 '* `xattr_name`: the extended attribute to obtain\n'    
 '  if this is a `str`, the attribute is the UTF-8 encoding of that name.\n'    
 '\n'    
 '## Class `HasFSTagsMixin`\n'    
 '\n'    
 'Mixin providing an automatic `.fstags` property.\n'    
 '\n'    
 '*Property `HasFSTagsMixin.fstags`*:\n'    
 'Return the `.fstags` property,\n'    
 'default a shared default `FSTags` instance.\n'    
 '\n'    
 '## Function `is_valid_basename(name: str)`\n'    
 '\n'    
 'Test whether `name` is a valid basefile for something in a directory.\n'    
 '\n'    
 '## Function `main(argv=None)`\n'    
 '\n'    
 'Command line mode.\n'    
 '\n'    
 '## Function `rfilepaths(path, name_selector=None, U=None)`\n'    
 '\n'    
 'Generator yielding pathnames of files found under `path`.\n'    
 '\n'    
 '## Function `rpaths(*a, **kw)`\n'    
 '\n'    
 'Recurse over `path`, yielding `(is_dir,subpath)`\n'    
 'for all selected subpaths.\n'    
 '\n'    
 '## Function `rsync_patterns(paths, top_path)`\n'    
 '\n'    
 'Return a list of rsync include lines\n'    
 'suitable for use with the `--include-from` option.\n'    
 '\n'    
 '## Class `TaggedPath(cs.tagset.TagSet, builtins.dict, '    
 'cs.dateutils.UNIXTimeMixin, cs.lex.FormatableMixin, '    
 'cs.lex.FormatableFormatter, string.Formatter, '    
 'cs.mappings.AttrableMappingMixin, HasFSTagsMixin)`\n'    
 '\n'    
 'Class to manipulate the tags for a specific path.\n'    
 '\n'    
 '*Property `TaggedPath.all_tags`*:\n'    
 'Cached cumulative tags for this path as a `TagSet`\n'    
 'by merging the tags from the root to the path.\n'    
 '\n'    
 "Note that subsequent changes to some path component's `direct_tags`\n"    
 'will not affect this `TagSet`.\n'    
 '\n'    
 '*Method `TaggedPath.as_tags(self, prefix=None, all_tags=False)`*:\n'    
 'Yield the tag data as `Tag`s.\n'    
 '\n'    
 'This overrides `TagSet.as_tags`,\n'    
 'honouring an `optional `all_tags` parameter.\n'    
 '\n'    
 '*Method `TaggedPath.auto_infer(self, attr)`*:\n'    
 'Infer a value from `attr` via the associated `FSTags.cascade_rules`.\n'    
 '\n'    
 'This implementation tries the cascade rules from the configuration\n'    
 'and falls back to the superclass inference (the direct tag, if present).\n'    
 'Therefore a tagset with a rule for `.title` and also a\n'    
 'direct `.title` Tag would return the direct tag value for\n'    
 '`.title` and the rule value for `.auto.title`.\n'    
 '\n'    
 '*Property `TaggedPath.basename`*:\n'    
 'The name of the final path component.\n'    
 '\n'    
 '*Method `TaggedPath.export_xattrs(self)`*:\n'    
 'Update the extended attributes of the file.\n'    
 '\n'    
 '*Method `TaggedPath.format_kwargs(self, *, direct=False)`*:\n'    
 'Format arguments suitable for `str.format_map`.\n'    
 '\n'    
 'This returns an `ExtendedNamespace` from `TagSet.ns()`\n'    
 'for a computed `TagSet`.\n'    
 '\n'    
 'In addition to the normal `TagSet.ns()` names\n'    
 'the following additional names are available:\n'    
 '* `filepath.basename`: basename of the `TaggedPath.filepath`\n'    
 '* `filepath.pathname`: the `TaggedPath.filepath`\n'    
 '* `filepath.encoded`: the JSON encoded filepath\n'    
 '* `tags`: the `TagSet` as a string\n'    
 '\n'    
 '*Method `TaggedPath.format_tagset(self, *, direct=False)`*:\n'    
 "Compute a `TagSet` from this file's tags\n"    
 'with additional derived tags.\n'    
 '\n'    
 'This can be converted into an `ExtendedNamespace`\n'    
 'suitable for use with `str.format_map`\n'    
 "via the `TagSet`'s `.format_kwargs()` method.\n"    
 '\n'    
 'In addition to the normal `TagSet.ns()` names\n'    
 'the following additional names are available:\n'    
 '* `filepath.basename`: basename of the `TaggedPath.filepath`\n'    
 '* `filepath.ext`: the file extension of the basename\n'    
 '  of the `TaggedPath.filepath`\n'    
 '* `filepath.pathname`: the `TaggedPath.filepath`\n'    
 '* `filepath.encoded`: the JSON encoded filepath\n'    
 '\n'    
 '*Method `TaggedPath.get_xattr_tagset(self, xattr_name=None)`*:\n'    
 'Return a new `TagSet`\n'    
 'from the extended attribute `xattr_name` of `self.filepath`.\n'    
 'The default `xattr_name` is `XATTR_B` (`None`).\n'    
 '\n'    
 '*Method `TaggedPath.import_xattrs(self)`*:\n'    
 "Update the direct tags from the file's extended attributes.\n"    
 '\n'    
 '*Method `TaggedPath.infer_from_basename(self, rules=None)`*:\n'    
 'Apply `rules` to the basename of this `TaggedPath`,\n'    
 'return a `TagSet` of inferred `Tag`s.\n'    
 '\n'    
 'Tag values from earlier rules override values from later rules.\n'    
 '\n'    
 '*Method `TaggedPath.infer_tags(self)`*:\n'    
 'Infer tags for this path.\n'    
 '\n'    
 'In order of preference:\n'    
 '* from filesystem fstags\n'    
 '* from file basename matching\n'    
 '* from the cascade rules\n'    
 '\n'    
 '*Method `TaggedPath.merged_tags(self)`*:\n'    
 'Compute the cumulative tags for this path as a `TagSet`\n'    
 'by merging the tags from the root to the path.\n'    
 '\n'    
 '*Property `TaggedPath.name`*:\n'    
 'The `.name` is `basename(self.filepath)`.\n'    
 '\n'    
 '*Method `TaggedPath.prune_inherited(self)`*:\n'    
 "Examine the tags of this path's parent.\n"    
 'Remove any tag on this file if they are present on the parent.\n'    
 'Return a `TagSet` containing the pruned `Tag`s.\n'    
 '\n'    
 '*Method `TaggedPath.save(self)`*:\n'    
 'Update the associated `FSTagsTagFile`.\n'    
 '\n'    
 '*Method `TaggedPath.set(self, name, value=None, *a, **kw)`*:\n'    
 "Forbid the special tag name `'name'`, reserved for the filename.\n"    
 '\n'    
 '*Property `TaggedPath.tagfile`*:\n'    
 'Return the `FSTagsTagFile` storing the state for this `TaggedPath`.\n'    
 '\n'    
 '## Function `update_xattr_value(filepath, xattr_name, new_xattr_value)`\n'    
 '\n'    
 'Update the extended attributes of `filepath`\n'    
 'with `new_xattr_value` for `xattr_name`.\n'    
 'Return the previous value, or `None` if the attribute was missing.\n'    
 '\n'    
 'We avoid calling `os.setxattr` if the value will not change.\n'    
 '\n'    
 'Parameters:\n'    
 '* `filepath`: the filesystem path to update\n'    
 '* `xattr_name`: the extended attribute to update;\n'    
 '  if this is a `str`, the attribute is the UTF-8 encoding of that name.\n'    
 '* `new_xattr_value`: the new extended attribute value, a `str`\n'    
 '  which should be the transcription of `TagSet`\n'    
 '  i.e. `str(tagset)`\n'    
 '\n'    
 '## Function `verbose(msg, *a)`\n'    
 '\n'    
 'Emit message if in verbose mode.\n'    
 '\n'    
 '# Release Log\n'    
 '\n'    
 '\n'    
 '\n'    
 '*Release 20220311*:\n'    
 '* New TaggedPath.infer_tags() method to compute and return the inferred '    
 'TagSet.\n'    
 '* New "fstags infer pathname" command.\n'    
 '\n'    
 '*Release 20211212*:\n'    
 '* Rename edit_many to edit_tagsets for clarity.\n'    
 '* FSTags.edit_dirpath: include realpath(dirpath) at the top of the edit '    
 'list.\n'    
 '\n'    
 '*Release 20210906*:\n'    
 '* TaggedPath: new auto_infer method overriding the inherited '    
 'TagSet.auto_infer which consults the cascade_rules from the .fstagsrc.\n'    
 '* fstags ls: new -l option to print a multiline tag listing.\n'    
 '* fstags cptags: copy the tags from one path to another.\n'    
 '* Assorted other changes.\n'    
 '\n'    
 '*Release 20210404*:\n'    
 '* FSTags.edit_dirpath: new all_names parameter to include dot-names.\n'    
 '* FSTagsCommand.cmd_edit: new -a option to turn on the all_names parameter.\n'    
 '\n'    
 '*Release 20210306*:\n'    
 '* FSTags: new tagfile_for(filepath) to obtain the TagFile for filepath.\n'    
 '* FSTagsCommand: new -o ontology option to supply an ontology file for the '    
 'FSTags.\n'    
 '* FSTagsCommand.cmd_ont: drop -o/--ontology, superceded by global -o '    
 'option.\n'    
 '* Move BaseTagFile from cs.fstags to TagFile in cs.tagset.\n'    
 '* FSTags.edit_dirpath: we now get (old_name,new_name,TaggedPath) back from '    
 'edit_many, obviating the te_id_map.\n'    
 '* TaggedPath: .name property returning basename(self.filepath), .set and '    
 ".discard methods rejecting use of the 'name' tag.\n"    
 '* FSTagsCommand: port to new cs.cmdutils API.\n'    
 '* Many small refactors and bugfixes.\n'    
 '\n'    
 '*Release 20200717.1*:\n'    
 'Add the manual page MarkDown source files. Note: well out of date, need '    
 'updating.\n'    
 '\n'    
 '*Release 20200717*:\n'    
 'DISTINFO: require cs.obj>=20200716 for SingletonMixin API change.\n'    
 '\n'    
 '*Release 20200716*:\n'    
 '* Update for changed cs.obj.SingletonMixin API.\n'    
 '* fstags: new "export" and "import" subcommands roughly paralleling those '    
 'from "sqltags", providing CSV formatted export/import.\n'    
 '* fstags export: ew -a (all paths) option - the default is not to not export '    
 'paths with no tags.\n'    
 '\n'    
 '*Release 20200521.1*:\n'    
 'fix DISTINFO.install_requires\n'    
 '\n'    
 '*Release 20200521*:\n'    
 '* Add -i option to cp,ln,mv for command line compatibility, just disables '    
 '-f.\n'    
 '* New "rename" subcommand to rename files according to a format string.\n'    
 '* Ontology support (optional).\n'    
 '* Various classes are now singletons to avoid dissonance.\n'    
 '* Fold "edittags" subcommand into "edit" via the "-d" (directories like '    
 'files) option.\n'    
 '* New "ns" subcommand reporting on the primary names available for '    
 'formatting.\n'    
 '* Accept [clausename]entryname as a format string to obtain the string from '    
 'that entry of the config file.\n'    
 '* Many bugfixes and improvements.\n'    
 '\n'    
 '*Release 20200229*:\n'    
 '* New TaggedPath.modified property aliasing the TagSet.modified attribute.\n'    
 '* ls: new -d option to treat directories like files (do not recurse), aiding '    
 'reporting of tags for a directory.\n'    
 '* find,ls subcommands: work off the realpath of the supplied top level '    
 'path.\n'    
 '* Tag: now subclasses namedtuple.\n'    
 '* Rewrite rpaths() to use scandir and to also yield (is_dir,path) tuples.\n'    
 '* TagSet, Tag, TagChoice moved into new cs.tagset module for reuse.\n'    
 '* json_import: make --prefix mandatory, is "." as separator if not empty.\n'    
 '* Move filename regexp rules to [filename_rules] config section.\n'    
 '* New CascadeRule for representing a "target_tag_name = tag_name1 '    
 'tag_name2..." config rules.\n'    
 '* autotag: include the cascade rules in the autotagging after the filename '    
 'rules.\n'    
 '\n'    
 '*Release 20200210*:\n'    
 '* New "json_import" subcommand to import a JSON dict as tags, initial use '    
 'case to load the metadata from youtube-dl.\n'    
 '* New "scrub" command line operation, to purge tags of paths which do not '    
 'exist.\n'    
 '* New "cp", "ln" and "mv" subcommands to copy/link/move paths and take their '    
 'tags with them.\n'    
 '* New "test" subcommand to test paths against tag criteria, useful for find '    
 'and scripts.\n'    
 '* Small bugfixes.\n'    
 '\n'    
 '*Release 20200130*:\n'    
 '* New FSTagsConfig class which parses the .fstagsrc as a .ini file; related '    
 'adjustments.\n'    
 '* New HasFSTagsMixin presenting a settable .fstags property with a shared '    
 'default.\n'    
 '* New xattr_import and xattr_export subcommands, remove implicit xattr '    
 'access/update from other operations.\n'    
 '* New TagSet.__len__ returning the number of tags.\n'    
 '* Add "-" support for stdin to "tag" and "tagpaths" subcommands.\n'    
 '\n'    
 '*Release 20200113.2*:\n'    
 'FSTagsCommand docstring tweak.\n'    
 '\n'    
 '*Release 20200113.1*:\n'    
 'Small docstring updates.\n'    
 '\n'    
 '*Release 20200113*:\n'    
 'Mirror tags to user.cs.fstags xattr to honour Linux namespace requirements. '    
 'Add "filesize" to available tag string format (-o option). Small bugfixes.\n'    
 '\n'    
 '*Release 20191230*:\n'    
 '* Command line: new "find" command to search a file tree based on tags.\n'    
 '* Command line: new "mv" command to move a file and its tags.\n'    
 '* Command line: Python string formats for "find" and "ls" output.\n'    
 '* TaggedPath.autotag: new optional `no_save` parameter, default False, to '    
 'suppress update of the associated .fstags file.\n'    
 '* Inital and untested "mirror tags to xattrs" support.\n'    
 '\n'    
 '*Release 20191201*:\n'    
 'New "edit" subcommand to rename files and edit tags.\n'    
 '\n'    
 '*Release 20191130.1*:\n'    
 'Initial release: fstags, filesystem based tagging utility.'),
  install_requires = ['cs.cmdutils>=20210404', 'cs.context', 'cs.deco', 'cs.fileutils', 'cs.lex', 'cs.logutils', 'cs.pfx', 'cs.resources', 'cs.tagset>=20211212', 'cs.threads', 'cs.upd', 'icontract', 'typeguard'],
  classifiers = ['Programming Language :: Python', 'Programming Language :: Python :: 3', 'Development Status :: 4 - Beta', 'Intended Audience :: Developers', 'Operating System :: OS Independent', 'Topic :: Software Development :: Libraries :: Python Modules', 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)'],
  entry_points = {'console_scripts': ['fstags = cs.fstags:main']},
  keywords = ['python3'],
  license = 'GNU General Public License v3 or later (GPLv3+)',
  long_description_content_type = 'text/markdown',
  package_dir = {'': 'lib/python'},
  py_modules = ['cs.fstags'],
)
