Skip to content

Commit 4466188

Browse files
committed
Merge pull request #5 from boegel/feature_package_step_w_fpm
cleanup of support for packaging + kickstart unit tests related to packaging support
2 parents 76bb33a + d5abf40 commit 4466188

7 files changed

Lines changed: 244 additions & 133 deletions

File tree

easybuild/tools/options.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,10 @@
4848
from easybuild.framework.easyconfig.templates import template_documentation
4949
from easybuild.framework.easyconfig.tools import get_paths_for
5050
from easybuild.framework.extension import Extension
51-
from easybuild.tools import build_log, config, run # @UnusedImport make sure config is always initialized!
51+
from easybuild.tools import build_log, config, run # build_log should always stay there, to ensure EasyBuildLog
5252
from easybuild.tools.build_log import EasyBuildError, raise_easybuilderror
5353
from easybuild.tools.config import DEFAULT_LOGFILE_FORMAT, DEFAULT_MNS, DEFAULT_MODULE_SYNTAX, DEFAULT_MODULES_TOOL
54-
from easybuild.tools.config import DEFAULT_MODULECLASSES, DEFAULT_PATH_SUBDIRS
55-
from easybuild.tools.config import DEFAULT_PREFIX, DEFAULT_REPOSITORY
54+
from easybuild.tools.config import DEFAULT_MODULECLASSES, DEFAULT_PATH_SUBDIRS, DEFAULT_PREFIX, DEFAULT_REPOSITORY
5655
from easybuild.tools.config import DEFAULT_STRICT, get_pretend_installpath, mk_full_default_path
5756
from easybuild.tools.configobj import ConfigObj, ConfigObjError
5857
from easybuild.tools.docs import FORMAT_RST, FORMAT_TXT, avail_easyconfig_params
@@ -63,9 +62,7 @@
6362
from easybuild.tools.module_naming_scheme.utilities import avail_module_naming_schemes
6463
from easybuild.tools.modules import Lmod
6564
from easybuild.tools.ordereddict import OrderedDict
66-
import easybuild.tools.package.utilities as packaging
67-
from easybuild.tools.package.utilities import DEFAULT_PNS
68-
from easybuild.tools.package.activepns import avail_package_naming_scheme
65+
from easybuild.tools.package.utilities import DEFAULT_PNS, avail_package_naming_schemes, check_pkg_support
6966
from easybuild.tools.toolchain.utilities import search_toolchain
7067
from easybuild.tools.repository.repository import avail_repositories
7168
from easybuild.tools.version import this_is_easybuild
@@ -267,7 +264,7 @@ def config_options(self):
267264
'packagepath': ("The destination path for the packages built by package-tool",
268265
None, 'store', mk_full_default_path('packagepath')),
269266
'package-naming-scheme': ("Packaging naming scheme choice",
270-
'choice', 'store', DEFAULT_PNS, sorted(avail_package_naming_scheme().keys())),
267+
'choice', 'store', DEFAULT_PNS, sorted(avail_package_naming_schemes().keys())),
271268
'prefix': (("Change prefix for buildpath, installpath, sourcepath and repositorypath "
272269
"(used prefix for defaults %s)" % DEFAULT_PREFIX),
273270
None, 'store', None),
@@ -472,15 +469,12 @@ def postprocess(self):
472469

473470
self._postprocess_config()
474471

475-
#Check experimental option dependencies (for now packaging)
476-
#print "Got config_options: %s" % packaging.config_options
477-
package_options = [ getattr(self.options, x) for x in packaging.config_options if getattr(self.options, x) ]
478-
if any( package_options ):
479-
packaging.option_postprocess()
472+
# check whether packaging is supported when it's being used
473+
if any([self.options.package_tool, self.options.package_type]):
474+
check_pkg_support()
480475
else:
481476
self.log.debug("Didn't find any packaging options")
482477

483-
484478
def _postprocess_external_modules_metadata(self):
485479
"""Parse file(s) specifying metadata for external modules."""
486480
# leave external_modules_metadata untouched if no files are provided

easybuild/tools/package/activepns.py

Lines changed: 0 additions & 50 deletions
This file was deleted.

easybuild/tools/package/packaging_naming_scheme/easybuild_pns.py

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,31 @@
1-
2-
3-
1+
##
2+
# Copyright 2015-2015 Ghent University
3+
#
4+
# This file is part of EasyBuild,
5+
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
6+
# with support of Ghent University (http://ugent.be/hpc),
7+
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
8+
# the Hercules foundation (http://www.herculesstichting.be/in_English)
9+
# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en).
10+
#
11+
# http://github.com/hpcugent/easybuild
12+
#
13+
# EasyBuild is free software: you can redistribute it and/or modify
14+
# it under the terms of the GNU General Public License as published by
15+
# the Free Software Foundation v2.
16+
#
17+
# EasyBuild is distributed in the hope that it will be useful,
18+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
# GNU General Public License for more details.
21+
#
22+
# You should have received a copy of the GNU General Public License
23+
# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>.
24+
##
425
"""
5-
Default implementation of the EasyBuild packaging naming scheme
26+
Implementation of the EasyBuild packaging naming scheme
627
7-
@author: Rob Schmidt (Ottawa Hospital Research Institute)
28+
@author: Robert Schmidt (Ottawa Hospital Research Institute)
829
@author: Kenneth Hoste (Ghent University)
930
"""
1031

@@ -17,6 +38,7 @@ class EasyBuildPNS(PackagingNamingScheme):
1738
REQUIRED_KEYS = ['name', 'version', 'versionsuffix', 'toolchain']
1839

1940
def name(self, ec):
41+
"""Determine package name"""
2042
self.log.debug("easyconfig dict for name looks like %s " % ec )
2143
name_template = "eb%(eb_ver)s-%(name)s-%(version)s-%(toolchain)s"
2244
pkg_name = name_template % {
@@ -28,10 +50,10 @@ def name(self, ec):
2850
return pkg_name
2951

3052
def _toolchain(self, ec):
53+
"""Determine toolchain"""
3154
toolchain_template = "%(toolchain_name)s-%(toolchain_version)s"
3255
pkg_toolchain = toolchain_template % {
3356
'toolchain_name': ec['toolchain']['name'],
3457
'toolchain_version': ec['toolchain']['version'],
3558
}
3659
return pkg_toolchain
37-
Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,55 @@
1-
1+
##
2+
# Copyright 2015-2015 Ghent University
3+
#
4+
# This file is part of EasyBuild,
5+
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
6+
# with support of Ghent University (http://ugent.be/hpc),
7+
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
8+
# the Hercules foundation (http://www.herculesstichting.be/in_English)
9+
# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en).
10+
#
11+
# http://github.com/hpcugent/easybuild
12+
#
13+
# EasyBuild is free software: you can redistribute it and/or modify
14+
# it under the terms of the GNU General Public License as published by
15+
# the Free Software Foundation v2.
16+
#
17+
# EasyBuild is distributed in the hope that it will be useful,
18+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
# GNU General Public License for more details.
21+
#
22+
# You should have received a copy of the GNU General Public License
23+
# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>.
24+
##
25+
26+
"""
27+
General package naming scheme.
28+
29+
@author: Robert Schmidt (Ottawa Hospital Research Institute)
30+
@author: Kenneth Hoste (Ghent University)
31+
"""
232
from vsc.utils import fancylogger
333
from easybuild.tools.config import build_option
434
from easybuild.tools.version import VERSION as EASYBUILD_VERSION
5-
options = [ "package-naming-name-template", "package-naming-version-template", "package-naming-toolchain-template" ]
635

7-
class PackagingNamingScheme(object):
8-
"""Abstract class for package naming scheme"""
936

37+
class PackagingNamingScheme(object):
38+
"""Abstract class for package naming schemes"""
1039

11-
def __init__(self, *args, **kwargs):
40+
def __init__(self):
1241
"""initialize logger."""
1342
self.log = fancylogger.getLogger(self.__class__.__name__, fname=False)
1443
self.eb_ver = EASYBUILD_VERSION
1544

16-
def name(self,ec):
17-
"""Return name of the package, by default would include name, version, toolchain"""
45+
def name(self, ec):
46+
"""Determine package name"""
1847
raise NotImplementedError
19-
20-
def version(self,ec):
21-
"""The version in the version part of the package"""
22-
return ec['version']
23-
24-
def release(self,ec=None):
25-
"""Just the release"""
26-
return build_option('package_release')
2748

49+
def version(self, ec):
50+
"""Determine package version"""
51+
return ec['version']
2852

53+
def release(self, ec=None):
54+
"""Determine package release"""
55+
return build_option('package_release')

0 commit comments

Comments
 (0)