VirtualBox

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

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

Python: Darwin multibin build

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.1 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", "/opt/local"]
23known = {}
24
25def checkPair(p,v,dllpre,dllsuff):
26 file = os.path.join(p, "include", "python"+v, "Python.h")
27 # or just stat()?
28 if not os.path.isfile(file):
29 return None
30 return [os.path.join(p, "include", "python"+v),
31 os.path.join(p, "lib", dllpre+"python"+v+dllsuff)]
32
33def main(argv):
34 dllpre = "lib"
35 dllsuff = ".so"
36 if sys.platform == 'darwin':
37 prefixes.insert(0, '/Developer/SDKs/MacOSX10.4u.sdk/usr')
38 prefixes.insert(0, '/Developer/SDKs/MacOSX10.5.sdk/usr')
39 dllsuff = '.dylib'
40
41 for v in versions:
42 for p in prefixes:
43 c = checkPair(p, v, dllpre, dllsuff)
44 if c is not None:
45 known[v] = c
46 break
47 keys = known.keys()
48 # we want default to be the lowest versioned Python
49 keys.sort()
50 d = None
51 # We need separator other than newline, to sneak through $(shell)
52 sep = "|"
53 for k in keys:
54 if d is None:
55 d = k
56 vers = k.replace('.', '')
57 print "VBOX_PYTHON%s_INC=%s%s" %(vers, known[k][0], sep)
58 print "VBOX_PYTHON%s_LIB=%s%s" %(vers, known[k][1], sep)
59 if d is not None:
60 print "VBOX_PYTHONDEF_INC=%s%s" %(known[d][0], sep)
61 print "VBOX_PYTHONDEF_LIB=%s%s" %(known[d][1], sep)
62
63if __name__ == '__main__':
64 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