# HG changeset patch # User Dan Villiom Podlaski Christiansen # Date 1678122149 -3600 # Mon Mar 06 18:02:29 2023 +0100 # Branch stable # Node ID 7b2f5582042517cfe414f93580db0102ddbf92a1 # Parent 506edb8dbf983280ec1f7a7635eb8d4931422666 # EXP-Topic patches setup_py diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -1121,61 +1121,6 @@ class hginstallscripts(install_scripts): 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'): - log.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' @@ -1434,7 +1379,9 @@ class RustCompilationError(CCompilerErro class RustExtension(Extension): """Base classes for concrete Rust Extension classes.""" - rusttargetdir = os.path.join('rust', 'target', 'release') + rusttargetdir = os.path.join( + 'rust', 'target', os.getenv('CARGO_BUILD_TARGET', '.'), 'release' + ) def __init__(self, mpath, sources, rustlibname, subcrate, **kw): Extension.__init__(self, mpath, sources, **kw) @@ -1482,7 +1429,7 @@ class RustExtension(Extension): env['HOME'] = pwd.getpwuid(os.getuid()).pw_dir - cargocmd = ['cargo', 'rustc', '--release'] + cargocmd = ['cargo', 'rustc', '--release', '--frozen', '-j', '@BUILD_JOBS@'] rust_features = env.get("HG_RUST_FEATURES") if rust_features: