Skip to content

Commit

Permalink
Fix setup.py install_requires post targets refactor.
Browse files Browse the repository at this point in the history
With the target refactor PythonRequirementLibrary is now used rather than
PythonRequirement when generating setup.py install_requires. At present this
field is not populated leading to missing requirements and unisntallable
pants-generated sdist's.

Testing Done:
./build-support/bin/ci.sh

Confirmed setup.py install_requires is now populated.

Reviewed at https://rbcommons.com/s/twitter/r/368/
  • Loading branch information
traviscrawford authored and Travis Crawford committed May 16, 2014
1 parent 1dcc04c commit 3497401
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/python/pants/commands/setup_py.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,15 @@
from twitter.common.python.compatibility import string, to_bytes
from twitter.common.python.installer import InstallerBase, Packager

from pants.base.address import Address
from pants.base.build_environment import get_buildroot
from pants.base.config import Config
from pants.base.target import Target
from pants.base.exceptions import TargetDefinitionException
from pants.commands.command import Command
from pants.python.antlr_builder import PythonAntlrBuilder
from pants.python.thrift_builder import PythonThriftBuilder
from pants.targets.python_antlr_library import PythonAntlrLibrary
from pants.targets.python_binary import PythonBinary
from pants.targets.python_requirement import PythonRequirement
from pants.targets.python_requirement_library import PythonRequirementLibrary
from pants.targets.python_target import PythonTarget
from pants.targets.python_thrift_library import PythonThriftLibrary

Expand Down Expand Up @@ -324,11 +322,9 @@ def write_setup(self, root_target, chroot):

install_requires = set()
for dep in self.minified_dependencies(root_target):
if isinstance(dep, PythonRequirement):
install_requires.add(str(dep.requirement))
elif isinstance(dep, PythonTarget) and dep.provides:
install_requires.add(dep.provides.key)
setup_keywords['install_requires'] = list(install_requires)
if isinstance(dep, PythonRequirementLibrary):
[install_requires.add(str(req.requirement)) for req in dep.payload.requirements]
setup_keywords['install_requires'] = sorted(list(install_requires))

for binary_name, entry_point in self.iter_entry_points(root_target):
if 'entry_points' not in setup_keywords:
Expand Down

0 comments on commit 3497401

Please sign in to comment.