Module Expr Str Import alias Import alias Import alias Import alias Import alias ImportFrom alias Expr Call AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr keyword NameLoad Expr Call AttributeLoad NameLoad attr Str keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str keyword NameLoad keyword Str Expr Call AttributeLoad NameLoad attr Str keyword Str keyword Str Assign NameStore Call AttributeLoad NameLoad attr If CompareIs AttributeLoad NameLoad attr NameLoad body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str If CompareIs NameLoad NameLoad body Raise Call NameLoad Str Assign AttributeStore NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Str FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad Str attr AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad If UnaryOpNot NameLoad body Raise Call NameLoad BinOpAdd BinOpAdd Str NameLoad Str Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr Num attr Str If CompareLt Call NameLoad NameLoad Num body Raise Call NameLoad BinOpAdd BinOpAdd Str Call AttributeLoad NameLoad attr Num Str Assign TupleStore NameStore NameStore SubscriptLoad NameLoad Slice Num Return TupleLoad NameLoad NameLoad decorator_list Assign NameStore ListLoad Assign NameStore Call AttributeLoad NameLoad attr Str For TupleStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr body For NameStore NameLoad body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad For NameStore Call NameLoad NameLoad Str body If Call AttributeLoad NameLoad attr NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad Break If CompareGt Call NameLoad NameLoad Num body Print Str Print Call AttributeLoad Str attr NameLoad If UnaryOpNot AttributeLoad NameLoad attr body Print Str If CompareNotEq Call AttributeLoad Call NameLoad attr Str body Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str For NameStore NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call NameLoad NameLoad For TupleStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr body For NameStore NameLoad body If CompareEq NameLoad Str body Assign TupleStore NameStore NameStore Call NameLoad NameLoad Expr Call AttributeLoad SubscriptLoad NameLoad Index TupleLoad NameLoad NameLoad attr NameLoad For TupleStore TupleStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr body Assign NameStore ListLoad For NameStore NameLoad body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Str Expr Call AttributeLoad NameLoad attr BinOpAdd Str NameLoad With Call NameLoad NameLoad NameStore body For NameStore NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr If NameLoad body Continue For NameStore Call AttributeLoad NameLoad attr Str body Assign NameStore Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr If NameLoad body Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr Num attr Assign NameStore ListComp Call AttributeLoad NameLoad attr comprehension NameStore Call AttributeLoad Call AttributeLoad NameLoad attr Num attr Str Assign NameStore ListComp NameLoad comprehension NameStore NameLoad CompareNotEq NameLoad Str Expr Call AttributeLoad NameLoad attr BinOpAdd BinOpAdd BinOpAdd Str Call NameLoad NameLoad Str Call NameLoad NameLoad Assign NameStore BinOpAdd Str NameLoad If CompareNotIn NameLoad Call NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad Call AttributeLoad Str attr NameLoad orelse If CompareEq NameLoad SubscriptLoad NameLoad Index Num body Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad Call AttributeLoad Str attr SubscriptLoad NameLoad Slice Num orelse If CompareEq NameLoad SubscriptLoad NameLoad Index Num body Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad Call AttributeLoad Str attr SubscriptLoad NameLoad Slice Num orelse Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad NameLoad orelse If NameLoad body Pass orelse If CompareEq Call NameLoad Call AttributeLoad NameLoad attr Num body Pass orelse Expr Call AttributeLoad NameLoad attr BinOpAdd Str NameLoad Expr Call AttributeLoad NameLoad attr BinOpAdd Str Call AttributeLoad NameLoad attr Assign NameStore Str AugAssignAdd NameStore Str AugAssignAdd NameStore Call AttributeLoad Str attr NameLoad AugAssignAdd NameStore Call AttributeLoad Str attr NameLoad NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr NameLoad If UnaryOpNot Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr BinOpAdd Str NameLoad Assign NameStore Call NameLoad NameLoad Str Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr
N/A N/A 
Given a Galaxy tools directory, look for env.sh files and use the directory
structure and the PATH settings to build module files. These env.sh files are
usually created by the Galaxy Toolshed.
Any old module files with a whatis string indicating they were created by this
script will be removed before creating the new files, so that tools deleted from
the Toolshed will be cleaned up.
 N/A re N/A os N/A argparse N/A sys N/A logging collections defaultdict N/A N/A N/A logging basicConfig level N/A logging INFO N/A parser N/A N/A argparse ArgumentParser description __doc__ N/A N/A N/A parser add_argument --tools_dir default /mnt/galaxy/tools help directory in which Galaxy Toolshed tools are installed N/A N/A N/A parser add_argument --modules_dir default None help destination directory in which to create module files N/A N/A N/A parser add_argument --force action store_true help do not ask for confirmation before deleting old files. N/A args N/A N/A parser parse_args N/A N/A N/A args modules_dir None N/A N/A modules_home N/A N/A N/A os environ get MODULESHOME N/A N/A modules_home None N/A N/A N/A Exception Environment variable $MODULESHOME does not appear to be set; Modules may not be installed. If it is you may need to specify the destination directory manually using --modules_dir. N/A N/A args modules_dir N/A N/A N/A os path join modules_home modulefiles get_tool_version N/A N/A dir_string N/A N/A N/A 
    Strip off tools_dir and take the first two names in the directory hierarchy to
    be the tool name and version. Return (tool, version).
     N/A match N/A N/A re match N/A N/A {0}/(.+) format N/A args tools_dir N/A N/A N/A os path normpath dir_string N/A N/A match N/A N/A N/A Exception N/A N/A Could not parse env.sh path:  dir_string N/A directories N/A N/A N/A N/A match group 1 split / N/A N/A N/A len directories 2 N/A N/A N/A Exception N/A N/A Module name does not appear to have a version:  N/A N/A match group 1 N/A N/A tool version N/A directories N/A 2 N/A N/A tool version N/A N/A delete_list N/A N/A delete_regex N/A N/A re compile ^module-whatis\s+Module automatically generated by GVL scripts N/A N/A dir subdirs files N/A N/A os walk N/A args modules_dir N/A N/A file files N/A N/A filepath N/A N/A N/A os path join dir file N/A line N/A open filepath rb N/A N/A N/A N/A delete_regex search line N/A N/A N/A N/A delete_list append filepath N/A N/A N/A N/A len delete_list 0 N/A N/A The following old module files will be deleted before creating new ones: N/A N/A N/A join delete_list N/A N/A N/A args force N/A N/A Ok? [y/N] N/A N/A N/A N/A N/A raw_input lower y N/A N/A N/A N/A sys exit N/A N/A N/A logging info Deleting old module files N/A file delete_list N/A N/A N/A N/A os remove file N/A tool_shells N/A defaultdict list N/A N/A dir subdirs files N/A N/A os walk N/A args tools_dir N/A N/A file files N/A N/A N/A file env.sh N/A N/A N/A tool version N/A get_tool_version dir N/A N/A N/A N/A tool_shells N/A N/A tool version append dir N/A N/A N/A tool_name tool_version dirs N/A N/A tool_shells iteritems N/A N/A module_lines N/A N/A dir dirs N/A N/A env_path N/A N/A N/A os path join dir env.sh N/A N/A N/A logging debug N/A Parsing  env_path N/A N/A open env_path f N/A N/A row f N/A N/A ifmatch N/A N/A re match ^if.*\;\s*then\s+\.\s+.*env\.sh\s*\;\s*fi$ N/A N/A row strip N/A ifmatch N/A N/A N/A line N/A N/A row split ; N/A N/A envmatch N/A N/A re match ^(\w+)\s*=\s*([^\;=]+)$ N/A N/A line strip N/A exportmatch N/A N/A re match ^export\s+\$?\w+ N/A N/A line strip N/A envmatch N/A N/A variable N/A N/A N/A N/A envmatch group 1 strip N/A parts N/A N/A N/A x strip N/A x N/A N/A N/A N/A envmatch group 2 split : N/A parts N/A x N/A x parts N/A x N/A N/A N/A logging debug N/A N/A N/A Parsed variable:  N/A str variable , list  N/A str parts N/A bashvar N/A $ variable N/A N/A bashvar N/A set parts N/A N/A N/A N/A module_lines append N/A N/A setenv  {0}  {1}
 format variable N/A N/A : join parts N/A N/A N/A bashvar N/A parts N/A 0 N/A N/A N/A N/A module_lines append N/A N/A append-path  {0}  {1}
 format variable N/A N/A : join N/A parts N/A 1 N/A N/A N/A bashvar N/A parts N/A -1 N/A N/A N/A N/A module_lines append N/A N/A prepend-path  {0}  {1}
 format variable N/A N/A : join N/A parts N/A -1 N/A N/A N/A N/A logging warn N/A N/A Line for environment variable {0} could not be parsed in {1} format variable env_path N/A N/A exportmatch N/A N/A N/A N/A N/A N/A len N/A N/A line strip 0 N/A N/A N/A N/A N/A N/A logging warn N/A Some lines could not be parsed in  env_path N/A N/A N/A logging debug N/A Unparsed line:  N/A N/A line strip N/A module_contents #%Module
 N/A module_contents # Built automatically from Galaxy env.sh tool setup files

 N/A module_contents N/A N/A join module_lines N/A module_contents N/A N/A module-whatis  Module automatically generated by GVL scripts, for tool {0}, version {1}. Paths sourced from Galaxy env.sh tool setup files.
 format tool_name tool_version N/A module_tool_path N/A N/A N/A os path join N/A args modules_dir tool_name N/A N/A N/A N/A N/A os path exists module_tool_path N/A N/A N/A N/A os makedirs module_tool_path N/A module_full_path N/A N/A N/A os path join module_tool_path tool_version N/A N/A N/A logging info N/A Writing module to  module_full_path N/A f N/A open module_full_path wb N/A N/A N/A f write module_contents N/A N/A N/A f close