~snappy-dev/snapcraft/core

« back to all changes in this revision

Viewing changes to handlers/autotools.py

  • Committer: Michael Terry
  • Date: 2015-06-23 16:06:33 UTC
  • Revision ID: michael.terry@canonical.com-20150623160633-altyrna84fnmzeku
A little more work

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# -*- Mode:Python; indent-tabs-mode:t; tab-width:4 -*-
2
2
 
 
3
import os
3
4
import snapcraft
 
5
import sys
4
6
 
5
7
class AutotoolsHandler(snapcraft.BaseHandler):
6
 
        def init():
7
 
                pass
8
 
        def pull():
9
 
                # branches to self.sourcedir by default, will be copied to self.builddir
 
8
        def __init__(self, name, options):
 
9
                super().__init__(name, options)
 
10
        def init(self):
 
11
                super().init()
 
12
        def pull(self):
 
13
                super().pull()
10
14
                self.pullBranch(self.options.source)
11
 
        def build():
12
 
                self.run("env NOCONFIGURE=1 ./autogen.sh") # runs in self.builddir by default
 
15
        def build(self):
 
16
                super().build()
 
17
                if not os.path.exists(os.path.join(self.builddir, "configure")):
 
18
                        self.run("env NOCONFIGURE=1 ./autogen.sh")
13
19
                self.run("./configure --prefix= " + self.options.configflags)
14
20
                self.run("make all")
15
 
        def stage():
 
21
        def stage(self):
 
22
                super().stage()
16
23
                self.run("make install DESTDIR=" + self.stagedir)
17
 
        def deploy():
18
 
                return ["bin", "share", **self.findFiles("lib/**/*.so")] # not "include"
19
 
        def test():
 
24
        def deploy(self):
 
25
                super().deploy()
 
26
                self.doDeploy(["bin", "share", "lib"]) # not "include"
 
27
        def test(self):
 
28
                super().test()
20
29
                self.run("make check")
 
30
 
 
31
 
 
32
if __name__ == "__main__":
 
33
        class Options:
 
34
                source = "git://git.sv.gnu.org/readline.git"
 
35
                configflags = ""
 
36
        handler = AutotoolsHandler("readline", Options())
 
37
        getattr(handler, sys.argv[1])()