VirtualBox

source: vbox/trunk/src/VBox/Installer/common/vboxapisetup.py@ 34684

Last change on this file since 34684 was 33735, checked in by vboxsync, 14 years ago

typo

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.5 KB
Line 
1# Copyright (C) 2009 Oracle Corporation
2#
3# This file is part of VirtualBox Open Source Edition (OSE), as
4# available from http://www.virtualbox.org. This file is free software;
5# you can redistribute it and/or modify it under the terms of the GNU
6# General Public License (GPL) as published by the Free Software
7# Foundation, in version 2 as it comes in the "COPYING" file of the
8# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
9# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
10#
11
12import os,sys
13from distutils.core import setup
14
15def cleanupComCache():
16 import shutil
17 from distutils.sysconfig import get_python_lib
18 comCache1 = os.path.join(get_python_lib(),'win32com', 'gen_py')
19 comCache2 = os.path.join(os.environ.get("TEMP", "c:\\tmp"), 'gen_py')
20 print "Cleaning COM cache at",comCache1,"and",comCache2
21 shutil.rmtree(comCache1, True)
22 shutil.rmtree(comCache2, True)
23
24def patchWith(file,install,sdk):
25 newFile=file+".new"
26 install=install.replace("\\", "\\\\")
27 try:
28 os.remove(newFile)
29 except:
30 pass
31 oldF = open(file, 'r')
32 newF = open(newFile, 'w')
33 for line in oldF:
34 line=line.replace("%VBOX_INSTALL_PATH%",install)
35 line=line.replace("%VBOX_SDK_PATH%",sdk)
36 newF.write(line)
37 newF.close()
38 oldF.close()
39 try:
40 os.remove(file)
41 except:
42 pass
43 os.rename(newFile, file)
44
45# See http://docs.python.org/distutils/index.html
46def main(argv):
47 vboxDest=os.environ.get("VBOX_INSTALL_PATH", None)
48 if vboxDest is None:
49 raise Exception("No VBOX_INSTALL_PATH defined, exiting")
50 vboxVersion=os.environ.get("VBOX_VERSION", None)
51 if vboxVersion is None:
52 # Should we use VBox version for binding module versioning?
53 vboxVersion = "1.0"
54 import platform
55 if platform.system() == 'Darwin':
56 vboxSdkDest = os.path.join(vboxDest, "..", "..", "..", "sdk")
57 if not os.path.isdir(vboxSdkDest):
58 vboxSdkDest = os.path.join(vboxDest, "sdk")
59 else:
60 vboxSdkDest = os.path.join(vboxDest, "sdk")
61 if platform.system() == 'Windows':
62 cleanupComCache()
63 patchWith(os.path.join(os.path.dirname(sys.argv[0]), 'vboxapi', '__init__.py'), vboxDest, vboxSdkDest)
64 setup(name='vboxapi',
65 version=vboxVersion,
66 description='Python interface to VirtualBox',
67 author='Oracle Corp.',
68 author_email='[email protected]',
69 url='http://www.virtualbox.org',
70 packages=['vboxapi']
71 )
72
73
74if __name__ == '__main__':
75 main(sys.argv)
Note: See TracBrowser for help on using the repository browser.

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