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,
		])

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:

Add "SNAPDIR" and simple vim modeline
Add "SNAPDIR" and simple vim modeline

  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:
+ 
Add "SNAPDIR" and simple vim modeline
## Code Before:
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,
		])

## Instruction:
Add "SNAPDIR" and simple vim modeline
## Code After:
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:
