spack create MakefilePackage (#3710)
* spack create MakefilePackage * Change default Perl template to match other build systems
This commit is contained in:
parent
048b6fc454
commit
df150b3e92
2 changed files with 38 additions and 26 deletions
|
@ -141,10 +141,6 @@ class AutotoolsPackageTemplate(PackageTemplate):
|
||||||
|
|
||||||
base_class_name = 'AutotoolsPackage'
|
base_class_name = 'AutotoolsPackage'
|
||||||
|
|
||||||
dependencies = """\
|
|
||||||
# FIXME: Add dependencies if required.
|
|
||||||
# depends_on('foo')"""
|
|
||||||
|
|
||||||
body = """\
|
body = """\
|
||||||
def configure_args(self):
|
def configure_args(self):
|
||||||
# FIXME: Add arguments other than --prefix
|
# FIXME: Add arguments other than --prefix
|
||||||
|
@ -233,7 +229,7 @@ class PythonPackageTemplate(PackageTemplate):
|
||||||
body = """\
|
body = """\
|
||||||
def build_args(self, spec, prefix):
|
def build_args(self, spec, prefix):
|
||||||
# FIXME: Add arguments other than --prefix
|
# FIXME: Add arguments other than --prefix
|
||||||
# FIXME: If not needed delete the function
|
# FIXME: If not needed delete this function
|
||||||
args = []
|
args = []
|
||||||
return args"""
|
return args"""
|
||||||
|
|
||||||
|
@ -275,16 +271,14 @@ class PerlmakePackageTemplate(PackageTemplate):
|
||||||
|
|
||||||
dependencies = """\
|
dependencies = """\
|
||||||
# FIXME: Add dependencies if required:
|
# FIXME: Add dependencies if required:
|
||||||
# depends_on('perl-foo')
|
# depends_on('perl-foo', type=('build', 'run'))"""
|
||||||
# depends_on('barbaz', type=('build', 'link', 'run'))"""
|
|
||||||
|
|
||||||
body = """\
|
body = """\
|
||||||
# FIXME: If non-standard arguments are used for configure step:
|
def configure_args(self):
|
||||||
# def configure_args(self):
|
# FIXME: Add non-standard arguments
|
||||||
# return ['my', 'configure', 'args']
|
# FIXME: If not needed delete this function
|
||||||
|
args = []
|
||||||
# FIXME: in unusual cases, it may be necessary to override methods for
|
return args"""
|
||||||
# configure(), build(), check() or install()."""
|
|
||||||
|
|
||||||
def __init__(self, name, *args):
|
def __init__(self, name, *args):
|
||||||
# If the user provided `--name perl-cpp`, don't rename it perl-perl-cpp
|
# If the user provided `--name perl-cpp`, don't rename it perl-perl-cpp
|
||||||
|
@ -303,8 +297,7 @@ class PerlbuildPackageTemplate(PerlmakePackageTemplate):
|
||||||
depends_on('perl-module-build', type='build')
|
depends_on('perl-module-build', type='build')
|
||||||
|
|
||||||
# FIXME: Add additional dependencies if required:
|
# FIXME: Add additional dependencies if required:
|
||||||
# depends_on('perl-foo')
|
# depends_on('perl-foo', type=('build', 'run'))"""
|
||||||
# depends_on('barbaz', type=('build', 'link', 'run'))"""
|
|
||||||
|
|
||||||
|
|
||||||
class OctavePackageTemplate(PackageTemplate):
|
class OctavePackageTemplate(PackageTemplate):
|
||||||
|
@ -336,6 +329,19 @@ def __init__(self, name, *args):
|
||||||
super(OctavePackageTemplate, self).__init__(name, *args)
|
super(OctavePackageTemplate, self).__init__(name, *args)
|
||||||
|
|
||||||
|
|
||||||
|
class MakefilePackageTemplate(PackageTemplate):
|
||||||
|
"""Provides appropriate overrides for Makefile packages"""
|
||||||
|
|
||||||
|
base_class_name = 'MakefilePackage'
|
||||||
|
|
||||||
|
body = """\
|
||||||
|
def edit(self, spec, prefix):
|
||||||
|
# FIXME: Edit the Makefile if necessary
|
||||||
|
# FIXME: If not needed delete this function
|
||||||
|
# makefile = FileFilter('Makefile')
|
||||||
|
# makefile.filter('CC = .*', 'CC = cc')"""
|
||||||
|
|
||||||
|
|
||||||
templates = {
|
templates = {
|
||||||
'autotools': AutotoolsPackageTemplate,
|
'autotools': AutotoolsPackageTemplate,
|
||||||
'autoreconf': AutoreconfPackageTemplate,
|
'autoreconf': AutoreconfPackageTemplate,
|
||||||
|
@ -347,6 +353,7 @@ def __init__(self, name, *args):
|
||||||
'perlmake': PerlmakePackageTemplate,
|
'perlmake': PerlmakePackageTemplate,
|
||||||
'perlbuild': PerlbuildPackageTemplate,
|
'perlbuild': PerlbuildPackageTemplate,
|
||||||
'octave': OctavePackageTemplate,
|
'octave': OctavePackageTemplate,
|
||||||
|
'makefile': MakefilePackageTemplate,
|
||||||
'generic': PackageTemplate
|
'generic': PackageTemplate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,16 +408,17 @@ def __call__(self, stage, url):
|
||||||
# uses. If the regular expression matches a file contained in the
|
# uses. If the regular expression matches a file contained in the
|
||||||
# archive, the corresponding build system is assumed.
|
# archive, the corresponding build system is assumed.
|
||||||
clues = [
|
clues = [
|
||||||
(r'/configure$', 'autotools'),
|
('/configure$', 'autotools'),
|
||||||
(r'/configure.(in|ac)$', 'autoreconf'),
|
('/configure.(in|ac)$', 'autoreconf'),
|
||||||
(r'/Makefile.am$', 'autoreconf'),
|
('/Makefile.am$', 'autoreconf'),
|
||||||
(r'/CMakeLists.txt$', 'cmake'),
|
('/CMakeLists.txt$', 'cmake'),
|
||||||
(r'/SConstruct$', 'scons'),
|
('/SConstruct$', 'scons'),
|
||||||
(r'/setup.py$', 'python'),
|
('/setup.py$', 'python'),
|
||||||
(r'/NAMESPACE$', 'r'),
|
('/NAMESPACE$', 'r'),
|
||||||
(r'/WORKSPACE$', 'bazel'),
|
('/WORKSPACE$', 'bazel'),
|
||||||
(r'/Build.PL$', 'perlbuild'),
|
('/Build.PL$', 'perlbuild'),
|
||||||
(r'/Makefile.PL$', 'perlmake'),
|
('/Makefile.PL$', 'perlmake'),
|
||||||
|
('/(GNU)?[Mm]akefile$', 'makefile'),
|
||||||
]
|
]
|
||||||
|
|
||||||
# Peek inside the compressed file.
|
# Peek inside the compressed file.
|
||||||
|
@ -466,6 +474,8 @@ def get_name(args):
|
||||||
" Please report this bug. In the meantime, try running:",
|
" Please report this bug. In the meantime, try running:",
|
||||||
" `spack create --name <name> <url>`")
|
" `spack create --name <name> <url>`")
|
||||||
|
|
||||||
|
name = simplify_name(name)
|
||||||
|
|
||||||
if not valid_fully_qualified_module_name(name):
|
if not valid_fully_qualified_module_name(name):
|
||||||
tty.die("Package name can only contain a-z, 0-9, and '-'")
|
tty.die("Package name can only contain a-z, 0-9, and '-'")
|
||||||
|
|
||||||
|
@ -617,7 +627,6 @@ def create(parser, args):
|
||||||
url = get_url(args)
|
url = get_url(args)
|
||||||
versions, guesser = get_versions(args, name)
|
versions, guesser = get_versions(args, name)
|
||||||
build_system = get_build_system(args, guesser)
|
build_system = get_build_system(args, guesser)
|
||||||
name = simplify_name(name)
|
|
||||||
|
|
||||||
# Create the package template object
|
# Create the package template object
|
||||||
PackageClass = templates[build_system]
|
PackageClass = templates[build_system]
|
||||||
|
|
|
@ -40,6 +40,9 @@
|
||||||
('WORKSPACE', 'bazel'),
|
('WORKSPACE', 'bazel'),
|
||||||
('Makefile.PL', 'perlmake'),
|
('Makefile.PL', 'perlmake'),
|
||||||
('Build.PL', 'perlbuild'),
|
('Build.PL', 'perlbuild'),
|
||||||
|
('GNUmakefile', 'makefile'),
|
||||||
|
('makefile', 'makefile'),
|
||||||
|
('Makefile', 'makefile'),
|
||||||
('foobar', 'generic')
|
('foobar', 'generic')
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue