Skip to content

Commit 1058686

Browse files
authored
Merge pull request #165 from Caylo/yeb-docs
yeb docs update
2 parents b472661 + 7b9471c commit 1058686

File tree

1 file changed

+118
-36
lines changed

1 file changed

+118
-36
lines changed

docs/Writing_yeb_easyconfig_files.rst

+118-36
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,20 @@ elsewhere too) can be done as follows::
117117
versionsuffix: !join [-Python-, *pyver]
118118

119119

120+
.. _easyconfig_yeb_format_syntax_escaping:
121+
122+
Escaping string values with single or double quotes
123+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
124+
125+
Strings in YAML can be unquoted. However, when they contain special characters they need to be escaped by either single-
126+
or double-quoting the string.
127+
128+
Special characters that require single quotes are: `:` `{` `}` `[` `]` `,` `&` `*` `#` `?` `|` `-` `<` `>` `=` `!` `%` `@` and `\``.
129+
When using single-quoted strings, any single quote inside the string must be doubled to escape it.
130+
131+
If the string contains control characters such as `\n`, it must be escaped with double quotes.
132+
133+
120134
.. _easyconfig_yeb_format_syntax_easyconfig_parameters:
121135

122136
Easyconfig parameter values
@@ -138,6 +152,7 @@ Using scalar values is straight-forward, no special syntax is required.
138152

139153
For string values, no quotes must be used (in general).
140154
However, quotes are sometimes required to escape characters that have special meaning in YAML (like '``:``').
155+
(Also see: :ref:`easyconfig_yeb_format_syntax_escaping`)
141156
It's worth noting that there's a subtle difference between using single and double quotes, see
142157
`Flow Scalar Styles <http://www.yaml.org/spec/1.2/spec.html#id2786942>`_.
143158

@@ -211,9 +226,9 @@ For example, sequence values can be used in a mapping::
211226

212227
And sequences of sequences are also supported::
213228

214-
dependencies:
215-
- [bzip2, 1.0.6]
216-
- [Python, 2.7.10]
229+
osdependencies
230+
- zlib
231+
- [openssl-devel, libssl-dev, libopenssl-devel]
217232

218233

219234
.. _easyconfig_yeb_format_syntax_template_values_constants:
@@ -238,19 +253,27 @@ See also :ref:`easyconfig_param_templates`.
238253
Dependencies
239254
~~~~~~~~~~~~
240255

241-
The list of (build) dependencies can be specified as list of lists, see also
242-
:ref:`easyconfig_yeb_format_syntax_nesting`.
256+
We updated the way dependencies are specified to match with the new toolchain format (:ref:`easyconfig_yeb_format_new`)
257+
The format is a bit more verbose than before, but easier to read. Each dependency is a list entry, indicated by a dash
258+
and space (`- `). Each entry can specify a ``name: version`` key-value pair, and a ``versionsuffix`` and ``toolchain``.
259+
Only the ``name: version`` pair is required.
260+
261+
Dependencies can also be external modules. In this case, the dependency has to be specified with a ``name`` and the marker
262+
``external_module: True``. The boolean value is not case-sensitive.
263+
243264

244265
A straightforward example::
245266

246-
dependencies: [
247-
[libreadline, 6.3],
248-
[Tcl, 8.6.4],
249-
]
250-
builddependencies: [
267+
dependencies:
268+
- libreadline: 6.3
269+
- Tcl: 8.6.4
270+
- name: fftw/3.3.4.4
271+
external_module: True
272+
273+
builddependencies:
251274
# empty versionsuffix, different toolchain (GCC/4.9.2)
252-
[CMake, 3.2.2, '', [GCC, 4.9.2],
253-
]
275+
- CMake: 3.2.2
276+
toolchain: GCC, 4.9.2
254277

255278
A more complicated example from a toolchain easyconfig, where also the ``!join`` operator
256279
(see :ref:`easyconfig_yeb_format_syntax_string_concatenation`) and internal variables
@@ -268,17 +291,69 @@ A more complicated example from a toolchain easyconfig, where also the ``!join``
268291

269292
- &comp_mpi_tc [gompi, 1.4.10]
270293

271-
dependencies: [
272-
*comp,
273-
[OpenMPI, 1.6.4, '', *comp],
274-
[*blaslib, *blasver, *blas_suff, *comp_mpi_tc],
275-
[FFTW, 3.3.3, '', *comp_mpi_tc],
276-
[ScaLAPACK, 2.0.2, !join [-, *blas, *blas_suff], *comp_mpi_tc]
277-
]
294+
dependencies:
295+
- *comp_name: *comp_version
296+
- OpenMPI: 1.6.4
297+
toolchain: *comp
298+
- *blaslib: *blasver
299+
versionsuffix: *blas_suff
300+
toolchain: *comp_mpi_tc
301+
- FFTW: 3.3.3
302+
toolchain: *comp_mpi_tc
303+
- ScaLAPACK: 2.0.2
304+
versionsuffix: !join [-, *blas, *blas_suff]
305+
toolchain: *comp_mpi_tc
278306

279307
For the full version of this easyconfig file, see the example ``.yeb`` easyconfig
280308
:ref:`easyconfig_yeb_format_examples_goolf1410`.
281309

310+
.. _easyconfig_yeb_format_new:
311+
312+
OS dependencies and sanity check paths
313+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
314+
315+
To specify parameters that used to contain tuples such as ``osdependencies`` and ``sanity_check_paths``, simply use
316+
lists (sequences) instead of tuples.
317+
318+
For example::
319+
320+
# note: this is eb syntax, will not work in .yeb files
321+
osdependencies = [('openssl-devel', 'libssl-dev', 'libopenssl-devel')]
322+
323+
Becomes::
324+
325+
osdependencies: [[openssl-devel, libssl-dev, libopenssl-devel]]
326+
327+
And::
328+
329+
# note: this is eb syntax, will not work in .yeb files
330+
sanity_check_paths = {
331+
'files': ['fileA', ('fileB', 'fileC')],
332+
'dirs' : ['dirA', 'dirB'],
333+
}
334+
335+
Becomes::
336+
337+
sanity_check_paths: {
338+
files: [fileA, [fileB, fileC]],
339+
dirs: [dirA, dirB]
340+
}
341+
342+
Shorthands for common easyconfig parameters
343+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
344+
345+
Toolchain format
346+
################
347+
348+
The easyconfig parameter ``toolchain`` in .eb files is defined as a dictionary ``{'name':'foo', 'version':'bar'}``. In
349+
the .yeb format, this can be done much easier by just using ``name, version``. E.g::
350+
351+
# note: this is eb syntax, will not work in yeb files
352+
toolchain = {'name':'intel', 'version':'2015b'}
353+
354+
becomes::
355+
356+
toolchain: intel, 2015b
282357

283358
.. _easyconfig_yeb_format_examples:
284359

@@ -306,7 +381,7 @@ Example easyconfig for gzip v1.6 using the ``GCC/4.9.2`` toolchain.
306381
gzip is a popular data compression program
307382
as a replacement for compress
308383
309-
toolchain: {name: GCC, version: 4.9.2}
384+
toolchain: GCC, 4.9.2
310385
311386
# http://ftp.gnu.org/gnu/gzip/gzip-1.6.tar.gz
312387
source_urls: [*GNU_SOURCE]
@@ -359,13 +434,18 @@ Easyconfig file in YAML syntax for the goolf v1.4.10 toolchain.
359434
# compiler toolchain dependencies
360435
# we need GCC and OpenMPI as explicit dependencies instead of gompi toolchain
361436
# because of toolchain preperation functions
362-
dependencies: [
363-
*comp,
364-
[OpenMPI, 1.6.4, '', *comp],
365-
[*blaslib, *blasver, *blas_suff, *comp_mpi_tc],
366-
[FFTW, 3.3.3, '', *comp_mpi_tc],
367-
[ScaLAPACK, 2.0.2, !join [-, *blas, *blas_suff], *comp_mpi_tc]
368-
]
437+
dependencies:
438+
- *comp_name: *comp_version
439+
- OpenMPI: 1.6.4
440+
toolchain: *comp
441+
- *blaslib: *blasver
442+
versionsuffix: *blas_suff
443+
toolchain: *comp_mpi_tc
444+
- FFTW: 3.3.3
445+
toolchain: *comp_mpi_tc
446+
- ScaLAPACK: 2.0.2
447+
versionsuffix: !join [-, *blas, *blas_suff]
448+
toolchain: *comp_mpi_tc
369449
370450
moduleclass: toolchain
371451
@@ -390,22 +470,24 @@ Python-2.7.10-intel-2015b.yeb
390470
Python is a programming language that lets you work more quickly and integrate your systems
391471
more effectively.
392472
393-
toolchain: {name: intel, version: 2015b}
473+
toolchain: intel, 2015b
394474
toolchainopts: {pic: True, opt: True, optarch: True}
395475
396476
source_urls: ['http://www.python.org/ftp/python/%(version)s/']
397477
sources: [*SOURCE_TGZ]
398478
399479
# python needs bzip2 to build the bz2 package
400480
dependencies: [
401-
[bzip2, 1.0.6],
402-
[zlib, 1.2.8],
403-
[libreadline, '6.3'],
404-
[ncurses, '5.9'],
405-
[SQLite, 3.8.10.2],
406-
[Tk, 8.6.4, -no-X11],
407-
# [OpenSSL, 1.0.1m], # OS dependency should be preferred if the os version is more recent then this version, its
408-
# nice to have an up to date openssl for security reasons
481+
- bzip2: 1.0.6
482+
- zlib: 1.2.8
483+
- libreadline: 6.3
484+
- ncurses: 5.9
485+
- SQLite: 3.8.10.2
486+
- Tk: 8.4.6
487+
versionsuffix: -no-X11
488+
# - OpenSSL: 1.0.1m
489+
# OS dependency should be preferred if the os version is more recent then this version, its
490+
# nice to have an up to date openssl for security reasons
409491
]
410492
411493
osdependencies: [[openssl-devel, libssl-dev, libopenssl-devel]]

0 commit comments

Comments
 (0)