VirtualBox

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

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

Python: Indent.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.0 KB
Line 
1# Copyright (C) 2009 Sun Microsystems, Inc.
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# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
12# Clara, CA 95054 USA or visit http://www.sun.com if you need
13# additional information or have any questions.
14#
15
16import os,sys
17from distutils.core import setup
18
19def patchWith(file,install):
20 newFile=file+".new"
21 try:
22 os.remove(newFile)
23 except:
24 pass
25 oldF = open(file, 'r')
26 newF = open(newFile, 'w')
27 for line in oldF:
28 line=line.replace("%VBOX_INSTALL_PATH%",install)
29 newF.write(line)
30 newF.close()
31 oldF.close()
32 try:
33 os.remove(file)
34 except:
35 pass
36 os.rename(newFile, file)
37
38# See http://docs.python.org/distutils/index.html
39def main(argv):
40 vboxDest=os.environ.get("VBOX_INSTALL_PATH", None)
41 if vboxDest is None:
42 raise Exception("No VBOX_INSTALL_PATH defined, exiting")
43 vboxVersion=os.environ.get("VBOX_VERSION", None)
44 if vboxVersion is None:
45 # Should we use VBox version for binding module versioning?
46 vboxVersion = "1.0"
47 #raise Exception("No VBOX_VERSION defined, exiting")
48 patchWith(os.path.join(os.path.dirname(sys.argv[0]), 'vboxapi', '__init__.py'), vboxDest)
49 setup(name='vboxapi',
50 version=vboxVersion,
51 description='Python interface to VirtualBox',
52 author='Sun Microsystems',
53 author_email='[email protected]',
54 url='http://www.virtualbox.org',
55 packages=['vboxapi']
56 )
57
58
59if __name__ == '__main__':
60 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