diff --git a/poetry/core/masonry/api.py b/poetry/core/masonry/api.py index 471684062..aae519789 100644 --- a/poetry/core/masonry/api.py +++ b/poetry/core/masonry/api.py @@ -31,7 +31,7 @@ def get_requires_for_build_wheel(config_settings=None): def prepare_metadata_for_build_wheel(metadata_directory, config_settings=None): - poetry = Factory().create_poetry(Path(".")) + poetry = Factory().create_poetry(Path(".").resolve()) builder = WheelBuilder(poetry) dist_info = Path(metadata_directory, builder.dist_info) @@ -52,14 +52,14 @@ def prepare_metadata_for_build_wheel(metadata_directory, config_settings=None): def build_wheel(wheel_directory, config_settings=None, metadata_directory=None): """Builds a wheel, places it in wheel_directory""" - poetry = Factory().create_poetry(Path(".")) + poetry = Factory().create_poetry(Path(".").resolve()) return unicode(WheelBuilder.make_in(poetry, Path(wheel_directory))) def build_sdist(sdist_directory, config_settings=None): """Builds an sdist, places it in sdist_directory""" - poetry = Factory().create_poetry(Path(".")) + poetry = Factory().create_poetry(Path(".").resolve()) path = SdistBuilder(poetry).build(Path(sdist_directory)) diff --git a/tests/masonry/test_api.py b/tests/masonry/test_api.py index bfcee0e3e..56b7845c2 100644 --- a/tests/masonry/test_api.py +++ b/tests/masonry/test_api.py @@ -55,6 +55,18 @@ def test_build_wheel(): assert "my_package-1.2.3.dist-info/METADATA" in namelist +def test_build_wheel_with_include(): + with temporary_directory() as tmp_dir, cwd(os.path.join(fixtures, "with-include")): + filename = api.build_wheel(tmp_dir) + + with zipfile.ZipFile(str(os.path.join(tmp_dir, filename))) as zip: + namelist = zip.namelist() + + assert "with_include-1.2.3.dist-info/entry_points.txt" in namelist + assert "with_include-1.2.3.dist-info/WHEEL" in namelist + assert "with_include-1.2.3.dist-info/METADATA" in namelist + + @pytest.mark.skipif( sys.platform == "win32" and sys.version_info <= (3, 6) @@ -86,6 +98,16 @@ def test_build_sdist(): assert "my-package-1.2.3/LICENSE" in namelist +def test_build_sdist_with_include(): + with temporary_directory() as tmp_dir, cwd(os.path.join(fixtures, "with-include")): + filename = api.build_sdist(tmp_dir) + + with tarfile.open(str(os.path.join(tmp_dir, filename))) as tar: + namelist = tar.getnames() + + assert "with-include-1.2.3/LICENSE" in namelist + + def test_prepare_metadata_for_build_wheel(): entry_points = """\ [console_scripts]