Commit 3622f8e4 by finswimmer Committed by Sébastien Eustace

* check if relative filename is in excluded file list (#1459)

* * check if relative filename is in excluded file list
* removed find_excluded_files() method from wheel.py

* added test for excluding files in wheels

* creating an own test data folder, for testing excluding files by pyproject.toml

* use as_posix() to respect windows file path delimiters
parent 2966ab17
...@@ -153,7 +153,7 @@ class WheelBuilder(Builder): ...@@ -153,7 +153,7 @@ class WheelBuilder(Builder):
else: else:
rel_file = file.relative_to(self._path) rel_file = file.relative_to(self._path)
if file in excluded: if rel_file.as_posix() in excluded:
continue continue
if file.suffix == ".pyc": if file.suffix == ".pyc":
...@@ -199,10 +199,6 @@ class WheelBuilder(Builder): ...@@ -199,10 +199,6 @@ class WheelBuilder(Builder):
# RECORD itself is recorded with no hash or size # RECORD itself is recorded with no hash or size
f.write(self.dist_info + "/RECORD,,\n") f.write(self.dist_info + "/RECORD,,\n")
def find_excluded_files(self): # type: () -> Set
# Checking VCS
return set()
@property @property
def dist_info(self): # type: () -> str def dist_info(self): # type: () -> str
return self.dist_info_name(self._package.name, self._meta.version) return self.dist_info_name(self._package.name, self._meta.version)
......
Copyright (c) 2018 Sébastien Eustace
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
[tool.poetry]
name = "my-package"
version = "1.2.3"
description = "Some description."
authors = [
"Sébastien Eustace <sebastien@eustace.io>"
]
license = "MIT"
readme = "README.rst"
exclude = ["my_package/data/data1.txt"]
homepage = "https://poetry.eustace.io/"
repository = "https://github.com/sdispater/poetry"
documentation = "https://poetry.eustace.io/docs"
keywords = ["packaging", "dependency", "poetry"]
classifiers = [
"Topic :: Software Development :: Build Tools",
"Topic :: Software Development :: Libraries :: Python Modules"
]
# Requirements
[tool.poetry.dependencies]
python = "^3.6"
cleo = "^0.6"
cachy = { version = "^0.2.0", extras = ["msgpack"] }
pendulum = { version = "^1.4", optional = true }
[tool.poetry.dev-dependencies]
pytest = "~3.4"
[tool.poetry.extras]
time = ["pendulum"]
[tool.poetry.scripts]
my-script = "my_package:main"
my-2nd-script = "my_package:main2"
...@@ -62,6 +62,21 @@ def test_wheel_prerelease(): ...@@ -62,6 +62,21 @@ def test_wheel_prerelease():
assert whl.exists() assert whl.exists()
def test_wheel_excluded_data():
module_path = fixtures_dir / "default_with_excluded_data_toml"
WheelBuilder.make(Factory().create_poetry(module_path), NullEnv(), NullIO())
whl = module_path / "dist" / "my_package-1.2.3-py3-none-any.whl"
assert whl.exists()
with zipfile.ZipFile(str(whl)) as z:
assert "my_package/__init__.py" in z.namelist()
assert "my_package/data/sub_data/data2.txt" in z.namelist()
assert "my_package/data/sub_data/data3.txt" in z.namelist()
assert "my_package/data/data1.txt" not in z.namelist()
def test_wheel_localversionlabel(): def test_wheel_localversionlabel():
module_path = fixtures_dir / "localversionlabel" module_path = fixtures_dir / "localversionlabel"
WheelBuilder.make(Factory().create_poetry(module_path), NullEnv(), NullIO()) WheelBuilder.make(Factory().create_poetry(module_path), NullEnv(), NullIO())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment