def do_create(self, args):
        try:
            #add arguments
            doParser = self.arg_create()
            try:
                doArgs = doParser.parse_args(args.split())
            except SystemExit as e:
                return
            #--
            #get json file (remote or local)
            file = generics_utils.get_file(doArgs.file)
            if file is None:
                return 2
            template=validate_json_file(file)
            if template is None:
                return 2
            if "builders" in template:
                template["builders"]=None
            archive_files=[]
            if "config" in template["stack"]:
                for config in template["stack"]["config"]:
                    #add to list of file to tar
                    if "source" in config:
                        file_tar_path=constants.FOLDER_CONFIGS + os.sep + generics_utils.remove_URI_forbidden_char(ntpath.basename(config["source"]))
                        archive_files.append([file_tar_path,config["source"]])
                        #changing source path to archive related source path
                        config["source"]=file_tar_path
                    else:
                        printer.out("No source file found in config", printer.ERROR)
                        return 2
            try:
                if "bundles" in template["stack"]:
                    for bundle in template["stack"]["bundles"]:
                        if "files" in bundle:
                            for files in bundle["files"]:
                                #add to list of file to tar
                                file_tar_path=constants.FOLDER_BUNDLES + os.sep + generics_utils.remove_URI_forbidden_char(bundle["name"]) + os.sep + generics_utils.remove_URI_forbidden_char(bundle["version"]) + os.sep + generics_utils.remove_URI_forbidden_char(ntpath.basename(files["source"]))
                                archive_files.append([file_tar_path,files["source"]])
                                #changing source path to archive related source path
                                files["source"]=file_tar_path
                        else:
                            printer.out("No files section found for bundle", printer.ERROR)
                            return 2
                        if "license" in bundle and "source" in bundle["license"]:
                            #add to list of file to tar
                            file_tar_path=constants.FOLDER_BUNDLES + os.sep + generics_utils.remove_URI_forbidden_char(bundle["name"]) + os.sep + generics_utils.remove_URI_forbidden_char(ntpath.basename(bundle["license"]["source"]))
                            archive_files.append([file_tar_path,bundle["license"]["source"]])
                            #changing source path to archive related source path
                            bundle["license"]["source"]=file_tar_path
            except KeyError as e:
                printer.out("Error in bundle", printer.ERROR)
                return 2
            if "source_logo" in template["stack"]:
                #add to list of file to tar
                file_tar_path=constants.FOLDER_LOGO + os.sep + generics_utils.remove_URI_forbidden_char(ntpath.basename(template["stack"]["source_logo"]))
                archive_files.append([file_tar_path,template["stack"]["source_logo"]])
                #changing source path to archive related source path
                template["stack"]["source_logo"]=file_tar_path


            if os.path.isdir(constants.TMP_WORKING_DIR):
                #delete tmp dir
                shutil.rmtree(constants.TMP_WORKING_DIR)
            os.mkdir(constants.TMP_WORKING_DIR)
            file = open(constants.TMP_WORKING_DIR + os.sep + constants.TEMPLATE_JSON_NEW_FILE_NAME, "w")
            json.dump(template, file, indent=4, separators=(',', ': '))
            file.close()
            archive_files.append([constants.TEMPLATE_JSON_FILE_NAME, constants.TMP_WORKING_DIR+ os.sep +constants.TEMPLATE_JSON_NEW_FILE_NAME])


            if doArgs.archive_path is not None:
                tar_path = doArgs.archive_path
            else:
                tar_path = constants.TMP_WORKING_DIR+os.sep+"archive.tar.gz"
            tar = tarfile.open(tar_path, "w|gz")
            for file_tar_path,file_global_path in archive_files:
                file = generics_utils.get_file(file_global_path, constants.TMP_WORKING_DIR+os.sep+os.path.basename(file_global_path))
                if file is None:
                    printer.out("Downloaded bunlde file not found", printer.ERROR)
                    return 2
                tar.add(file, arcname=file_tar_path)
            tar.close()

            #arhive is created, doing import
            r = self.import_stack(tar_path, False, doArgs.force, doArgs.rbundles, doArgs.use_major)
            if r != 0:
                return r

            #delete tmp dir
            shutil.rmtree(constants.TMP_WORKING_DIR)
            return 0
        except __HOLE__ as e:
            printer.out("OSError: "+str(e), printer.ERROR)
        except IOError as e:
            printer.out("File error: "+str(e), printer.ERROR)
        except ArgumentParserError as e:
            printer.out("In Arguments: "+str(e), printer.ERROR)
            self.help_create()
        except Exception as e:
            return handle_uforge_exception(e)
dataset/ETHPy150Open usharesoft/hammr/src/hammr/commands/template/template.py/Template.do_create