VirtualBox

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

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

Python: remove file we're trying to patch before patching

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.9 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 os.rename(newFile, file)
33
34# See http://docs.python.org/distutils/index.html
35def main(argv):
36 vboxDest=os.environ.get("VBOX_INSTALL_PATH", None)
37 if vboxDest is None:
38 raise Exception("No VBOX_INSTALL_PATH defined, exiting")
39 vboxVersion=os.environ.get("VBOX_VERSION", None)
40 if vboxVersion is None:
41 # Should we use VBox version for binding module versioning?
42 vboxVersion = "1.0"
43 #raise Exception("No VBOX_VERSION defined, exiting")
44 patchWith(os.path.join(os.path.dirname(sys.argv[0]), 'vboxapi', '__init__.py'), vboxDest)
45 setup(name='vboxapi',
46 version=vboxVersion,
47 description='Python interface to VirtualBox',
48 author='Sun Microsystems',
49 author_email='[email protected]',
50 url='http://www.virtualbox.org',
51 packages=['vboxapi']
52 )
53
54
55if __name__ == '__main__':
56 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