diff options
| author | Anderson Bravalheri <andersonbravalheri@gmail.com> | 2022-06-16 01:27:47 +0100 |
|---|---|---|
| committer | Anderson Bravalheri <andersonbravalheri@gmail.com> | 2022-06-16 01:27:47 +0100 |
| commit | 6f680c986759cb03922df9e2b275efbb5a17f796 (patch) | |
| tree | 44dc76ecd24bf302b1d99bf75c0e14b64f60fb76 | |
| parent | ebf8369b13b43ff2d5f6a58875246218fe922c9c (diff) | |
| download | python-setuptools-git-6f680c986759cb03922df9e2b275efbb5a17f796.tar.gz | |
Ensure new options for dist-info work
| -rw-r--r-- | setuptools/command/dist_info.py | 17 | ||||
| -rw-r--r-- | setuptools/tests/test_dist_info.py | 21 |
2 files changed, 32 insertions, 6 deletions
diff --git a/setuptools/command/dist_info.py b/setuptools/command/dist_info.py index 323dbefc..39a74e1e 100644 --- a/setuptools/command/dist_info.py +++ b/setuptools/command/dist_info.py @@ -51,14 +51,19 @@ class dist_info(Command): project_dir = dist.src_root or os.curdir self.output_dir = Path(self.output_dir or project_dir) - self.set_undefined_options( - "egg_info", ("tag_date", "tag_date"), ("tag_build", "tag_build") - ) - egg_info = self.reinitialize_command("egg_info") egg_info.egg_base = str(self.output_dir) - egg_info.tag_date = self.tag_date - egg_info.tag_build = self.tag_build + + if self.tag_date: + egg_info.tag_date = self.tag_date + else: + self.tag_date = egg_info.tag_date + + if self.tag_build: + egg_info.tag_build = self.tag_build + else: + self.tag_build = egg_info.tag_build + egg_info.finalize_options() self.egg_info = egg_info diff --git a/setuptools/tests/test_dist_info.py b/setuptools/tests/test_dist_info.py index eb41a667..5cd1a342 100644 --- a/setuptools/tests/test_dist_info.py +++ b/setuptools/tests/test_dist_info.py @@ -2,6 +2,7 @@ """ import pathlib import re +import shutil import subprocess import sys from functools import partial @@ -91,6 +92,26 @@ class TestDistInfo: dist_info = next(tmp_path.glob("*.dist-info")) assert dist_info.name.startswith("proj-42") + def test_tag_arguments(self, tmp_path): + config = """ + [metadata] + name=proj + version=42 + [egg_info] + tag_date=1 + tag_build=.post + """ + (tmp_path / "setup.cfg").write_text(config, encoding="utf-8") + + print(run_command("dist_info", "--no-date", cwd=tmp_path)) + dist_info = next(tmp_path.glob("*.dist-info")) + assert dist_info.name.startswith("proj-42") + shutil.rmtree(dist_info) + + print(run_command("dist_info", "--tag-build", ".a", cwd=tmp_path)) + dist_info = next(tmp_path.glob("*.dist-info")) + assert dist_info.name.startswith("proj-42a") + def test_output_dir(self, tmp_path): config = "[metadata]\nname=proj\nversion=42\n" (tmp_path / "setup.cfg").write_text(config, encoding="utf-8") |
