diff -r b624da86830e -r 33e06272ff1a setup.py --- a/setup.py Thu Feb 20 11:30:50 2025 +0100 +++ b/setup.py Thu Feb 20 11:44:44 2025 +0100 @@ -63,7 +63,6 @@ from setuptools.command.build_py import build_py from setuptools.command.install import install from setuptools.command.install_lib import install_lib -from setuptools.command.install_scripts import install_scripts from setuptools.errors import ( CCompilerError, @@ -936,78 +935,6 @@ file_util.copy_file = realcopyfile -class hginstallscripts(install_scripts): - """ - This is a specialization of install_scripts that replaces the @LIBDIR@ with - the configured directory for modules. If possible, the path is made relative - to the directory for scripts. - """ - - def initialize_options(self): - install_scripts.initialize_options(self) - - self.install_lib = None - - def finalize_options(self): - install_scripts.finalize_options(self) - self.set_undefined_options('install', ('install_lib', 'install_lib')) - - def run(self): - install_scripts.run(self) - - # It only makes sense to replace @LIBDIR@ with the install path if - # the install path is known. For wheels, the logic below calculates - # the libdir to be "../..". This is because the internal layout of a - # wheel archive looks like: - # - # mercurial-3.6.1.data/scripts/hg - # mercurial/__init__.py - # - # When installing wheels, the subdirectories of the ".data" - # directory are translated to system local paths and files therein - # are copied in place. The mercurial/* files are installed into the - # site-packages directory. However, the site-packages directory - # isn't known until wheel install time. This means we have no clue - # at wheel generation time what the installed site-packages directory - # will be. And, wheels don't appear to provide the ability to register - # custom code to run during wheel installation. This all means that - # we can't reliably set the libdir in wheels: the default behavior - # of looking in sys.path must do. - - if ( - os.path.splitdrive(self.install_dir)[0] - != os.path.splitdrive(self.install_lib)[0] - ): - # can't make relative paths from one drive to another, so use an - # absolute path instead - libdir = self.install_lib - else: - libdir = os.path.relpath(self.install_lib, self.install_dir) - - for outfile in self.outfiles: - with open(outfile, 'rb') as fp: - data = fp.read() - - # skip binary files - if b'\0' in data: - continue - - # During local installs, the shebang will be rewritten to the final - # install path. During wheel packaging, the shebang has a special - # value. - if data.startswith(b'#!python'): - logging.info( - 'not rewriting @LIBDIR@ in %s because install path ' - 'not known', - outfile, - ) - continue - - data = data.replace(b'@LIBDIR@', libdir.encode('unicode_escape')) - with open(outfile, 'wb') as fp: - fp.write(data) - - class hginstallcompletion(Command): description = 'Install shell completion' @@ -1132,7 +1059,6 @@ 'install': hginstall, 'install_completion': hginstallcompletion, 'install_lib': hginstalllib, - 'install_scripts': hginstallscripts, 'build_hgexe': buildhgexe, }