From 11b85a0bdc319ee5f1afa0d1aa0764e44cf3cd0e Mon Sep 17 00:00:00 2001 From: Arun Babu Neelicattu Date: Thu, 27 Aug 2020 10:57:45 +0200 Subject: [PATCH] Handle compatibility issues in build includes --- poetry/core/masonry/builders/builder.py | 10 +++++++++- poetry/core/utils/_compat.py | 6 ++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/poetry/core/masonry/builders/builder.py b/poetry/core/masonry/builders/builder.py index 7089a1ae3..055577846 100644 --- a/poetry/core/masonry/builders/builder.py +++ b/poetry/core/masonry/builders/builder.py @@ -314,9 +314,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"): diff --git a/poetry/core/utils/_compat.py b/poetry/core/utils/_compat.py index 655584fe1..c94d9f624 100644 --- a/poetry/core/utils/_compat.py +++ b/poetry/core/utils/_compat.py @@ -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