# Path: turbulenz_tools/tools/stdtool.py
# def simple_options(parser_fn, version, dependencies, input_required=True):
#     parser = parser_fn()
#     (options, args) = parser.parse_args()
# 
#     if options.output_version:
#         standard_output_version(version, dependencies, getattr(options, 'output', None))
#         exit(0)
# 
#     if input_required:
#         # Not all tools have an input file, so we print help for no args as well.
#         try:
#             if options.input is None:
#                 print "ERROR: no input files specified"
#                 parser.print_help()
#                 exit(1)
#         except AttributeError:
#             if len(args) == 0:
#                 print "ERROR: no input files specified"
#                 parser.print_help()
#                 exit(1)
# 
#     # Not all tools have a metrics option.
#     try:
#         metrics = options.metrics
#     except AttributeError:
#         metrics = False
# 
#     if options.silent:
#         logging.basicConfig(level=logging.CRITICAL)
#     elif options.verbose or metrics:
#         logging.basicConfig(level=logging.INFO)
#     else:
#         logging.basicConfig(level=logging.WARNING)
# 
#     return (options, args, parser)


import logging
import os
import tarfile
import simplejson as json
from optparse import OptionParser, TitledHelpFormatter
from turbulenz_tools.tools.stdtool import simple_options
        texture_maps = { }
        for _, material in materials.iteritems():
            parameters = material.get('parameters', None)
            if parameters is not None:
                for texture_stage, texture_map in parameters.iteritems():
                    if isinstance(texture_map, (str, unicode)):
                        texture_maps[texture_stage] = True
                        yield texture_map, texture_stage
        LOG.info('contains: %s', ', '.join(texture_maps.keys()))

def _parser():
    parser = OptionParser(description='Generate a TAR file for binary assets referenced from a JSON asset.',
                          usage='%prog -i input.json -o output.tar [options]',
                          formatter=TitledHelpFormatter())
    parser.add_option("--version", action="store_true", dest="output_version", default=False,
                      help="output version number")
    parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False, help="verbose output")
    parser.add_option("-s", "--silent", action="store_true", dest="silent", default=False, help="silent running")

    parser.add_option("-i", "--input", action="store", dest="input", help="input file to process")
    parser.add_option("-o", "--output", action="store", dest="output", help="output file to process")
    parser.add_option("-a", "--assets", action="store", dest="asset_root", default=".", metavar="PATH",
                      help="path of the asset root")

    parser.add_option("-M", action="store_true", dest="dependency", default=False, help="output dependencies")
    parser.add_option("--MF", action="store", dest="dependency_file", help="dependencies output to file")

    return parser

def main():

# Path: turbulenz_tools/tools/stdtool.py
# def simple_options(parser_fn, version, dependencies, input_required=True):
#     parser = parser_fn()
#     (options, args) = parser.parse_args()
# 
#     if options.output_version:
#         standard_output_version(version, dependencies, getattr(options, 'output', None))
#         exit(0)
# 
#     if input_required:
#         # Not all tools have an input file, so we print help for no args as well.
#         try:
#             if options.input is None:
#                 print "ERROR: no input files specified"
#                 parser.print_help()
#                 exit(1)
#         except AttributeError:
#             if len(args) == 0:
#                 print "ERROR: no input files specified"
#                 parser.print_help()
#                 exit(1)
# 
#     # Not all tools have a metrics option.
#     try:
#         metrics = options.metrics
#     except AttributeError:
#         metrics = False
# 
#     if options.silent:
#         logging.basicConfig(level=logging.CRITICAL)
#     elif options.verbose or metrics:
#         logging.basicConfig(level=logging.INFO)
#     else:
#         logging.basicConfig(level=logging.WARNING)
# 
#     return (options, args, parser)


# Path: turbulenz_tools/tools/json2tar.py
import logging
import os
import tarfile
import simplejson as json
from optparse import OptionParser, TitledHelpFormatter
from turbulenz_tools.tools.stdtool import simple_options

        texture_maps = { }
        for _, material in materials.iteritems():
            parameters = material.get('parameters', None)
            if parameters is not None:
                for texture_stage, texture_map in parameters.iteritems():
                    if isinstance(texture_map, (str, unicode)):
                        texture_maps[texture_stage] = True
                        yield texture_map, texture_stage
        LOG.info('contains: %s', ', '.join(texture_maps.keys()))

def _parser():
    parser = OptionParser(description='Generate a TAR file for binary assets referenced from a JSON asset.',
                          usage='%prog -i input.json -o output.tar [options]',
                          formatter=TitledHelpFormatter())
    parser.add_option("--version", action="store_true", dest="output_version", default=False,
                      help="output version number")
    parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False, help="verbose output")
    parser.add_option("-s", "--silent", action="store_true", dest="silent", default=False, help="silent running")

    parser.add_option("-i", "--input", action="store", dest="input", help="input file to process")
    parser.add_option("-o", "--output", action="store", dest="output", help="output file to process")
    parser.add_option("-a", "--assets", action="store", dest="asset_root", default=".", metavar="PATH",
                      help="path of the asset root")

    parser.add_option("-M", action="store_true", dest="dependency", default=False, help="output dependencies")
    parser.add_option("--MF", action="store", dest="dependency_file", help="dependencies output to file")

    return parser

def main():

    (options, args_, parser_) = simple_options(_parser, __version__, __dependencies__)