~mvo/click/lp1232130-kill-on-remove

« back to all changes in this revision

Viewing changes to click/commands/build.py

  • Committer: Michael Vogt
  • Date: 2014-09-29 11:12:52 UTC
  • mfrom: (424.1.99 devel)
  • Revision ID: michael.vogt@ubuntu.com-20140929111252-o3vsvp2e4d620h21
mergedĀ lp:click/devel

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
from optparse import OptionParser
21
21
import os
22
22
import sys
 
23
import subprocess
23
24
 
 
25
from gi.repository import Click
24
26
from click.build import ClickBuildError, ClickBuilder
25
27
 
26
28
 
29
31
    parser.add_option(
30
32
        "-m", "--manifest", metavar="PATH", default="manifest.json",
31
33
        help="read package manifest from PATH (default: manifest.json)")
 
34
    parser.add_option(
 
35
        "--no-validate", action="store_false", default=True, dest="validate",
 
36
        help="Don't run click-reviewers-tools check on resulting .click")
32
37
    options, args = parser.parse_args(argv)
33
38
    if len(args) < 1:
34
39
        parser.error("need directory")
48
53
    except ClickBuildError as e:
49
54
        print(e, file=sys.stderr)
50
55
        return 1
 
56
    if options.validate and Click.find_on_path('click-review'):
 
57
        print("Now executing: click-review %s" % path)
 
58
        try:
 
59
            subprocess.check_call(['click-review', path])
 
60
        except subprocess.CalledProcessError:
 
61
            # qtcreator-plugin-ubuntu relies on return code 0
 
62
            # to establish if a .click package has been built
 
63
            # at all.
 
64
            #
 
65
            # If we want to distinguish between
 
66
            # - click build failed
 
67
            # - click build succeeded, but validation failed
 
68
            # both tools will have to learn this at the same
 
69
            # time.
 
70
            pass
51
71
    print("Successfully built package in '%s'." % path)
52
72
    return 0