import snapcraft

class ShellPlugin(snapcraft.BasePlugin):
	@classmethod
	def schema(cls):
		schema = super().schema()

		schema['required'] = []

		schema['properties']['shell'] = {
			'type': 'string',
			'default': '/bin/sh',
		}
		schema['required'].append('shell')

		schema['properties']['shell-flags'] = {
			'type': 'array',
			'items': {
				'type': 'string',
			},
			'default': [],
		}

		schema['properties']['shell-command'] = {
			'type': 'string',
		}
		schema['required'].append('shell-command')

		return schema

	def env(self, root):
		return super().env(root) + [
			'DESTDIR=' + self.installdir,
			'SNAPDIR=' + self.builddir,
		]

	def build(self):
		super().build()

		return self.run([
			self.options.shell,
		] + self.options.shell_flags + [
			'-c', self.options.shell_command,
		])

# vim:set ts=4 noet:

import snapcraft

class ShellPlugin(snapcraft.BasePlugin):
	@classmethod
	def schema(cls):
		schema = super().schema()

		schema['required'] = []

		schema['properties']['shell'] = {
			'type': 'string',
			'default': '/bin/sh',
		}
		schema['required'].append('shell')

		schema['properties']['shell-flags'] = {
			'type': 'array',
			'items': {
				'type': 'string',
			},
			'default': [],
		}

		schema['properties']['shell-command'] = {
			'type': 'string',
		}
		schema['required'].append('shell-command')

		return schema

	def env(self, root):
		return super().env(root) + [
			'DESTDIR=' + self.installdir,
		]

	def build(self):
		super().build()

		return self.run([
			self.options.shell,
		] + self.options.shell_flags + [
			'-c', self.options.shell_command,
		])

--- 
+++ 
@@ -31,6 +31,7 @@
 	def env(self, root):
 		return super().env(root) + [
 			'DESTDIR=' + self.installdir,
+			'SNAPDIR=' + self.builddir,
 		]
 
 	def build(self):
@@ -41,3 +42,5 @@
 		] + self.options.shell_flags + [
 			'-c', self.options.shell_command,
 		])
+
+# vim:set ts=4 noet:
Add "SNAPDIR" and simple vim modeline
