def main(): parser = argparse.ArgumentParser(description="render multiple project files.") parser.add_argument("-t", "--tool-path", metavar="tool-path", help="set the path to the appleseed.cli tool") parser.add_argument("-f", "--format", dest="output_format", metavar="FORMAT", default="exr", help="set output format (e.g. png, exr)") parser.add_argument("-r", "--recursive", action='store_true', dest="recursive", help="scan the specified directory and all its subdirectories") parser.add_argument("-p", "--parameter", dest="args", metavar="ARG", nargs="*", help="forward additional arguments to appleseed") parser.add_argument("directory", help="directory to scan") args = parser.parse_args() print_runtime_details("rendermany", VERSION, os.path.realpath(__file__)) # If no tool path is provided, search for the tool in the same directory as this script. if args.tool_path is None: script_directory = os.path.dirname(os.path.realpath(__file__)) args.tool_path = os.path.join(script_directory, DEFAULT_TOOL_FILENAME) print("setting tool path to {0}.".format(args.tool_path)) start_time = datetime.datetime.now() rendered_file_count = render_project_files(args) end_time = datetime.datetime.now() print("rendered {0} project file(s) in {1}." .format(rendered_file_count, format_duration(end_time - start_time)))
def main(): # Parse the command line. parser = argparse.ArgumentParser( description="send a shot to a folder being watched by " "appleseed render nodes.") parser.add_argument( "-s", "--max-size", metavar="MB", help="set the maximum allowed size in mb of the target directory " "(default is 1 terabyte)") parser.add_argument("--source", metavar="source-directory", dest="source_directory", required=True, help="directory containing the source shot data") parser.add_argument("--target", metavar="target-directory", dest="target_directory", required=True, help="directory being watched by render nodes") parser.add_argument( "--frames", metavar="frames-directory", dest="frames_directory", help="directory where the rendered frames should be stored") args = parser.parse_args() print_runtime_details("rendermanager", VERSION, os.path.realpath(__file__)) if args.max_size is None: args.max_size = 2**40 # default to 1 terabyte else: args.max_size = long(args.max_size) args.max_size *= MB # convert to bytes # Start the log. log = Log( os.path.join(args.target_directory, LOGS_DIR, "rendermanager.log")) log.info("--- starting logging ---") log.info("running rendermanager.py version {0}.".format(VERSION)) manager = Manager(args, log) # Main management loop. try: while True: try: manager.manage() except KeyboardInterrupt, SystemExit: raise except: exc_type, exc_value, exc_traceback = sys.exc_info() lines = traceback.format_exception(exc_type, exc_value, exc_traceback) log.error("".join(line for line in lines)) log.info_no_log( "waiting {0} seconds...".format(PAUSE_BETWEEN_UPDATES)) time.sleep(PAUSE_BETWEEN_UPDATES)
def main(): colorama.init() parser = argparse.ArgumentParser( description="run the functional test suite.") parser.add_argument("-t", "--tool-path", required=True, metavar="tool-path", help="set the path to the appleseed.cli tool") parser.add_argument( "-r", "--recursive", action='store_true', dest="recursive", help="scan the specified directory and all its subdirectories") parser.add_argument( "-s", "--skip-rendering", action='store_true', dest="skip_rendering", help="skip actual rendering, only generate the HTML report") parser.add_argument("-p", "--parameter", dest="args", metavar="ARG", nargs="*", help="forward additional arguments to appleseed") parser.add_argument("directory", nargs='?', default=".", help="directory to scan") args = parser.parse_args() if not os.path.isfile(args.tool_path): sys.exit("Error: The given path to appleseed.cli does not exist.") script_directory = os.path.dirname(os.path.realpath(__file__)) appleseed_args = APPLESEED_BASE_ARGS if args.args: appleseed_args += " {0}".format(" ".join(args.args)) utils.print_runtime_details("runtestsuite", VERSION, os.path.realpath(__file__), CURRENT_TIME) print_configuration(args.tool_path, appleseed_args) results = render_test_scenes(script_directory, args) print() print("Results:") print(" Success Rate : {0}{1:.2f} %{2}".format( colorama.Fore.RED if results.failure_count() > 0 else colorama.Fore.GREEN, results.success_rate(), colorama.Fore.RESET)) print(" Failures : {0}{1} out of {2} test scene(s){3}".format( colorama.Fore.RED if results.failure_count() > 0 else colorama.Fore.GREEN, results.failure_count(), results.total_test_count(), colorama.Fore.RESET)) print(" Total Time : {0}".format(results.total_time()))
def main(): parser = argparse.ArgumentParser( description="update multiple project files to the latest " "format revision and remove unused entities.") parser.add_argument("-t", "--tool-path", metavar="tool-path", help="set the path to the projecttool binary") parser.add_argument( "-r", "--recursive", action='store_true', dest="recursive", help="scan the specified directory and all its subdirectories") parser.add_argument("directory", help="directory to scan") args = parser.parse_args() print_runtime_details("cleanmany", VERSION, os.path.realpath(__file__)) # If no tool path is provided, search for the tool in the same directory as this script. if args.tool_path is None: script_directory = os.path.dirname(os.path.realpath(__file__)) args.tool_path = os.path.join(script_directory, DEFAULT_TOOL_FILENAME) print("setting tool path to {0}.".format(args.tool_path)) start_time = datetime.datetime.now() cleaned_file_count = clean_project_files(args.tool_path, args.directory, args.recursive) end_time = datetime.datetime.now() print("cleaned {0} project file(s) in {1}.".format(cleaned_file_count, end_time - start_time))
def main(): parser = argparse.ArgumentParser(description="benchmark appleseed") parser.add_argument("appleseed_path", help="set the path to the appleseed.cli tool") parser.add_argument("appleseed_args", nargs=argparse.REMAINDER, help="forward additional arguments to appleseed") args = parser.parse_args() appleseed_path = args.appleseed_path appleseed_args = args.appleseed_args safe_make_directory("logs") logger = Logger("logs") print_runtime_details("appleseed.benchmark", VERSION, os.path.realpath(__file__), print_function=logger.write) print_configuration(appleseed_path, appleseed_args, logger) safe_make_directory("renders") start_time = datetime.datetime.now() benchmark_projects(appleseed_path, appleseed_args, logger) elapsed_time = datetime.datetime.now() - start_time logger.write("\nTotal suite time: {0}\n".format(elapsed_time))
def main(): parser = argparse.ArgumentParser(description="update functional test suite reference images.") parser.add_argument("-r", "--recursive", action='store_true', dest="recursive", help="scan the specified directory and all its subdirectories") parser.add_argument("directory", nargs='?', default=".", help="directory to scan") args = parser.parse_args() print_runtime_details("updatetestsuiterefimages", VERSION, os.path.realpath(__file__)) for dirpath, dirnames, filenames in walk(args.directory, args.recursive): if "renders" in dirnames: update_ref_images(dirpath)
def main(): parser = argparse.ArgumentParser( description="convert multiple mesh files from one format " "to another.") parser.add_argument("-t", "--tool-path", metavar="tool-path", help="set the path to the convertmeshfile tool") parser.add_argument( "-r", "--recursive", action='store_true', dest='recursive', help="scan the specified directory and all its subdirectories") parser.add_argument( "-n", "--no-overwrite", action='store_false', dest='overwrite', help="do not overwrite destination files if they already exist.") parser.add_argument("directory", help="directory to scan") parser.add_argument("input_pattern", metavar="input-pattern", help="input files pattern (e.g. *.obj)") parser.add_argument("output_format", metavar="output-format", help="output file format (e.g. abc, binarymesh)") args = parser.parse_args() print_runtime_details("convertmany", VERSION, os.path.realpath(__file__)) # If no tool path is provided, search for the tool in the same directory as this script. if args.tool_path is None: script_directory = os.path.dirname(os.path.realpath(__file__)) args.tool_path = os.path.join(script_directory, DEFAULT_TOOL_FILENAME) print("setting tool path to {0}.".format(args.tool_path)) start_time = datetime.datetime.now() converted_file_count = convert_mesh_files(args.tool_path, args.directory, args.recursive, args.input_pattern, args.output_format, args.overwrite) end_time = datetime.datetime.now() print("converted {0} mesh file(s) in {1}.".format(converted_file_count, end_time - start_time))
def main(): colorama.init() parser = argparse.ArgumentParser(description="build an appleseed package from sources") parser.add_argument("--nozip", help="do not build a final zip file. Files will be copied to staging directory only", action="store_true") args = parser.parse_args() no_zip = args.nozip print_runtime_details("appleseed.package", VERSION, os.path.realpath(__file__)) print("VERY IMPORTANT:") print("") print(" - Make sure there are no obsolete binaries in sandbox/bin/ and sandbox/lib/") print(" - You may need to run this tool with sudo on Linux and macOS") print(" - On Linux, you may need to set $LD_LIBRARY_PATH to allow ldd(1) to find third party shared libraries") print("") settings = Settings() settings.load() settings.print_summary() package_info = PackageInfo(settings, no_zip) package_info.load() package_info.print_summary() if os.name == "nt": package_builder = WindowsPackageBuilder(settings, package_info) elif os.name == "posix" and platform.mac_ver()[0] != "": package_builder = MacPackageBuilder(settings, package_info) elif os.name == "posix" and platform.mac_ver()[0] == "": package_builder = LinuxPackageBuilder(settings, package_info) else: fatal("Unsupported platform: {0}".format(os.name)) package_builder.build_package() package_info.print_summary()
def main(): parser = argparse.ArgumentParser( description="sort #include clauses in c++ source code.") parser.add_argument( "-r", "--recursive", action='store_true', dest='recursive', help= "process all files in the specified directory and all its subdirectories" ) parser.add_argument("path", help="file or directory to process") args = parser.parse_args() print_runtime_details("sortincludes", VERSION, os.path.realpath(__file__)) if os.path.isfile(args.path): process_file(args.path) else: for filepath in walk(args.path, args.recursive): ext = os.path.splitext(filepath)[1] if ext == ".h" or ext == ".cpp": process_file(filepath)
def main(): # Parse the command line. parser = argparse.ArgumentParser( description="continuously watch a directory and render any " "appleseed project file that appears in it.") parser.add_argument("-t", "--tool-path", metavar="tool-path", help="set the path to the appleseed.cli tool") parser.add_argument("-f", "--format", dest="output_format", metavar="FORMAT", default="exr", help="set output format (e.g. png, exr)") parser.add_argument( "-u", "--user", dest="user_name", metavar="NAME", help="set user name (by default the host name is used)") parser.add_argument("-p", "--parameter", dest="args", metavar="ARG", nargs="*", help="forward additional arguments to appleseed") parser.add_argument("--print-missing-deps", action='store_true', help="print missing dependencies") parser.add_argument("directory", help="directory to watch") args = parser.parse_args() print_runtime_details("rendernode", VERSION, os.path.realpath(__file__)) # If no tool path is provided, search for the tool in the same directory as this script. if args.tool_path is None: script_directory = os.path.dirname(os.path.realpath(__file__)) args.tool_path = os.path.join(script_directory, DEFAULT_TOOL_FILENAME) print("setting tool path to {0}.".format(args.tool_path)) # If no watch directory is provided, watch the current directory. if args.directory is None: args.directory = os.getcwd() # If no user name is provided, use the host name. if args.user_name is None: args.user_name = socket.gethostname() # Clean up the user name. args.user_name = cleanup_user_name(args.user_name) # Start the log. log = Log(os.path.join(args.directory, LOGS_DIR, args.user_name + ".log")) log.info("--- starting logging ---") # Print version information. log.info("running rendernode.py version {0}.".format(VERSION)) print_appleseed_version(args, log) # Print the user name. log.info("user name is {0}.".format(args.user_name)) # Disable Windows Error Reporting on Windows. if os.name == "nt": log.info("initial windows error reporting status: {0}".format( get_wer_status())) initial_wer_values = disable_wer(log) log.info("new windows error reporting status: {0}".format( get_wer_status())) log.info("watching directory {0}".format(os.path.abspath(args.directory))) random.seed() # Main watch/render loop. try: while True: try: while watch(args, log): pass except KeyboardInterrupt, SystemExit: raise except ProcessFailedException: pass except: exc_type, exc_value, exc_traceback = sys.exc_info() lines = traceback.format_exception(exc_type, exc_value, exc_traceback) log.error("".join(line for line in lines)) time.sleep(PAUSE_BETWEEN_CHECKS)
def main(): (args, output, existingFile) = cli() print_runtime_details("oslextractmetadata", VERSION, os.path.realpath(__file__)) # read configuration file cfg_defaults = {'oslpath': '/usr/bin/oslinfo'} osl_cfg = ConfigParser(cfg_defaults) osl_cfg.read('oslextractmeta.conf') # create list of files specified on cli or read from file files = createFileList(FileTypes, osl_cfg, args.recursive, args.files, args.read_file) # parse files for shader metadata shaders = dict() for shaderfile in files: if args.verbosity: print("Processing file %s" % shaderfile) shaderUI = parseShaderInfo(shaderfile, FileTypes, osl_cfg) if shaderUI: shaders[shaderUI['path']] = shaderUI jsonDict = dict() # retrieve existing values in case of updating or cleaning if existingFile and not args.overwrite: with open(output, 'r') as fp: try: jsonDict = json.load(fp) except: _fatalError("JSON object could not be decoded.") # create/update/clean json shader and header dictionaries changes = 0 if args.clean: (changes, jsonDict['shaders']) = cleanJsonShaders(jsonDict['shaders']) if args.verbosity: print("Removed %s shaders." % changes) if args.update: changes = len(shaders) jsonDict['shaders'].update(shaders) if args.verbosity: print("%s shaders updated." % changes) if args.overwrite: changes = len(shaders) jsonDict['header'] = writeJsonHeader(output, changes) jsonDict['shaders'] = shaders if args.verbosity: print("%s shaders added to %s" % (changes, output)) # only adding new shaders else: temp_changes = changes if jsonDict.has_key('shaders'): existing_keys = jsonDict['shaders'].keys() for key in shaders: if key not in existing_keys: jsonDict['shaders'][key] = shaders[key] changes += 1 else: jsonDict['shaders'] = shaders changes = len(shaders) if args.verbosity: added_shaders = changes - temp_changes print("Added %s shaders." % added_shaders) # write to file shaders to file if changed if existingFile and changes: with open(output, 'w') as fp: fp.seek(0) fp.truncate() jsonDict['header'] = updateJsonHeader(jsonDict['header'], len(jsonDict['shaders'])) json.dump(jsonDict, fp) elif not existingFile and changes: with open(output, 'w') as fp: jsonDict['header'] = writeJsonHeader(output, len(shaders)) json.dump(jsonDict, fp) elif args.verbosity: print("No shaders found for adding to %s, exiting." % output) return 0