Skip to content

Commit

Permalink
Update Package Creation Tutorial for SC19 (#26)
Browse files Browse the repository at this point in the history
* Two space to one space

* Update packaging tutorial for SC19
  • Loading branch information
adamjstewart authored and tgamblin committed Nov 17, 2019
1 parent 552fcaf commit 15d8513
Show file tree
Hide file tree
Showing 7 changed files with 239 additions and 298 deletions.
21 changes: 12 additions & 9 deletions tutorial/examples/0.package.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

# ----------------------------------------------------------------------------
# If you submit this package back to Spack as a pull request,
# please first remove this boilerplate and all FIXME comments.
#
# This is a template package file for Spack. We've put "FIXME"
# next to all the things you'll want to change. Once you've handled
Expand All @@ -15,17 +18,16 @@
# spack edit mpileaks
#
# See the Spack documentation for more information on packaging.
# If you submit this package back to Spack as a pull request,
# please first remove this boilerplate and all FIXME comments.
#
# ----------------------------------------------------------------------------

from spack import *


class Mpileaks(Package):
class Mpileaks(AutotoolsPackage):
"""FIXME: Put a proper description of your package here."""

# FIXME: Add a proper url for your package's homepage here.
homepage = "http://www.example.com"
homepage = "https://www.example.com"
url = "https://github.com/LLNL/mpileaks/releases/download/v1.0/mpileaks-1.0.tar.gz"

# FIXME: Add a list of GitHub accounts to
Expand All @@ -37,7 +39,8 @@ class Mpileaks(Package):
# FIXME: Add dependencies if required.
# depends_on('foo')

def install(self, spec, prefix):
# FIXME: Unknown build system
make()
make('install')
def configure_args(self):
# FIXME: Add arguments other than --prefix
# FIXME: If not needed delete this function
args = []
return args
11 changes: 6 additions & 5 deletions tutorial/examples/1.package.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from spack import *


class Mpileaks(Package):
class Mpileaks(AutotoolsPackage):
"""Tool to detect and report MPI objects like MPI_Requests and
MPI_Datatypes."""

Expand All @@ -20,7 +20,8 @@ class Mpileaks(Package):
# FIXME: Add dependencies if required.
# depends_on('foo')

def install(self, spec, prefix):
# FIXME: Unknown build system
make()
make('install')
def configure_args(self):
# FIXME: Add arguments other than --prefix
# FIXME: If not needed delete this function
args = []
return args
11 changes: 6 additions & 5 deletions tutorial/examples/2.package.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from spack import *


class Mpileaks(Package):
class Mpileaks(AutotoolsPackage):
"""Tool to detect and report MPI objects like MPI_Requests and
MPI_Datatypes."""

Expand All @@ -21,7 +21,8 @@ class Mpileaks(Package):
depends_on('adept-utils')
depends_on('callpath')

def install(self, spec, prefix):
# FIXME: Unknown build system
make()
make('install')
def configure_args(self):
# FIXME: Add arguments other than --prefix
# FIXME: If not needed delete this function
args = []
return args
13 changes: 8 additions & 5 deletions tutorial/examples/3.package.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from spack import *


class Mpileaks(Package):
class Mpileaks(AutotoolsPackage):
"""Tool to detect and report MPI objects like MPI_Requests and
MPI_Datatypes."""

Expand All @@ -21,7 +21,10 @@ class Mpileaks(Package):
depends_on('adept-utils')
depends_on('callpath')

def install(self, spec, prefix):
configure()
make()
make('install')
def configure_args(self):
args = [
'--with-adept-utils={0}'.format(self.spec['adept-utils'].prefix),
'--with-callpath={0}'.format(self.spec['callpath'].prefix)
]

return args
25 changes: 18 additions & 7 deletions tutorial/examples/4.package.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from spack import *


class Mpileaks(Package):
class Mpileaks(AutotoolsPackage):
"""Tool to detect and report MPI objects like MPI_Requests and
MPI_Datatypes."""

Expand All @@ -17,13 +17,24 @@ class Mpileaks(Package):

version('1.0', sha256='2e34cc4505556d1c1f085758e26f2f8eea0972db9382f051b2dcfb1d7d9e1825')

variant('stackstart', values=int, default=0,
description='Specify the number of stack frames to truncate')

depends_on('mpi')
depends_on('adept-utils')
depends_on('callpath')

def install(self, spec, prefix):
configure('--prefix={0}'.format(prefix),
'--with-adept-utils={0}'.format(spec['adept-utils'].prefix),
'--with-callpath={0}'.format(spec['callpath'].prefix))
make()
make('install')
def configure_args(self):
args = [
'--with-adept-utils={0}'.format(self.spec['adept-utils'].prefix),
'--with-callpath={0}'.format(self.spec['callpath'].prefix),
]

stackstart = int(self.spec.variants['stackstart'].value)
if stackstart:
args.extend([
'--with-stack-start-c={0}'.format(stackstart),
'--with-stack-start-fortran={0}'.format(stackstart)
])

return args
44 changes: 0 additions & 44 deletions tutorial/examples/5.package.py

This file was deleted.

0 comments on commit 15d8513

Please sign in to comment.