From c7c90b21836d372fc0cc81ead3b9812e7abf5674 Mon Sep 17 00:00:00 2001 From: Daniel McClanahan <1305167+cosmicexplorer@users.noreply.github.com> Date: Fri, 16 Feb 2018 07:20:37 -0800 Subject: [PATCH] refactor unnecessary complexity --- .../backend/python/tasks/python_binary_create.py | 5 +---- .../python/tasks/resolve_requirements_task_base.py | 11 +++++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/python/pants/backend/python/tasks/python_binary_create.py b/src/python/pants/backend/python/tasks/python_binary_create.py index a7a4cbc2345..c37cda9cff4 100644 --- a/src/python/pants/backend/python/tasks/python_binary_create.py +++ b/src/python/pants/backend/python/tasks/python_binary_create.py @@ -138,14 +138,12 @@ def _create_binary(self, binary_tgt, results_dir): if built_dists is not None: synthetic_address = ':'.join(2 * [binary_tgt.invalidation_hash()]) - local_dist_req_libs = inject_synthetic_dist_requirements( self.context.build_graph, built_dists, synthetic_address, in_tgts=binary_tgt.closure()) - if len(local_dist_req_libs) != 0: - req_tgts = local_dist_req_libs + req_tgts + req_tgts = local_dist_req_libs + req_tgts for dist in built_dists: # Ensure only python_dist dependencies of binary_tgt are added to the output pex. @@ -154,7 +152,6 @@ def _create_binary(self, binary_tgt, results_dir): if any([tgt.id in dist for tgt in binary_tgt.closure(exclude_scopes=Scopes.COMPILE)]): builder.add_dist_location(dist) - dump_requirements(builder, interpreter, req_tgts, self.context.log, binary_tgt.platforms) # Build the .pex file. diff --git a/src/python/pants/backend/python/tasks/resolve_requirements_task_base.py b/src/python/pants/backend/python/tasks/resolve_requirements_task_base.py index 093bd6462eb..6400b995f4b 100644 --- a/src/python/pants/backend/python/tasks/resolve_requirements_task_base.py +++ b/src/python/pants/backend/python/tasks/resolve_requirements_task_base.py @@ -61,10 +61,13 @@ def resolve_requirements(self, req_libs, local_dist_targets=None): with safe_concurrent_creation(path) as safe_path: # Handle locally-built python distribution dependencies. built_dists = self.context.products.get_data(BuildLocalPythonDistributions.PYTHON_DISTS) - if built_dists: - req_libs = inject_synthetic_dist_requirements(self.context.build_graph, - built_dists, - ':'.join(2 * [target_set_id])) + req_libs + if built_dists is not None: + synthetic_address = ':'.join(2 * [target_set_id]) + local_dist_req_libs = inject_synthetic_dist_requirements( + self.context.build_graph, + built_dists, + synthetic_address) + req_libs = local_dist_req_libs + req_libs self._build_requirements_pex(interpreter, safe_path, req_libs) return PEX(path, interpreter=interpreter)