]>
jfr.im git - dlqueue.git/blob - venv/lib/python3.11/site-packages/setuptools/command/install_egg_info.py
1 from distutils
import log
, dir_util
4 from setuptools
import Command
5 from setuptools
import namespaces
6 from setuptools
.archive_util
import unpack_archive
7 from .._path
import ensure_directory
10 class install_egg_info(namespaces
.Installer
, Command
):
11 """Install an .egg-info directory for the package"""
13 description
= "Install an .egg-info directory for the package"
16 ('install-dir=', 'd', "directory to install to"),
19 def initialize_options(self
):
20 self
.install_dir
= None
22 def finalize_options(self
):
23 self
.set_undefined_options('install_lib', ('install_dir', 'install_dir'))
24 ei_cmd
= self
.get_finalized_command("egg_info")
25 basename
= f
"{ei_cmd._get_egg_basename()}.egg-info"
26 self
.source
= ei_cmd
.egg_info
27 self
.target
= os
.path
.join(self
.install_dir
, basename
)
31 self
.run_command('egg_info')
32 if os
.path
.isdir(self
.target
) and not os
.path
.islink(self
.target
):
33 dir_util
.remove_tree(self
.target
, dry_run
=self
.dry_run
)
34 elif os
.path
.exists(self
.target
):
35 self
.execute(os
.unlink
, (self
.target
,), "Removing " + self
.target
)
37 ensure_directory(self
.target
)
38 self
.execute(self
.copytree
, (), "Copying %s to %s" % (self
.source
, self
.target
))
39 self
.install_namespaces()
41 def get_outputs(self
):
45 # Copy the .egg-info tree to site-packages
46 def skimmer(src
, dst
):
47 # filter out source-control directories; note that 'src' is always
48 # a '/'-separated path, regardless of platform. 'dst' is a
49 # platform-specific path.
50 for skip
in '.svn/', 'CVS/':
51 if src
.startswith(skip
) or '/' + skip
in src
:
53 self
.outputs
.append(dst
)
54 log
.debug("Copying %s to %s", src
, dst
)
57 unpack_archive(self
.source
, self
.target
, skimmer
)