Skip to content

Commit

Permalink
make final simplifications
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmicexplorer committed Feb 20, 2018
1 parent a4ebbbd commit 1cfd60a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
10 changes: 8 additions & 2 deletions src/python/pants/backend/python/targets/python_distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from pants.backend.python.targets.python_library import PythonLibrary
from pants.backend.python.targets.python_target import PythonTarget
from pants.base.exceptions import TargetDefinitionException
from pants.base.payload import Payload
from pants.source.payload_fields import SourcesField
from pants.source.wrapped_globs import FilesetWithSpec
Expand All @@ -30,14 +31,19 @@ def alias(cls):
'*.cc',
] + list(PythonLibrary.default_sources_globs)

def __init__(self, sources=None, **kwargs):
def __init__(self, sources=None, provides=None, **kwargs):
"""
:param sources: Files to "include". Paths are relative to the
BUILD file's directory.
:type sources: ``Fileset`` or list of strings. Must include setup.py.
"""
if provides is not None:
raise TargetDefinitionException(
self, "A PythonDistribution may not have a provides parameter "
"(parameter was: '{}').".format(repr(provides)))

super(PythonDistribution, self).__init__(
sources=sources, **kwargs)
sources=sources, provides=provides, **kwargs)

if not 'setup.py' in sources:
raise TargetDefinitionException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ def implementation_version(cls):

@classmethod
def subsystem_dependencies(cls):
return super(BuildLocalPythonDistributions, cls).subsystem_dependencies() + (
LLVM.scoped(cls),
)
return super(BuildLocalPythonDistributions, cls).subsystem_dependencies() + (LLVM.scoped(cls),)

@memoized_property
def llvm_base_dir(self):
Expand Down Expand Up @@ -94,7 +92,6 @@ def _copy_sources(self, dist_tgt, dist_target_dir):
# NB: The directory structure of the destination directory needs to match 1:1
# with the directory structure that setup.py expects.
all_sources = list(dist_tgt.sources_relative_to_target_base())
self.context.log.debug('all_sources: {}'.format(all_sources))
for src_relative_to_target_base in all_sources:
src_rel_to_results_dir = os.path.join(dist_target_dir, src_relative_to_target_base)
safe_mkdir(os.path.dirname(src_rel_to_results_dir))
Expand Down

0 comments on commit 1cfd60a

Please sign in to comment.