コード例 #1
0
ファイル: buildcache.py プロジェクト: wrwilliams/spack
def _concrete_spec_from_args(args):
    spec_str, specfile_path = args.spec, args.spec_file

    if not spec_str and not specfile_path:
        tty.error(
            'must provide either spec string or path to YAML or JSON specfile')
        sys.exit(1)

    if spec_str:
        try:
            constraints = spack.cmd.parse_specs(spec_str)
            spec = spack.store.find(constraints)[0]
            spec.concretize()
        except SpecError as spec_error:
            tty.error('Unable to concretize spec {0}'.format(spec_str))
            tty.debug(spec_error)
            sys.exit(1)

        return spec

    return Spec.from_specfile(specfile_path)