~jocave/snapcraft/plainbox-provider-plugin

« back to all changes in this revision

Viewing changes to snapcraft/common.py

  • Committer: Michael Terry
  • Date: 2015-08-06 14:59:07 UTC
  • mfrom: (129 snapcraft)
  • mto: This revision was merged to the branch mainline in revision 132.
  • Revision ID: michael.terry@canonical.com-20150806145907-wzkkzm3mitiewa03
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
COMMAND_ORDER = ["pull", "build", "stage", "snap"]
26
26
_DEFAULT_PLUGINDIR = '/usr/share/snapcraft/plugins'
27
27
_plugindir = _DEFAULT_PLUGINDIR
 
28
_arch = None
 
29
_arch_triplet = None
28
30
 
29
31
env = []
30
32
 
44
46
        return subprocess.call(['/bin/sh', f.name] + cmd, **kwargs) == 0
45
47
 
46
48
 
47
 
def fatal(msg):
 
49
def fatal():
48
50
    sys.exit(1)
49
51
 
50
52
 
 
53
def get_arch():
 
54
    global _arch
 
55
    if _arch is None:
 
56
        _arch = subprocess.check_output(['dpkg-architecture', '-qDEB_BUILD_ARCH']).decode('utf8').strip()
 
57
    return _arch
 
58
 
 
59
 
 
60
def get_arch_triplet():
 
61
    global _arch_triplet
 
62
    if _arch_triplet is None:
 
63
        _arch_triplet = subprocess.check_output(['dpkg-architecture', '-qDEB_BUILD_MULTIARCH']).decode('utf8').strip()
 
64
    return _arch_triplet
 
65
 
 
66
 
51
67
def get_stagedir():
52
68
    return os.path.join(os.getcwd(), 'stage')
53
69