3 # GPytage config.py module
5 ############################################################################
6 # Copyright (C) 2008 by Kenneth Prugh, Brian Dolbec #
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. #
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. #
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
32 import portage
.const
as portage_const
33 except: # portage 2.1.x modules
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
52 global config_path
, test_path
53 config_path
= test_path
54 print "CONFIG: new config_path = " + config_path
56 def get_config_path():