MCPcopy
hub / github.com/pex-tool/pex / BuildConfiguration

Class BuildConfiguration

pex/resolve/resolver_configuration.py:60–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58
59@attr.s(frozen=True)
60class BuildConfiguration(object):
61 class Error(ValueError):
62 """Indicates a build configuration error."""
63
64 @classmethod
65 def create(
66 cls,
67 allow_builds=True, # type: bool
68 only_builds=(), # type: Iterable[ProjectName]
69 allow_wheels=True, # type: bool
70 only_wheels=(), # type: Iterable[ProjectName]
71 prefer_older_binary=False, # type: bool
72 use_pep517=None, # type: Optional[bool]
73 build_isolation=True, # type: bool
74 use_system_time=False, # type: bool
75 honor_editable=True, # type: bool
76 ):
77 # type: (...) -> BuildConfiguration
78 return cls(
79 allow_builds=allow_builds,
80 only_builds=frozenset(only_builds),
81 allow_wheels=allow_wheels,
82 only_wheels=frozenset(only_wheels),
83 prefer_older_binary=prefer_older_binary,
84 use_pep517=use_pep517,
85 build_isolation=build_isolation,
86 use_system_time=use_system_time,
87 honor_editable=honor_editable,
88 )
89
90 allow_builds = attr.ib(default=True) # type: bool
91 only_builds = attr.ib(default=frozenset()) # type: FrozenSet[ProjectName]
92 allow_wheels = attr.ib(default=True) # type: bool
93 only_wheels = attr.ib(default=frozenset()) # type: FrozenSet[ProjectName]
94 prefer_older_binary = attr.ib(default=False) # type: bool
95 use_pep517 = attr.ib(default=None) # type: Optional[bool]
96 build_isolation = attr.ib(default=True) # type: bool
97 use_system_time = attr.ib(default=False) # type: bool
98 honor_editable = attr.ib(default=True) # type: bool
99
100 def __attrs_post_init__(self):
101 # type: () -> None
102 if not self.allow_builds and not self.allow_wheels:
103 raise self.Error(
104 "Cannot both disallow builds and disallow wheels. Please allow one of these or "
105 "both so that some distributions can be resolved."
106 )
107
108 contradictory_only = self.only_builds.intersection(self.only_wheels)
109 if contradictory_only:
110 raise self.Error(
111 "The following project names were specified as only being allowed to be built and "
112 "only allowed to be resolved as pre-built wheels, please pick one or the other for "
113 "each: {contradictory_only}".format(
114 contradictory_only=", ".join(sorted(map(str, contradictory_only)))
115 )
116 )
117

Callers 15

_PipSessionClass · 0.90
__init__Method · 0.90
__init__Method · 0.90
resolveFunction · 0.90
_download_internalFunction · 0.90
downloadFunction · 0.90
download_requestsFunction · 0.90
reportsFunction · 0.90
resolveMethod · 0.90
resolve_from_pylockFunction · 0.90
download_from_pylockFunction · 0.90
resolve_from_pex_lockFunction · 0.90

Calls

no outgoing calls

Tested by 2

test_roundtripFunction · 0.72