[TIC-Core] Fix: handle error when parsing invalid __KS_URL__
[archive/20170607/tools/tic-core.git] / tic / pykickstarter.py
index 07194ff..4a0fc3d 100644 (file)
@@ -1,14 +1,11 @@
 #!/usr/bin/python
-# Copyright (c) 2000 - 2016 Samsung Electronics Co., Ltd. All rights reserved.
+# Copyright (c) 2016 Samsung Electronics Co., Ltd
 #
-# Contact: 
-# @author Chulwoo Shin <cw1.shin@samsung.com>
-# 
-# Licensed under the Apache License, Version 2.0 (the "License");
+# 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://www.apache.org/licenses/LICENSE-2.0
+#     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,
 # Contributors:
 # - S-Core Co., Ltd
 
+from tic.utils.error import TICError
 from kswriter.KSWriter import KSWriter, KSMetaError
 
 
 class KSoption:
-    def __init__(self):
-        self.configsfile = '/home/shinchulwoo/project/meta-mobile/mobile.yaml'
-        self.repofile = ['/home/shinchulwoo/project/meta-mobile/mobile-repos.yaml']
-        self.target = '/home/shinchulwoo/project/meta-mobile/mobile-targets.yaml'
-        self.external = ['/home/shinchulwoo/project/meta-mobile/ks']
-        self.outdir = '/home/shinchulwoo/project/meta-mobile/__test'
+    def __init__(self, configs, repos, outdir):
+        self.configsfile = configs
+        self.repofile = [repos]
+        self.target = None
+        self.external = None
+        self.outdir = outdir
         self.config = None
-        self.packages = None
+        self.packages = False
         self.targetdefs = None
 
-def kswriter():
+def kswriter(options):
     try:
-        options = KSoption()
         ks = KSWriter(options.configsfile, options.repofile, options.outdir, options.config, options.packages, options.external, options.targetdefs, options.target)
         ks.generate()
     except KSMetaError as err:
-        print('ERROR:', str(err))
-    
+        raise TICError(str(err))
+
 if __name__ == "__main__":
     print('start')
     kswriter()