yade.libVersions module

The yade.libVersions module tracks versions of all libraries it was compiled with. Example usage is as follows:

from yade.libVersions import *
if(getVersion('cgal') > (4,9,0)):
        …
else:
        …

To obtain a list of all libraries use the function libVersions.printAllVersions.

All libraries listed in prerequisites are detected by this module.

Note

If we need a version of some library not listed in prerequisites, then it must also be added to that list.

yade.libVersions.getAllVersionsCmake()[source]

This function returns library versions as provided by cmake during compilation.

Returns:dictionary in following format: { "libName" : [ (major, minor, patchlevel) , "versionString" ] }

As an example the dict below reflects what libraries this documentation was compiled with (here are only those detected by CMAKE):

Yade [1]: from yade.libVersions import *

Yade [2]: getAllVersionsCmake()
Out[2]: 
{'boost': [(1, 65, 1), '106501'],
 'cmake': [(3, 10, 2), '3.10.2'],
 'eigen': [(3, 3, 4), '3.3.4'],
 'gcc': [(7, 4, 0), '7.4.0'],
 'ipython': [(5, 5, 0), '5.5.0'],
 'mpi': [(3, 1, 0), '3.1'],
 'numpy': [(1, 13, 3), '1.13.3'],
 'python': [(3, 6, 7), '3.6.7'],
 'sphinx': [(1, 6, 7), '1.6.7-final-0'],
 'suitesparse': [(5, 1, 2), '5.1.2'],
 'vtk': [(6, 3, 0), '6.3.0']}

Note

Please add here detection of other libraries when yade starts using them or if you discover how to extract from cmake a version which I didn’t add here.

yade.libVersions.getLinuxVersion()[source]
Returns:string containing linux release and version, preferably the value of PRETTY_NAME from file /etc/os-release.
yade.libVersions.getVersion(libName)[source]

This function returns the tuple (major, minor, patchlevel) with library version number. The yade --test in file py/tests/libVersions.py tests that this version is the same as detected by cmake and C++. If only one of those could detect the library version, then this number is used.

Parameters:libName (string) – the name of the library
Returns:tuple in format (major, minor, patchlevel)

Note

library openblas has no properly defined version in header files, this function will return (0,0,0) for openblas. Parsing the version string would be unreliable. The mpi version detected by cmake sometimes is different than version detected by C++, this needs further investigation.

yade.libVersions.printAllVersions(rstFormat=False)[source]

This function prints a nicely formatted table with library versions.

Parameters:rstFormat (bool) – whether to print table using the reStructuredText formatting. Defaults to False and prints using Gitlab markdown rules so that it is easy to paste into gitlab discussions.

As an example the table below actually reflects with what libraries this documentation was compiled:

Yade [1]: printAllVersions()

```
Yade version   :  2019-06-08.git-1a565d4
Yade features  :  Odeint VTK OpenMP GTS GUI-Qt5 CGAL PFVFLOW LINSOLV MPI TWOPHASEFLOW GL2PS LBMFLOW PotentialParticles PotentialBlocks
Yade config dir: ~/.yade-ci
```

Libraries used :

| library       | cmake           | C++                 |
| ------------- | --------------- | ------------------- |
| boost         | 106501          | 1.65.1              |
| cgal          |                 | 4.11                |
| clp           |                 | 1.16.11             |
| cmake         | 3.10.2          |                     |
| eigen         | 3.3.4           | 3.3.4               |
| freeglut      |                 | 13.4.1              |
| gcc           | 7.4.0           | 7.4.0               |
| gl            |                 | 20180725            |
| ipython       | 5.5.0           |                     |
| metis         |                 | 5.1.0               |
| mpi           | 3.1             | ompi:2.1.1          |
| numpy         | 1.13.3          |                     |
| openblas      |                 |  OpenBLAS 0.2.20    |
| python        | 3.6.7           | 3.6.7               |
| qglviewer     |                 | 2.6.3               |
| qt            |                 | 5.9.5               |
| sphinx        | 1.6.7-final-0   |                     |
| sqlite        |                 | 3.22.0              |
| suitesparse   | 5.1.2           | 5.1.2               |
| vtk           | 6.3.0           | 6.3.0               |

Linux version: Ubuntu 18.04.2 LTS

Note

For convenience at startup from yade.libVersions import printAllVersions is executed, so that this function is readily accessible.

yade._libVersions.getAllVersionsCpp() → dict

This function returns library versions as discovered by C++ during compilation from all the #include headers. This can be useful in debugging to detect some library .so conflicts.

Returns:dictionary in folowing format: { "libName" : [ (major, minor, patch) , "versionString" ] }

As an example the dict below reflects what libraries this documentation was compiled with (here are only those detected by C++):

Yade [1]: from yade.libVersions import *

Yade [2]: getAllVersionsCpp()
Out[2]: 
{'boost': [(1, 65, 1), '1.65.1'],
 'cgal': [(4, 11, 0), '4.11'],
 'clang': [],
 'clp': [(1, 16, 11), '1.16.11'],
 'eigen': [(3, 3, 4), '3.3.4'],
 'freeglut': [(13, 4, 1), '13.4.1'],
 'gcc': [(7, 4, 0), '7.4.0'],
 'gl': [(2018, 7, 25), '20180725'],
 'metis': [(5, 1, 0), '5.1.0'],
 'mpi': [(2, 1, 1), 'ompi:2.1.1'],
 'openblas': [(0, 0, 0), ' OpenBLAS 0.2.20 '],
 'python': [(3, 6, 7), '3.6.7'],
 'qglviewer': [(2, 6, 3), '2.6.3'],
 'qt': [(5, 9, 5), '5.9.5'],
 'sqlite': [(3, 22, 0), '3.22.0'],
 'suitesparse': [(5, 1, 2), '5.1.2'],
 'vtk': [(6, 3, 0), '6.3.0']}

Note

Please add here C++ detection of other libraries when yade starts using them.