Skip to content

Commit

Permalink
Merge pull request #75 from abn/fix-includes-compatibility
Browse files Browse the repository at this point in the history
Handle compatibility issues in build includes
  • Loading branch information
sdispater authored Sep 18, 2020
2 parents 476c19e + 11b85a0 commit c307b95
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
10 changes: 9 additions & 1 deletion poetry/core/masonry/builders/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,17 @@ def __init__(
self.path = Path(path)
self.source_root = None if not source_root else Path(source_root).resolve()
if not self.path.is_absolute() and self.source_root:
self.path = (self.source_root / self.path).resolve()
self.path = self.source_root / self.path
else:
self.path = self.path

try:
self.path = self.path.resolve()
except FileNotFoundError:
# this is an issue in in python 3.5, since resolve uses strict=True by
# default, this workaround needs to be maintained till python 2.7 and
# python 3.5 are dropped, until we can use resolve(strict=False).
pass

def __eq__(self, other): # type: (Union[BuildIncludeFile, Path]) -> bool
if hasattr(other, "path"):
Expand Down
6 changes: 6 additions & 0 deletions poetry/core/utils/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@
OrderedDict = dict


try:
FileNotFoundError
except NameError:
FileNotFoundError = IOError # noqa


def decode(string, encodings=None):
if not PY2 and not isinstance(string, bytes):
return string
Expand Down

0 comments on commit c307b95

Please sign in to comment.