Allow interrupting PyBindGen fetching, via Ctrl-C, for the impatient developers.
authorGustavo J. A. M. Carneiro <gjc@inescporto.pt>
Sat Sep 27 15:06:38 2008 +0100 (16 months ago)
changeset 37193307abd75322
parent 3701 6105fe16df43
child 3720 e09a1bd54909
Allow interrupting PyBindGen fetching, via Ctrl-C, for the impatient developers.
bindings/python/wscript
     1.1 --- a/bindings/python/wscript	Tue Sep 16 11:55:52 2008 -0700
     1.2 +++ b/bindings/python/wscript	Sat Sep 27 15:06:38 2008 +0100
     1.3 @@ -55,19 +55,29 @@
     1.4          rev = "-rrevno:%i" % REQUIRED_PYBINDGEN_VERSION[3]
     1.5      else:
     1.6          rev = "-rtag:%s" % '.'.join([str(x) for x in REQUIRED_PYBINDGEN_VERSION])
     1.7 +        
     1.8      if os.path.exists(LOCAL_PYBINDGEN_PATH):
     1.9 -        print "Trying to update pybindgen; this will fail if no network connection is available."
    1.10 +        print "Trying to update pybindgen; this will fail if no network connection is available.  Hit Ctrl-C to skip."
    1.11  
    1.12          cmd = [bzr, "pull", rev, PYBINDGEN_BRANCH]
    1.13          print " => ", ' '.join(cmd)
    1.14 -        if subprocess.Popen(cmd, cwd=LOCAL_PYBINDGEN_PATH).wait():
    1.15 +        try:
    1.16 +            if subprocess.Popen(cmd, cwd=LOCAL_PYBINDGEN_PATH).wait():
    1.17 +                return False
    1.18 +        except KeyboardInterrupt:
    1.19 +            print "Interrupted; Python bindings will be disabled."
    1.20              return False
    1.21          print "Update was successful."
    1.22      else:
    1.23 -        print "Trying to fetch pybindgen; this will fail if no network connection is available."
    1.24 +        print "Trying to fetch pybindgen; this will fail if no network connection is available.  Hit Ctrl-C to skip."
    1.25          cmd = [bzr, "checkout", rev, PYBINDGEN_BRANCH, LOCAL_PYBINDGEN_PATH]
    1.26          print " => ", ' '.join(cmd)
    1.27 -        if subprocess.Popen(cmd).wait():
    1.28 +        try:
    1.29 +            if subprocess.Popen(cmd).wait():
    1.30 +                return False
    1.31 +        except KeyboardInterrupt:
    1.32 +            print "Interrupted; Python bindings will be disabled."
    1.33 +            shutil.rmtree(LOCAL_PYBINDGEN_PATH, True)
    1.34              return False
    1.35          print "Fetch was successful."
    1.36