def __init__(self, context): self.context = context self._cache_key_generator = CacheKeyGenerator() # TODO: Shared, remote build cache. self._artifact_cache = ArtifactCache( context.config.get('tasks', 'artifact_cache')) self._build_invalidator_dir = os.path.join( context.config.get('tasks', 'build_invalidator'), self.product_type())
def __init__(self, target, root_dir, extra_targets=None, builder=None): self._config = Config.load() self._target = target self._root = root_dir self._key_generator = CacheKeyGenerator() artifact_cache_root = \ os.path.join(self._config.get('python-setup', 'artifact_cache'), '%s' % PythonIdentity.get()) self._artifact_cache = ArtifactCache(artifact_cache_root) self._extra_targets = list( extra_targets) if extra_targets is not None else [] self._resolver = PythonResolver([self._target] + self._extra_targets) self._builder = builder or PEXBuilder(tempfile.mkdtemp()) self._platforms = (Platform.current(), ) self._pythons = (sys.version[:3], ) # TODO(wickman) Should this be in the binary builder? if isinstance(self._target, PythonBinary): self._platforms = self._target._platforms self._pythons = self._target._interpreters
def test_env(content=TEST_CONTENT): with temporary_dir() as d: with tempfile.NamedTemporaryFile() as f: f.write(content) f.flush() yield f, ArtifactCache(d)