diff options
Diffstat (limited to 'setuptools/command')
| -rw-r--r-- | setuptools/command/editable_wheel.py | 12 | ||||
| -rw-r--r-- | setuptools/command/egg_info.py | 13 |
2 files changed, 24 insertions, 1 deletions
diff --git a/setuptools/command/editable_wheel.py b/setuptools/command/editable_wheel.py index d5a7d530..354f6b9f 100644 --- a/setuptools/command/editable_wheel.py +++ b/setuptools/command/editable_wheel.py @@ -47,6 +47,7 @@ class editable_wheel(Command): user_options = [ ("dist-dir=", "d", "directory to put final built distributions in"), ("dist-info-dir=", "I", "path to a pre-build .dist-info directory"), + ("strict", None, "perform an strict installation"), ] boolean_options = ["strict"] @@ -211,6 +212,9 @@ class _LinkTree(_StaticPth): self.tmp = tmp def _build_py(self): + if not self.dist.has_pure_modules(): + return + build_py = self.dist.get_command_obj("build_py") build_py.ensure_finalized() # Force build_py to use links instead of copying files @@ -218,6 +222,9 @@ class _LinkTree(_StaticPth): build_py.run() def _build_ext(self): + if not self.dist.has_ext_modules(): + return + build_ext = self.dist.get_command_obj("build_ext") build_ext.ensure_finalized() # Extensions are not editable, so we just have to build them in the right dir @@ -257,6 +264,11 @@ def _configure_build(name: str, dist: Distribution, target_dir: _Path, tmp_dir: headers = str(Path(target_dir, f"{name}.data", "include")) scripts = str(Path(target_dir, f"{name}.data", "scripts")) + # egg-info will be generated again to create a manifest (used for package data) + egg_info = dist.reinitialize_command("egg_info", reinit_subcommands=True) + egg_info.egg_base = str(tmp_dir) + egg_info.ignore_egg_info_in_manifest = True + build = dist.reinitialize_command("build", reinit_subcommands=True) install = dist.reinitialize_command("install", reinit_subcommands=True) diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index c37ab81f..0c9d45ae 100644 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -182,6 +182,7 @@ class egg_info(InfoCommon, Command): self.egg_info = None self.egg_version = None self.broken_egg_info = False + self.ignore_egg_info_in_manifest = False #################################### # allow the 'tag_svn_revision' to be detected and @@ -311,6 +312,7 @@ class egg_info(InfoCommon, Command): """Generate SOURCES.txt manifest file""" manifest_filename = os.path.join(self.egg_info, "SOURCES.txt") mm = manifest_maker(self.distribution) + mm.ignore_egg_info_dir = self.ignore_egg_info_in_manifest mm.manifest = manifest_filename mm.run() self.filelist = mm.filelist @@ -334,6 +336,10 @@ class egg_info(InfoCommon, Command): class FileList(_FileList): # Implementations of the various MANIFEST.in commands + def __init__(self, warn=None, debug_print=None, ignore_egg_info_dir=False): + super().__init__(warn, debug_print) + self.ignore_egg_info_dir = ignore_egg_info_dir + def process_template_line(self, line): # Parse the line: split it up, make sure the right number of words # is there, and return the relevant words. 'action' is always @@ -523,6 +529,10 @@ class FileList(_FileList): return False try: + # ignore egg-info paths + is_egg_info = ".egg-info" in u_path or b".egg-info" in utf8_path + if self.ignore_egg_info_dir and is_egg_info: + return False # accept is either way checks out if os.path.exists(u_path) or os.path.exists(utf8_path): return True @@ -539,12 +549,13 @@ class manifest_maker(sdist): self.prune = 1 self.manifest_only = 1 self.force_manifest = 1 + self.ignore_egg_info_dir = False def finalize_options(self): pass def run(self): - self.filelist = FileList() + self.filelist = FileList(ignore_egg_info_dir=self.ignore_egg_info_dir) if not os.path.exists(self.manifest): self.write_manifest() # it must exist so it'll get in the list self.add_defaults() |
