diff options
author | Samuli Seppänen <samuli@openvpn.net> | 2010-11-18 18:00:54 +0200 |
---|---|---|
committer | David Sommerseth <dazo@users.sourceforge.net> | 2010-11-18 19:02:02 +0100 |
commit | f20c2f0d6b42f652f39c0082237c3f8d69752ec9 (patch) | |
tree | 24f78fcd5f6ec34d405c54a9c92d13b69a5b6218 | |
parent | Merge branch 'svn-BETA21' into bugfix2.1 (diff) | |
download | openvpn-f20c2f0d6b42f652f39c0082237c3f8d69752ec9.tar.xz |
Added command-line option parser and an unsigned build option to build_all.py
Modified win/build_all.py so that it parses command-line options using getopt.
Added option "-u / --unsigned" which allows forcing unsigned builds and a "-h /
--help" option. By default a signed build is generated, provided that the Python
SignTool module is installed. If not, the build is interrupted.
Signed-off-by: Samuli Seppänen <samuli@openvpn.net>
Acked-by: Peter Stuge <peter@stuge.se>
Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
-rw-r--r-- | win/build_all.py | 71 |
1 files changed, 56 insertions, 15 deletions
diff --git a/win/build_all.py b/win/build_all.py index 92d2bf4..dec3a78 100644 --- a/win/build_all.py +++ b/win/build_all.py @@ -1,18 +1,59 @@ -from config_all import main as config_all
-from build import main as build_openvpn
-from build_ddk import main as build_ddk
-from sign import main as sign
-from make_dist import main as make_dist
-
-def main(config):
- config_all(config)
- build_openvpn()
- build_ddk(config, 'tap', 'all')
- build_ddk(config, 'tapinstall', 'all')
- sign(config, 'all')
- make_dist(config)
-
-# if we are run directly, and not loaded as a module
+import getopt, sys +from config_all import main as config_all +from build import main as build_openvpn +from build_ddk import main as build_ddk +from make_dist import main as make_dist + +def Usage(): + '''Show usage information''' + print "Usage: build_all.py [OPTIONS]..." + print "Build OpenVPN using Visual Studio tools" + print + print " -h, --help Show this help" + print " -u, --unsigned Do not sign the TAP drivers" + sys.exit(1) + +def main(config): + + # Do a signed build by default + signedBuild=True + + # Parse the command line argument(s) + try: + opts, args = getopt.getopt(sys.argv[1:], "hu", ["help", "unsigned"]) + except getopt.GetoptError: + Usage() + + for o, a in opts: + if o in ("-h","--help"): + Usage() + if o in ("-u", "--unsigned"): + signedBuild=False + + + # Check if the SignTool module is present. This avoids ImportErrors popping + # up annoyingly _after_ the build. + if signedBuild: + try: + from signtool import SignTool + except (ImportError): + print "ERROR: SignTool python module not found! Can't do a signed build." + sys.exit(1) + else: + print "Doing an unsigned build as requested" + + # Start the build + config_all(config) + build_openvpn() + build_ddk(config, 'tap', 'all') + build_ddk(config, 'tapinstall', 'all') + + if signedBuild: + sign(config, 'all') + + make_dist(config) + +# if we are run directly, and not loaded as a module if __name__ == "__main__":
from wb import config
main(config)
|