hpcugent/easybuild-framework — pull request #543 by boegel (2013-03-18 22:53:41+00:00)
Title: add support for determining system name and version

This is based on the data collected in https://github.com/hpcugent/easybuild/wiki/OS_flavor_name_version, and is required to pick a CUDA package from the list of available packages, see https://developer.nvidia.com/cuda-downloads.

Not sure if I'm 100% happy with the code. It should probably be avoided to be used if possible, but sometimes we're forced to, e.g.:

An example of usage (excerpt from tested draft easyconfig file for CUDA, cfr. https://github.com/fgeorgatos/easybuild.experimental/tree/master/users/georgets/c/CUDA):

```python
name = "CUDA"
version = "5.0.35"
versionsuffix = "-1"

# exhaustive list of all known versions
if SYSTEM_NAME == 'fedora' and SYSTEM_VERSION == '16':
system = 'fedora16'
elif SYSTEM_NAME in ["RHEL", "centos", "redhat", "SL"]:
system = 'rhel%s.x' % SYSTEM_VERSION.split('.')[0]
elif SYSTEM_NAME in ['debian', 'ubuntu']:
if SYSTEM_VERSION in ['11.10', '10.04']:
system = 'ubuntu%s' % SYSTEM_VERSION
else:
system = 'ubuntu11.10'
elif SYSTEM_NAME == "opensuse" and SYSTEM_VERSION == '12.1':
system = 'suse12.1'
elif SYSTEM_NAME == "suse" and SYSTEM_VERSION.startswith('11_SP'):
system = 'sles%s' % SYSTEM_VERSION.lower().replace('_', '')
else:
system = 'UNKNOWN'

sources = ['%s_%s_linux_64_%s%s.run' % (name.lower(), version, system, versionsuffix)]
```