The Assimilation Project
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
install-path.py
Go to the documentation of this file.
1 #
2 #
3 # This file is part of the Assimilation Project.
4 #
5 # Copyright (C) 2011, 2012, 2013 - Alan Robertson <alanr@unix.sh>
6 #
7 # The Assimilation software is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
11 #
12 # The Assimilation software is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with the Assimilation Project software. If not, see http://www.gnu.org/licenses/
19 #
20 #
21 '''
22 Program to output where we should locate our installed python code for the system.
23 It is known to work for at least some Ubuntu versions. Hope it works elsewhere ;-)
24 
25 There is no doubt a more wonderful pythonic way to do it. If you read this and
26 know of this better way, please let us know, and we'll fix it.
27 '''
28 from os.path import join, isfile, isdir
29 import sys
30 #print sys.path
31 if (join(sys.path[1], 'dist-packages')) in sys.path:
32  print join(sys.path[1], 'dist-packages')
33  sys.exit(0)
34 for p in sys.path[1:]:
35  if p != '' and isfile(join(p,'README')):
36  print p
37  sys.exit(0)
38 sys.exit(1)