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 |
|
---|
16 | import os,sys
|
---|
17 | from distutils.core import setup
|
---|
18 |
|
---|
19 | def patchWith(file,install):
|
---|
20 | newFile=file+".new"
|
---|
21 | install=install.replace("\\", "\\\\")
|
---|
22 | try:
|
---|
23 | os.remove(newFile)
|
---|
24 | except:
|
---|
25 | pass
|
---|
26 | oldF = open(file, 'r')
|
---|
27 | newF = open(newFile, 'w')
|
---|
28 | for line in oldF:
|
---|
29 | line=line.replace("%VBOX_INSTALL_PATH%",install)
|
---|
30 | newF.write(line)
|
---|
31 | newF.close()
|
---|
32 | oldF.close()
|
---|
33 | try:
|
---|
34 | os.remove(file)
|
---|
35 | except:
|
---|
36 | pass
|
---|
37 | os.rename(newFile, file)
|
---|
38 |
|
---|
39 | # See http://docs.python.org/distutils/index.html
|
---|
40 | def main(argv):
|
---|
41 | vboxDest=os.environ.get("VBOX_INSTALL_PATH", None)
|
---|
42 | if vboxDest is None:
|
---|
43 | raise Exception("No VBOX_INSTALL_PATH defined, exiting")
|
---|
44 | vboxVersion=os.environ.get("VBOX_VERSION", None)
|
---|
45 | if vboxVersion is None:
|
---|
46 | # Should we use VBox version for binding module versioning?
|
---|
47 | vboxVersion = "1.0"
|
---|
48 | #raise Exception("No VBOX_VERSION defined, exiting")
|
---|
49 | patchWith(os.path.join(os.path.dirname(sys.argv[0]), 'vboxapi', '__init__.py'), vboxDest)
|
---|
50 | setup(name='vboxapi',
|
---|
51 | version=vboxVersion,
|
---|
52 | description='Python interface to VirtualBox',
|
---|
53 | author='Sun Microsystems',
|
---|
54 | author_email='[email protected]',
|
---|
55 | url='http://www.virtualbox.org',
|
---|
56 | packages=['vboxapi']
|
---|
57 | )
|
---|
58 |
|
---|
59 |
|
---|
60 | if __name__ == '__main__':
|
---|
61 | main(sys.argv)
|
---|