From ebf8369b13b43ff2d5f6a58875246218fe922c9c Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Thu, 16 Jun 2022 00:59:52 +0100 Subject: Add translator for config_settings to build_meta --- setuptools/command/dist_info.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'setuptools/command') diff --git a/setuptools/command/dist_info.py b/setuptools/command/dist_info.py index aa7af48c..323dbefc 100644 --- a/setuptools/command/dist_info.py +++ b/setuptools/command/dist_info.py @@ -25,13 +25,21 @@ class dist_info(Command): " DEPRECATED: use --output-dir."), ('output-dir=', 'o', "directory inside of which the .dist-info will be" "created (default: top of the source tree)"), + ('tag-date', 'd', "Add date stamp (e.g. 20050528) to version number"), + ('tag-build=', 'b', "Specify explicit tag to add to version number"), + ('no-date', 'D', "Don't include date stamp [default]"), ] + boolean_options = ['tag-date'] + negative_opt = {'no-date': 'tag-date'} + def initialize_options(self): self.egg_base = None self.output_dir = None self.name = None self.dist_info_dir = None + self.tag_date = None + self.tag_build = None def finalize_options(self): if self.egg_base: @@ -43,8 +51,14 @@ class dist_info(Command): project_dir = dist.src_root or os.curdir self.output_dir = Path(self.output_dir or project_dir) - egg_info = self.reinitialize_command('egg_info') + 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 egg_info.finalize_options() self.egg_info = egg_info -- cgit v1.2.1 From 6f680c986759cb03922df9e2b275efbb5a17f796 Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Thu, 16 Jun 2022 01:27:47 +0100 Subject: Ensure new options for dist-info work --- setuptools/command/dist_info.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'setuptools/command') 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 -- cgit v1.2.1 From 01d961a8b990d50e326ea4759dd62dd215ad2b4d Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Thu, 16 Jun 2022 18:16:55 +0100 Subject: Add warning with information for the user about link tree --- setuptools/command/editable_wheel.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'setuptools/command') diff --git a/setuptools/command/editable_wheel.py b/setuptools/command/editable_wheel.py index 48202990..2776577f 100644 --- a/setuptools/command/editable_wheel.py +++ b/setuptools/command/editable_wheel.py @@ -15,6 +15,7 @@ import re import shutil import sys import logging +import warnings from itertools import chain from pathlib import Path from tempfile import TemporaryDirectory @@ -166,6 +167,15 @@ class editable_wheel(Command): populate = _LinkTree(self.distribution, name, auxiliary_build_dir, tmp) populate(unpacked_dir) + msg = f"""\n + Strict editable installation performed using the auxiliary directory: + {auxiliary_build_dir} + + Please be careful to not remove this directory, otherwise you might not be able + to import/use your package. + """ + warnings.warn(msg, InformationOnly) + def _populate_static_pth(self, name: str, project_dir: Path, unpacked_dir: Path): """Populate wheel using the "lax" ``.pth`` file strategy, for ``src-layout``.""" src_dir = self.package_dir[""] @@ -583,3 +593,11 @@ def _finder_template( """ mapping = dict(sorted(mapping.items(), key=lambda p: p[0])) return _FINDER_TEMPLATE.format(name=name, mapping=mapping, namespaces=namespaces) + + +class InformationOnly(UserWarning): + """Currently there is no clear way of displaying messages to the users + that use the setuptools backend directly via ``pip``. + The only thing that might work is a warning, although it is not the + most appropriate tool for the job... + """ -- cgit v1.2.1