VirtualBox

source: vbox/trunk/src/libs/xpcom18a4/python/gen_python_deps.py@ 20951

Last change on this file since 20951 was 20951, checked in by vboxsync, 16 years ago

Python: fixed newlines

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 1.8 KB
Line 
1#!/usr/bin/python
2#
3# Copyright (C) 2009 Sun Microsystems, Inc.
4#
5# This file is part of VirtualBox Open Source Edition (OSE), as
6# available from http://www.215389.xyz. This file is free software;
7# you can redistribute it and/or modify it under the terms of the GNU
8# General Public License (GPL) as published by the Free Software
9# Foundation, in version 2 as it comes in the "COPYING" file of the
10# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
11# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
12#
13# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
14# Clara, CA 95054 USA or visit http://www.sun.com if you need
15# additional information or have any questions.
16#
17
18
19import os,sys
20
21versions = ["2.3", "2.4", "2.5", "2.6", "2.7", "2.8"]
22prefixes = ["/usr", "/usr/local", "/opt"]
23known = {}
24
25def checkPair(p,v):
26 file = os.path.join(p, "include", "python"+v, "Python.h")
27 # or just stat()?
28 try:
29 lf = open(file, 'r')
30 except IOError,e:
31 return None
32 lf.close()
33 return [os.path.join(p, "include", "python"+v),
34 os.path.join(p, "lib", "libpython"+v+".so")]
35
36def main(argv):
37 for v in versions:
38 for p in prefixes:
39 c = checkPair(p, v)
40 if c is not None:
41 known[v] = c
42 break
43 keys = known.keys()
44 # we want default to be the lowest versioned Python
45 keys.sort()
46 d = None
47 for k in keys:
48 if d is None:
49 d = k
50 vers = k.replace('.', '')
51 print "VBOX_PYTHON%s_INC=%s|" %(vers, known[k][0])
52 print "VBOX_PYTHON%s_LIB=%s|" %(vers, known[k][1])
53 if d is not None:
54 print "VBOX_PYTHONDEF_INC=%s|" %(known[d][0])
55 print "VBOX_PYTHONDEF_LIB=%s|" %(known[d][1])
56
57if __name__ == '__main__':
58 main(sys.argv)
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette