Skip to content

Commit

Permalink
remove more implementation artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmicexplorer committed Feb 20, 2018
1 parent 88851f1 commit 7783678
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 27 deletions.
2 changes: 0 additions & 2 deletions src/python/pants/backend/codegen/protobuf/subsystem/protoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)

import os

from pants.binaries.binary_tool import NativeTool


Expand Down
2 changes: 0 additions & 2 deletions src/python/pants/backend/python/tasks/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ python_library(
'3rdparty/python/twitter/commons:twitter.common.collections',
'3rdparty/python/twitter/commons:twitter.common.dirutil',
'src/python/pants/backend/native',
# FIXME: why does this still work?
# 'src/python/pants/backend/python:sandboxed_interpreter',
'src/python/pants/backend/python:python_requirement',
'src/python/pants/backend/python:python_requirements',
'src/python/pants/backend/python:interpreter_cache',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,31 +63,31 @@ def cache_target_dirs(self):

def execute(self):
dist_targets = self.context.targets(is_local_python_dist)
build_graph = self.context.build_graph

if dist_targets:
with self.invalidated(dist_targets,
fingerprint_strategy=DefaultFingerprintStrategy(),
invalidate_dependents=True) as invalidation_check:
interpreter = self.context.products.get_data(PythonInterpreter)
sandboxed_interpreter = SandboxedInterpreter(self.llvm_base_dir, interpreter)

for vt in invalidation_check.invalid_vts:
if vt.target.dependencies:
raise TargetDefinitionException(
vt.target, 'The `dependencies` field is disallowed on `python_dist` targets. '
'List any 3rd party requirements in the install_requirements argument '
'of your setup function.'
)
self._create_dist(vt.target, vt.results_dir)
self._create_dist(vt.target, vt.results_dir, sandboxed_interpreter)

for vt in invalidation_check.all_vts:
dist = self._get_whl_from_dir(os.path.join(vt.results_dir, 'dist'))
req_lib_addr = Address.parse('{}__req_lib'.format(vt.target.address.spec))
self._inject_synthetic_dist_requirements(dist, req_lib_addr)
# Make any target that depends on the dist depend on the synthetic req_lib,
# for downstream consumption.
for dependent in build_graph.dependents_of(vt.target.address):
build_graph.inject_dependency(dependent, req_lib_addr)

self.context.products.register_data(self.PYTHON_DISTS, built_dists)
for dependent in self.context.build_graph.dependents_of(vt.target.address):
self.context.build_graph.inject_dependency(dependent, req_lib_addr)

def _copy_sources(self, dist_tgt, dist_target_dir):
# Copy sources and setup.py over to vt results directory for packaging.
Expand All @@ -103,12 +103,9 @@ def _copy_sources(self, dist_tgt, dist_target_dir):
src_relative_to_target_base)
shutil.copyfile(abs_src_path, src_rel_to_results_dir)

def _create_dist(self, dist_tgt, dist_target_dir):
def _create_dist(self, dist_tgt, dist_target_dir, sandboxed_interpreter):
"""Create a .whl file for the specified python_distribution target."""
self.context.log.debug("dist_target_dir: '{}'".format(dist_target_dir))
interpreter = self.context.products.get_data(PythonInterpreter)
sandboxed_interpreter = SandboxedInterpreter(
self.llvm_base_dir, interpreter)
self._copy_sources(dist_tgt, dist_target_dir)
# Build a whl using SetupPyRunner and return its absolute path.
setup_runner = SetupPyRunner(dist_target_dir, 'bdist_wheel', interpreter=sandboxed_interpreter)
Expand Down Expand Up @@ -136,5 +133,5 @@ def _get_whl_from_dir(install_dir):
if len(dists) == 0:
raise TaskError('No distributions were produced by python_create_distribution task.')
if len(dists) > 1:
raise TaskError('Ambiguous local python distributions found: %s' % (' '.join(dists)))
raise TaskError('Ambiguous local python distributions found: {}'.format(dists))
return dists[0]
2 changes: 1 addition & 1 deletion src/python/pants/bin/engine_initializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __init__(self, build_file_aliases):
self._table[alias] = JavaLibraryAdaptor
for alias in ['scala_library', 'scalac_plugin']:
self._table[alias] = ScalaLibraryAdaptor
for alias in ['python_library', 'pants_plugin', 'python_dist']:
for alias in ['python_library', 'pants_plugin']:
self._table[alias] = PythonLibraryAdaptor
for alias in ['go_library', 'go_binary']:
self._table[alias] = GoTargetAdaptor
Expand Down
10 changes: 0 additions & 10 deletions src/python/pants/binaries/binary_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)

import os

from pants.binaries.binary_util import BinaryUtil
from pants.subsystem.subsystem import Subsystem
from pants.util.memo import memoized_method, memoized_property
Expand Down Expand Up @@ -108,18 +106,10 @@ class NativeTool(BinaryToolBase):
"""
platform_dependent = True

@classmethod
def support_dir_paths(cls):
return super(NativeTool, cls).support_dir_paths() + ['bin']


class Script(BinaryToolBase):
"""A base class for platform-independent scripts.
:API: public
"""
platform_dependent = False

@classmethod
def support_dir_paths(cls):
return super(Script, cls).support_dir_paths() + ['scripts']
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <Python.h>

static PyObject * super_greet(PyObject *self, PyObject *args) {
return Py_BuildValue("s", "Super hello!");
return Py_BuildValue("s", "Super hello");
}

static PyMethodDef Methods[] = {
Expand Down

0 comments on commit 7783678

Please sign in to comment.