spack/lib/spack
Massimiliano Culpo 5d7901b312 Improve Spec literals, add Spec.from_dict() (#5151)
* Simplified Spec.__init__ signature by removing the *dep_like argument.

The `*dep_like` argument of `Spec.__init__` is used only for tests. This
PR removes it from the call signature and introduces an equivalent
fixture to be used in tests.

* Refactored ``spec_from_dict`` to be a static method of ``Spec``

The fixture ``spec_from_dict`` has been refactored to be a static method
of ``Spec``. Test code has been updated accordingly. Added tests for
exceptional paths.

* Renamed argument `unique` to `normal` + added LazySpecCache class

As requested in the review the argument `unique` of `Spec.from_literal`
has been renamed to `normal`. To avoid eager evaluations of
`Spec(spec_like)` expressions a subclass of `collections.defaultdict`
has been introduced.

* Spec object can be keys of the dictionary for a spec literal.

Added back the possibility use a spec directly as a key. This permits
to build DAGs that are partially normalized.
2017-08-23 14:20:40 -07:00
..
docs Add environment variables to path substitution 2017-08-21 18:35:00 -07:00
env Make LICENSE recognizable by GitHub. (#4598) 2017-06-24 22:22:55 -07:00
external Make LICENSE recognizable by GitHub. (#4598) 2017-06-24 22:22:55 -07:00
llnl log_ouptut can take either a filename or a file object 2017-08-22 16:14:38 -07:00
spack Improve Spec literals, add Spec.from_dict() (#5151) 2017-08-23 14:20:40 -07:00