Skip to content

Commit

Permalink
Fix JarDependency.copy()
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric-Arellano committed Oct 10, 2019
1 parent 81457b6 commit 59d342c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/python/pants/backend/native/targets/native_artifact.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from dataclasses import dataclass, FrozenInstanceError
from dataclasses import FrozenInstanceError, dataclass
from hashlib import sha1
from typing import Any

Expand Down
10 changes: 5 additions & 5 deletions src/python/pants/java/jar/jar_dependency.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

import dataclasses
import os
from dataclasses import dataclass
from typing import Optional, Sequence, Tuple
Expand Down Expand Up @@ -163,13 +164,12 @@ def transitive(self):
def copy(self, **replacements):
"""Returns a clone of this JarDependency with the given replacements kwargs overlaid."""
cls = type(self)
kwargs = self._asdict()
for key, val in replacements.items():
if key == 'excludes':
val = JarDependency._prepare_excludes(val)
kwargs[key] = val
kwargs = dataclasses.asdict(self)
kwargs.update(replacements)
org = kwargs.pop('org')
base_name = kwargs.pop('base_name')
# NB: This calls __init__() so will set things up properly for us, such as calling
# _prepare_excludes.
return cls(org, base_name, **kwargs)

@memoized_property
Expand Down

0 comments on commit 59d342c

Please sign in to comment.