Merge lp:~sergiusens/snapcraft/1500758 into lp:~snappy-dev/snapcraft/core

Proposed by Sergio Schvezov on 2015-09-29
Status: Merged
Approved by: John Lenton on 2015-09-29
Approved revision: 216
Merged at revision: 215
Proposed branch: lp:~sergiusens/snapcraft/1500758
Merge into: lp:~snappy-dev/snapcraft/core
Diff against target: 95 lines (+69/-0)
5 files modified
integration-tests/data/simple-scons/SConstruct (+14/-0)
integration-tests/data/simple-scons/main.c (+5/-0)
integration-tests/data/simple-scons/snapcraft.yaml (+11/-0)
plugins/scons-project.yaml (+8/-0)
snapcraft/plugins/scons_project.py (+31/-0)
To merge this branch: bzr merge lp:~sergiusens/snapcraft/1500758
Reviewer Review Type Date Requested Status
John Lenton Approve on 2015-09-29
Daniel Holbach 2015-09-29 Pending
Review via email: mp+272728@code.launchpad.net

Commit Message

Adding a simple scons plugin

To post a comment you must log in.
John Lenton (chipaca) wrote :

LGTM. Just one question.

John Lenton (chipaca) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'integration-tests/data/simple-scons'
2=== added file 'integration-tests/data/simple-scons/SConstruct'
3--- integration-tests/data/simple-scons/SConstruct 1970-01-01 00:00:00 +0000
4+++ integration-tests/data/simple-scons/SConstruct 2015-09-29 10:44:38 +0000
5@@ -0,0 +1,14 @@
6+import os.path
7+
8+env = Environment()
9+hello = env.Program('main.c')
10+DESTDIR = os.environ.get('DESTDIR', '')
11+install_dir = os.path.join('usr', 'bin')
12+
13+if DESTDIR:
14+ install_dir = os.path.join(DESTDIR, install_dir)
15+else:
16+ install_dir = os.path.join(os.path.sep, install_dir)
17+
18+env.Install(install_dir, hello)
19+env.Alias('install', install_dir)
20
21=== added file 'integration-tests/data/simple-scons/icon.png'
22=== added file 'integration-tests/data/simple-scons/main.c'
23--- integration-tests/data/simple-scons/main.c 1970-01-01 00:00:00 +0000
24+++ integration-tests/data/simple-scons/main.c 2015-09-29 10:44:38 +0000
25@@ -0,0 +1,5 @@
26+#include <stdio.h>
27+
28+int main(int argc, char** argv) {
29+ printf("Hello world\n");
30+}
31
32=== added file 'integration-tests/data/simple-scons/snapcraft.yaml'
33--- integration-tests/data/simple-scons/snapcraft.yaml 1970-01-01 00:00:00 +0000
34+++ integration-tests/data/simple-scons/snapcraft.yaml 2015-09-29 10:44:38 +0000
35@@ -0,0 +1,11 @@
36+name: test-package
37+version: 0.1
38+vendor: Sergio Schvezov <sergio.schvezov@canonical.com>
39+summary: test a simple scons project
40+description: a longer description
41+icon: icon.png
42+
43+parts:
44+ scons-project:
45+ type: scons-project
46+ source: .
47
48=== added file 'plugins/scons-project.yaml'
49--- plugins/scons-project.yaml 1970-01-01 00:00:00 +0000
50+++ plugins/scons-project.yaml 2015-09-29 10:44:38 +0000
51@@ -0,0 +1,8 @@
52+build-packages:
53+ - scons
54+options:
55+ source:
56+ required: true
57+ source-type:
58+ source-tag:
59+ source-branch:
60
61=== added file 'snapcraft/plugins/scons_project.py'
62--- snapcraft/plugins/scons_project.py 1970-01-01 00:00:00 +0000
63+++ snapcraft/plugins/scons_project.py 2015-09-29 10:44:38 +0000
64@@ -0,0 +1,31 @@
65+# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
66+#
67+# Copyright (C) 2015 Canonical Ltd
68+#
69+# This program is free software: you can redistribute it and/or modify
70+# it under the terms of the GNU General Public License version 3 as
71+# published by the Free Software Foundation.
72+#
73+# This program is distributed in the hope that it will be useful,
74+# but WITHOUT ANY WARRANTY; without even the implied warranty of
75+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
76+# GNU General Public License for more details.
77+#
78+# You should have received a copy of the GNU General Public License
79+# along with this program. If not, see <http://www.gnu.org/licenses/>.
80+
81+import os
82+
83+import snapcraft
84+
85+
86+class SconsPlugin(snapcraft.BasePlugin):
87+
88+ def pull(self):
89+ return self.handle_source_options()
90+
91+ def build(self):
92+ env = os.environ.copy()
93+ env['DESTDIR'] = self.installdir
94+ return self.run(['scons', 'prefix=/usr']) and \
95+ self.run(['scons', 'install'], env=env)

Subscribers

People subscribed via source and target branches