Skip to content

Commit

Permalink
When Building Wheels, Resolve Relative Path Dependencies Correctly
Browse files Browse the repository at this point in the history
Building wheels unpacks the sdist which includes a copy of the
`pyproject.toml`.  If dependencies are delcared using relative paths
(such as `mymodule = { path = '../mymodule' }`), these relative paths
are not available from the temporary directory created to unpack and
build the wheel.  This fix retains the original path to the project for
those relative dependencies.

Fixes #266.
  • Loading branch information
kevinastone committed Mar 2, 2020
1 parent 754dbf8 commit 6ecf519
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions poetry/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Factory:
"""

def create_poetry(
self, cwd=None, io=None
self, cwd=None, io=None, original_root=None,
): # type: (Optional[Path], Optional[IO]) -> Poetry
if io is None:
io = NullIO()
Expand All @@ -57,7 +57,7 @@ def create_poetry(
name = local_config["name"]
version = local_config["version"]
package = ProjectPackage(name, version, version)
package.root_dir = poetry_file.parent
package.root_dir = original_root or poetry_file.parent

for author in local_config["authors"]:
package.authors.append(author)
Expand Down
4 changes: 2 additions & 2 deletions poetry/masonry/builders/complete.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def build(self):

with self.unpacked_tarball(sdist_file) as tmpdir:
WheelBuilder.make_in(
Factory().create_poetry(tmpdir),
Factory().create_poetry(tmpdir, original_root=self._poetry.file.path.parent),
self._env,
self._io,
dist_dir,
Expand All @@ -52,7 +52,7 @@ def build(self):
else:
with self.unpacked_tarball(sdist_file) as tmpdir:
WheelBuilder.make_in(
Factory().create_poetry(tmpdir),
Factory().create_poetry(tmpdir, original_root=self._poetry.file.path.parent),
self._env,
self._io,
dist_dir,
Expand Down

0 comments on commit 6ecf519

Please sign in to comment.