A few minimal test packages, fodder for testing 'spack view' command.

This commit is contained in:
Brett Viren 2016-05-01 17:10:32 -04:00
parent 346f102234
commit 26c5bc9d97
8 changed files with 123 additions and 0 deletions

View file

@ -0,0 +1,29 @@
from spack import *
import os
mydir = os.path.dirname(__file__)
source = os.path.join(mydir,'test-a-0.0.tar.gz')
class TestA(Package):
"""The test-a package"""
url = 'file://'+source
version('0.0', '4e823d0af4154fcf52b75dad41b7fd63')
variant('nom', default=True, description='Nominal variant')
variant('var', default=False, description='Variant variant')
def install(self, spec, prefix):
bindir = os.path.join(prefix,'bin')
os.makedirs(bindir)
script = os.path.join(bindir, 'test-a')
with open(script,'w') as fp:
fp.write("""#!/bin/bash
echo 'name: %s'
echo 'prefix: %s'
echo 'spec: %s'
""" % (spec.name, prefix, spec))
os.chmod(script, 0555)

View file

@ -0,0 +1,31 @@
from spack import *
import os
mydir = os.path.dirname(__file__)
source = os.path.join(mydir,'test-b-0.0.tar.gz')
class TestB(Package):
"""The test-b package"""
url = 'file://'+source
version('0.0', '4e823d0af4154fcf52b75dad41b7fd63')
variant('nom', default=True, description='Nominal variant')
variant('var', default=False, description='Variant variant')
depends_on('test-a')
def install(self, spec, prefix):
bindir = os.path.join(prefix,'bin')
os.makedirs(bindir)
script = os.path.join(bindir, 'test-b')
with open(script,'w') as fp:
fp.write("""#!/bin/bash
echo 'name: %s'
echo 'prefix: %s'
echo 'spec: %s'
""" % (spec.name, prefix, spec))
os.chmod(script, 0555)

View file

@ -0,0 +1,31 @@
from spack import *
import os
mydir = os.path.dirname(__file__)
source = os.path.join(mydir,'test-c-0.0.tar.gz')
class TestC(Package):
"""The test-c package"""
url = 'file://'+source
version('0.0', '4e823d0af4154fcf52b75dad41b7fd63')
variant('nom', default=True, description='Nominal variant')
variant('var', default=False, description='Variant variant')
depends_on('test-a+var',when='+var')
def install(self, spec, prefix):
bindir = os.path.join(prefix,'bin')
os.makedirs(bindir)
script = os.path.join(bindir, 'test-c')
with open(script,'w') as fp:
fp.write("""#!/bin/bash
echo 'name: %s'
echo 'prefix: %s'
echo 'spec: %s'
""" % (spec.name, prefix, spec))
os.chmod(script, 0555)

View file

@ -0,0 +1,32 @@
from spack import *
import os
mydir = os.path.dirname(__file__)
source = os.path.join(mydir,'test-d-0.0.tar.gz')
class TestD(Package):
"""The test-d package"""
url = 'file://'+source
version('0.0', '4e823d0af4154fcf52b75dad41b7fd63')
variant('nom', default=True, description='Nominal variant')
variant('var', default=False, description='Variant variant')
depends_on('test-b')
depends_on('test-c')
def install(self, spec, prefix):
bindir = os.path.join(prefix,'bin')
os.makedirs(bindir)
script = os.path.join(bindir, 'test-d')
with open(script,'w') as fp:
fp.write("""#!/bin/bash
echo 'name: %s'
echo 'prefix: %s'
echo 'spec: %s'
""" % (spec.name, prefix, spec))
os.chmod(script, 0555)