Add manifest to manifest
[gpytage.git] / config.py
blob2a94222b27501e64d8b5021e4d6bea9ac86429d7
1 #!/usr/bin/env python
3 # GPytage config.py module
5 ############################################################################
6 # Copyright (C) 2008 by Kenneth Prugh, Brian Dolbec #
7 # ken69267@gmail.com #
8 # #
9 # This program is free software; you can redistribute it and#or modify #
10 # it under the terms of the GNU General Public License as published by #
11 # the Free Software Foundation under version 2 of the license. #
12 # #
13 # This program is distributed in the hope that it will be useful, #
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
16 # GNU General Public License for more details. #
17 # #
18 # You should have received a copy of the GNU General Public License #
19 # along with this program; if not, write to the #
20 # Free Software Foundation, Inc., #
21 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #
22 ############################################################################
24 from sys import exit, stderr
26 config_files = ['package.keywords', 'package.unmask', 'package.mask', 'package.use', 'sets', 'bashrc', \
27 'color.map', 'modules', 'mirrors', 'categories', 'profile/package.provided']
28 test_path = '/etc/testportage/'
30 try: # >=portage 2.2 modules
31 import portage
32 import portage.const as portage_const
33 except: # portage 2.1.x modules
34 try:
35 import portage
36 import portage_const
37 except ImportError:
38 exit(_('Could not find portage module.\n'
39 'Are you sure this is a Gentoo system?'))
40 print >>stderr, ("Config: portage version = " + portage.VERSION)
42 portage_path = portage_const.USER_CONFIG_PATH
43 #portage_path = '/etc/portage/'
45 config_path = portage_path + '/'
46 PORTDIR=portage.config(clone=portage.settings).environ()['PORTDIR']
48 # house cleaning no longer needed imports
49 del portage, portage_const
51 def set_test_path():
52 global config_path, test_path
53 config_path = test_path
54 print "CONFIG: new config_path = " + config_path
56 def get_config_path():
57 return config_path