Skip to content

Commit

Permalink
Get rid of superfluous AddressLookupError subclasses.
Browse files Browse the repository at this point in the history
Both were named DepLookupError, but there's no need for such
a distinction, let alone two such distinctions...

Also removed some cruft from scrooge_gen.py, while in the
neighborhood.

Testing Done:
CI passes: https://travis-ci.org/pantsbuild/pants/builds/84618376

Reviewed at https://rbcommons.com/s/twitter/r/2959/
  • Loading branch information
benjyw authored and Benjy committed Oct 10, 2015
1 parent 11d89c9 commit dfdd7e1
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,12 @@
from pants.backend.jvm.targets.java_library import JavaLibrary
from pants.backend.jvm.targets.scala_library import ScalaLibrary
from pants.backend.jvm.tasks.nailgun_task import NailgunTask
from pants.base.build_environment import get_buildroot
from pants.base.exceptions import TargetDefinitionException, TaskError
from pants.build_graph.address import Address
from pants.build_graph.address_lookup_error import AddressLookupError
from pants.option.custom_types import dict_option, list_option
from pants.util.dirutil import safe_mkdir, safe_open
from twitter.common.collections import OrderedSet

from pants.contrib.scrooge.tasks.java_thrift_library_fingerprint_strategy import \
JavaThriftLibraryFingerprintStrategy
from pants.contrib.scrooge.tasks.thrift_util import calculate_compile_sources


Expand All @@ -39,10 +35,6 @@ class ScroogeGen(SimpleCodegenTask, NailgunTask):

DepInfo = namedtuple('DepInfo', ['service', 'structs'])

class DepLookupError(AddressLookupError):
"""Thrown when a dependency can't be found."""
pass

class PartialCmd(namedtuple('PC', ['language', 'rpc_style', 'namespace_map'])):

@property
Expand All @@ -61,7 +53,8 @@ def relative_outdir(self):
def register_options(cls, register):
super(ScroogeGen, cls).register_options(register)
register('--verbose', default=False, action='store_true', help='Emit verbose output.')
register('--strict', fingerprint=True, default=False, action='store_true', help='Enable strict compilation.')
register('--strict', fingerprint=True, default=False, action='store_true',
help='Enable strict compilation.')
register('--jvm-options', default=[], advanced=True, type=list_option,
help='Use these jvm options when running Scrooge.')
register('--service-deps', default={}, advanced=True, type=dict_option,
Expand Down Expand Up @@ -111,8 +104,8 @@ def _resolve_deps(self, depmap):
try:
dependencies.update(self.context.resolve(depspec))
except AddressLookupError as e:
raise self.DepLookupError("{message}\n referenced from [{section}] key: "
"gen->deps->{category} in pants.ini".format(
raise AddressLookupError('{message}\n referenced from [{section}] key: '
'gen->deps->{category} in pants.ini'.format(
message=e,
section=_CONFIG_SECTION,
category=category
Expand Down Expand Up @@ -196,10 +189,9 @@ def gen(self, partial_cmd, invalid_targets):
args=args,
workunit_name='scrooge-gen')
try:
# TODO: This entire block appears to have no effect.
if 0 == returncode:
gen_files_for_source = self.parse_gen_file_map(gen_file_map_path, outdir)
else:
gen_files_for_source = None
self.parse_gen_file_map(gen_file_map_path, outdir)
finally:
os.remove(gen_file_map_path)

Expand Down
1 change: 0 additions & 1 deletion src/python/pants/backend/codegen/tasks/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ python_library(
'3rdparty/python/twitter/commons:twitter.common.collections',
':common',
'src/python/pants/base:build_environment',
'src/python/pants/base:dep_lookup_error',
'src/python/pants/base:workunit',
'src/python/pants/build_graph',
'src/python/pants/util:memo',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

from pants.backend.core.tasks.task import Task
from pants.base.build_environment import get_buildroot
from pants.base.dep_lookup_error import DepLookupError
from pants.base.exceptions import TaskError
from pants.base.workunit import WorkUnitLabel
from pants.build_graph.address import Address
Expand Down Expand Up @@ -296,7 +295,7 @@ def resolve_deps(self, unresolved_deps):
try:
deps.update(self.context.resolve(dep))
except AddressLookupError as e:
raise DepLookupError('{message}\n on dependency {dep}'.format(message=e, dep=dep))
raise AddressLookupError('{message}\n on dependency {dep}'.format(message=e, dep=dep))
return deps

class CodegenStrategy(AbstractClass):
Expand Down
1 change: 0 additions & 1 deletion src/python/pants/backend/jvm/subsystems/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ python_library(
name = 'jvm_tool_mixin',
sources = ['jvm_tool_mixin.py'],
dependencies = [
'src/python/pants/base:dep_lookup_error',
'src/python/pants/base:exceptions',
],
)
Expand Down
1 change: 0 additions & 1 deletion src/python/pants/backend/jvm/subsystems/jvm_tool_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from collections import namedtuple
from textwrap import dedent

from pants.base.dep_lookup_error import DepLookupError
from pants.base.exceptions import TaskError
from pants.option.custom_types import target_option

Expand Down
8 changes: 0 additions & 8 deletions src/python/pants/base/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,6 @@ python_library(
],
)

python_library(
name = 'dep_lookup_error',
dependencies = [
':address_lookup_error',
],
sources = ['dep_lookup_error.py'],
)

python_library(
name = 'deprecated',
sources = ['deprecated.py'],
Expand Down
12 changes: 0 additions & 12 deletions src/python/pants/base/dep_lookup_error.py

This file was deleted.

0 comments on commit dfdd7e1

Please sign in to comment.