cengal.file_system.file_settings_manager.dir_templates.versions.v_0.dir_templates
1#!/usr/bin/env python 2# coding=utf-8 3 4# Copyright © 2012-2024 ButenkoMS. All rights reserved. Contacts: <gtalk@butenkoms.space> 5# 6# Licensed under the Apache License, Version 2.0 (the "License"); 7# you may not use this file except in compliance with the License. 8# You may obtain a copy of the License at 9# 10# http://www.apache.org/licenses/LICENSE-2.0 11# 12# Unless required by applicable law or agreed to in writing, software 13# distributed under the License is distributed on an "AS IS" BASIS, 14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15# See the License for the specific language governing permissions and 16# limitations under the License. 17 18import os.path 19 20""" 21Module Docstring 22Docstrings: http://www.python.org/dev/peps/pep-0257/ 23""" 24 25__author__ = "ButenkoMS <gtalk@butenkoms.space>" 26__copyright__ = "Copyright © 2012-2024 ButenkoMS. All rights reserved. Contacts: <gtalk@butenkoms.space>" 27__credits__ = ["ButenkoMS <gtalk@butenkoms.space>", ] 28__license__ = "Apache License, Version 2.0" 29__version__ = "4.4.1" 30__maintainer__ = "ButenkoMS <gtalk@butenkoms.space>" 31__email__ = "gtalk@butenkoms.space" 32# __status__ = "Prototype" 33__status__ = "Development" 34# __status__ = "Production" 35 36 37class DirTemplatesManager: 38 def __init__(self, templates): 39 self._templates = templates 40 41 def make_an_absolute_template(self, root, template_name): 42 template_content = self._templates[template_name] 43 absolute_template_content = dict() 44 for key, data in template_content.items(): 45 data = data.split(os.path.sep) 46 data = os.path.join(root, *data) 47 absolute_template_content[key] = data 48 return absolute_template_content 49 50 def create_template_in_the_folder(self, root, template_name): 51 absolute_template = self.make_an_absolute_template(root, template_name) 52 for key, path in absolute_template: 53 if not os.path.isdir(path): 54 os.makedirs(path) 55 56 57def get_property_as_relative_dir(config_manager, file, property_name, root): 58 property_data = config_manager.get_property(file, property_name) 59 property_data = property_data.split(os.path.sep) 60 result = os.path.join(root, *property_data) 61 return result
class
DirTemplatesManager:
38class DirTemplatesManager: 39 def __init__(self, templates): 40 self._templates = templates 41 42 def make_an_absolute_template(self, root, template_name): 43 template_content = self._templates[template_name] 44 absolute_template_content = dict() 45 for key, data in template_content.items(): 46 data = data.split(os.path.sep) 47 data = os.path.join(root, *data) 48 absolute_template_content[key] = data 49 return absolute_template_content 50 51 def create_template_in_the_folder(self, root, template_name): 52 absolute_template = self.make_an_absolute_template(root, template_name) 53 for key, path in absolute_template: 54 if not os.path.isdir(path): 55 os.makedirs(path)
def
make_an_absolute_template(self, root, template_name):
42 def make_an_absolute_template(self, root, template_name): 43 template_content = self._templates[template_name] 44 absolute_template_content = dict() 45 for key, data in template_content.items(): 46 data = data.split(os.path.sep) 47 data = os.path.join(root, *data) 48 absolute_template_content[key] = data 49 return absolute_template_content
def
get_property_as_relative_dir(config_manager, file, property_name, root):