[TIC-CORE] change the license from apache 2.0 to flora 1.1
[archive/20170607/tools/tic-core.git] / tic / config.py
index 0c6eb09..4648f95 100644 (file)
@@ -1,3 +1,20 @@
+#!/usr/bin/python
+# Copyright (c) 2016 Samsung Electronics Co., Ltd
+#
+# Licensed under the Flora License, Version 1.1 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://floralicense.org/license/
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Contributors:
+# - S-Core Co., Ltd
 
 import os
 import ConfigParser
@@ -6,30 +23,37 @@ DEFAULT_MSG_CONF = "/etc/tic-core/message.conf"
 DEFAULT_CONF = "/etc/tic-core/config.conf"
 
 class ConfigMgr(object):
-    DEFAULT_MESSAGE = {'message': {
-                        'repo_not_found': "The repository url cannot be found (%s)",
-                        'xml_parse_error': "There was a problem parsing the %s, please check the file (%s)",
-                        'yaml_parse_error': "There was a problem parsing the %s, please check the file (%s)",
-                        'recipe_parse_error': "There was a problem parsing the recipe, please check the recipe file (%s)",
-                        'package_not_exist': "The default package(%s) does not exist.",
-                        'dependency_not_exist': "The %s needed by %s does not exist. should be checked for repository",
-                        'server_error': "there was a problem servicing your request. please try again later" }
+    DEFAULT_MESSAGE = {"message": {
+                        "repo_not_found": "The repository URL cannot be found (%s)",
+                        "recipe_not_found": "The recipe URL cannot be found (%s)",
+                        "xml_parse_error": "There was a problem parsing the %s, please check the file (%s)",
+                        "yaml_parse_error": "There was a problem parsing the %s, please check the file (%s)",
+                        "recipe_parse_error": "There was a problem parsing the recipe, please check the recipe file (%s)",
+                        "recipe_convert_error": "There was a problem converting this recipe, please check the recipes",
+                        "package_not_exist": "The default package(%s) does not exist.",
+                        "dependency_not_exist": "The %s needed by %s does not exist. should be checked for repository",
+                        "server_error": "there was a problem servicing your request. please try again later",
+                        "recipe_repo_not_exist": "%s repository does not exist in in the recipe",
+                        "default_recipe_use": "Use default recipe because there is no import data",
+                        "no_package_to_install": "No packages to install. Please select a package to install",
+                        "recipes_not_define": "Please define recipe for %s file creation"}
                        }
     
-    DEFAULT_TIC = {'setting': {
-                       'tempdir': '/var/tmp/tic-core',
-                       'cachedir': '/var/tmp/tic-core/cache',
-                       'logdir': '/var/tmp/tic-core/log'},
-                   'server': {
-                       'port': 8082},
-                   'regularexp': {
-                       'meta_prefix': "building-blocks",
-                       'meta_prefix_root': "building-blocks-root-",
-                       'meta_prefix_sub1': "building-blocks-sub1-",
-                       'meta_pattern': "-(?P<meta>root|sub1|sub2)-(?P<pkgname>.+)",    
-                       'meta_sub1_pattern': "(?P<root>.+)-(?P<sub1>.+)",
-                       'meta_sub2_pattern': "(?P<root>.+)-(?P<sub1>.+)-(?P<sub2>.+)",
-                       'profile_pattern': "(?P<pkgname>.+)-profile_(?P<profile>[^-]+)-?(?P<extra>.+)?"}
+    DEFAULT_TIC = {"setting": {
+                       "tempdir": "/var/tmp/tic-core",
+                       "cachedir": "/var/tmp/tic-core/cache",
+                       "logdir": "/var/tmp/tic-core/log",
+                       "default_recipe": "/etc/tic-core/recipe.yaml"},
+                   "server": {
+                       "port": 8082},
+                   "regularexp": {
+                       "meta_prefix": "building-blocks",
+                       "meta_prefix_root": "building-blocks-root-",
+                       "meta_prefix_sub1": "building-blocks-sub1-",
+                       "meta_pattern": "-(?P<meta>root|sub1|sub2|category)-(?P<pkgname>.+)",
+                       "meta_sub1_pattern": "(?P<root>.+)-(?P<sub1>.+)",
+                       "meta_sub2_pattern": "(?P<root>.+)-(?P<sub1>.+)-(?P<sub2>.+)",
+                       "profile_pattern": "(?P<pkgname>.+)-profile_(?P<profile>[^-]+)-?(?P<extra>.+)?"}
                    }
     
     _instance = None
@@ -39,7 +63,7 @@ class ConfigMgr(object):
             cls._instance = super(ConfigMgr, cls).__new__(cls, *args, **kwargs)
         return cls._instance
     
-    def __init__(self):
+    def __init__(self):
         self._reset()
         for conf_path in [DEFAULT_CONF, DEFAULT_MSG_CONF]:
             self._setConfig(conf_path)