Salome HOME
add options edit, list, and copy to config command
[tools/sat.git] / src / common / __init__.py
1 #!/usr/bin/env python
2 #-*- coding:utf-8 -*-
3 #  Copyright (C) 2010-2013  CEA/DEN
4 #
5 #  This library is free software; you can redistribute it and/or
6 #  modify it under the terms of the GNU Lesser General Public
7 #  License as published by the Free Software Foundation; either
8 #  version 2.1 of the License.
9 #
10 #  This library is distributed in the hope that it will be useful,
11 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 #  Lesser General Public License for more details.
14 #
15 #  You should have received a copy of the GNU Lesser General Public
16 #  License along with this library; if not, write to the Free Software
17 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
18
19 import os
20
21 from . import config_pyconf
22 from . import architecture
23 from . import printcolors
24 from . import options
25 from . import fileSystem
26
27 class SatException(Exception):
28     pass
29
30 def ensure_path_exists(p):
31     if not os.path.exists(p):
32         os.mkdir(p)
33         
34 def check_config_has_application( config, details = None ):
35     if 'APPLICATION' not in config:
36         message = _("An APPLICATION is required. Use 'config --list' to get the list of available applications.\n")
37         if details :
38             details.append(message)
39         raise SatException( message )