diff options
author | Mario Melara <maamelara@gmail.com> | 2016-02-25 18:48:00 -0800 |
---|---|---|
committer | Mario Melara <maamelara@gmail.com> | 2016-02-25 18:48:00 -0800 |
commit | f0149faf88b97b63635ba451efe008846478d115 (patch) | |
tree | 0910cacf8ac72ccbf0c87d578171665fbc697948 /lib | |
parent | ac55ce989d0b5a6e7a1160dc32ac7fb12f805f76 (diff) | |
download | spack-f0149faf88b97b63635ba451efe008846478d115.tar.gz spack-f0149faf88b97b63635ba451efe008846478d115.tar.bz2 spack-f0149faf88b97b63635ba451efe008846478d115.tar.xz spack-f0149faf88b97b63635ba451efe008846478d115.zip |
Added doc strings to functions in architecture.py
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/architecture.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/spack/spack/architecture.py b/lib/spack/spack/architecture.py index 7bf5afcf63..14a8c56793 100644 --- a/lib/spack/spack/architecture.py +++ b/lib/spack/spack/architecture.py @@ -222,6 +222,12 @@ def _helper_to_dict(arch_field_dict, arch_field_name, *args): return d def to_dict(arch): + """ Convert the Arch tuple into a dictionary for yaml dumping. This + uses the _helper_to_dict method to create the dictionary from the + provided architecture field. Can assign the architecture + field name (either platform, platform_os or target) and any + attributes that make up that architecture field, + """ d = {} platform = arch.platform.__dict__ @@ -241,12 +247,19 @@ def to_dict(arch): return d def _platform_from_dict(platform): + """Creates all the platform class module names into a dictionary of + name : <class_mod> key-value pairs. From there we can construct the + platform subclass + """ platform_list = all_platforms() platform_names = {plat.__name__.lower():plat for plat in platform_list} return platform_names[platform['name']]() def _target_from_dict(target_dict): + """ Creates new instance of target and assigns all the attributes of + that target from the dictionary + """ target = Target.__new__(Target) target.name = target_dict['name'] #target.compiler_strategy = target_dict['compiler_strategy'] @@ -256,11 +269,19 @@ def _target_from_dict(target_dict): return target def _operating_system_from_dict(os_dict, platform_class): + """ uses platform's operating system method to grab the constructed + operating systems that are valid on the platform. + """ +# NOTE: Might need a better way to create operating system objects name = os_dict['name'] return platform_class.operating_system(name) def arch_from_dict(d): + """ Uses _platform_from_dict, _operating_system_from_dict, _target_from_dict + helper methods to recreate the arch tuple from the dictionary read from + a yaml file + """ if d is None: return None platform_dict = d['platform'] |