From 7bbdaab3470a2417f98790eee348b2b4a9e7798f Mon Sep 17 00:00:00 2001 From: 515hikaru <12kojima.takahiro@gmail.com> Date: Sat, 26 Oct 2019 01:54:15 +0900 Subject: [PATCH] ignore __pycache__ directory when dephell creates tarball --- dephell/converters/sdist.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dephell/converters/sdist.py b/dephell/converters/sdist.py index 3a11c4a9..c15df8e2 100644 --- a/dephell/converters/sdist.py +++ b/dephell/converters/sdist.py @@ -175,6 +175,7 @@ def _write_additional_files(self, *, tar, project, subdir): if self.ratio is None: self.ratio = config['sdist']['ratio'] tests_path = Path('tests') + subpaths = tests_path.glob('**/*') if tests_path.exists(): package_size = get_path_size(path=project.package.packages[0].path) tests_size = get_path_size(path=tests_path) @@ -183,7 +184,14 @@ def _write_additional_files(self, *, tar, project, subdir): name=str(tests_path), arcname=subdir + tests_path.name, filter=self._set_uid_gid, - ) + recursive=False) + for path in subpaths: + if '__pycache__' not in str(path): + tar.add( + name=str(path), + arcname=subdir + path.name, + filter=self._set_uid_gid, + recursive=False) def _write_content(self, tar, path: str, content) -> None: content = content.encode('utf-8')