--- a/setup.py Thu Oct 24 15:49:33 2024 +0200
+++ b/setup.py Thu Oct 24 00:47:20 2024 +0200
@@ -1,6 +1,7 @@
# This is the mercurial setup script.
import ctypes
+import logging
import os
import re
import shutil
@@ -80,7 +81,6 @@
from distutils.command.install import install
from distutils.command.install_lib import install_lib
from distutils.command.install_scripts import install_scripts
-from distutils import log
from distutils.spawn import spawn
from distutils import file_util
from distutils.errors import (
@@ -496,7 +496,7 @@
from distutils.spawn import find_executable
if not find_executable('msgfmt'):
- self.warn(
+ logging.warning(
"could not find msgfmt executable, no translations "
"will be built"
)
@@ -504,7 +504,7 @@
podir = 'i18n'
if not os.path.isdir(podir):
- self.warn("could not find %s/ directory" % podir)
+ logging.warning("could not find %s/ directory", podir)
return False
join = os.path.join
@@ -629,7 +629,7 @@
# as Linux distributions would do)
if self.distribution.rust and self.rust:
if not sys.platform.startswith('linux'):
- self.warn(
+ logging.warning(
"rust extensions have only been tested on Linux "
"and may not behave correctly on other platforms"
)
@@ -651,7 +651,7 @@
except CCompilerError:
if not getattr(ext, 'optional', False):
raise
- log.warn(
+ logging.warning(
"Failed to build optional extension '%s' (skipping)", ext.name
)
@@ -666,7 +666,7 @@
self.run_command('build_hgexe')
exebuilt = True
except (DistutilsError, CCompilerError):
- log.warn('failed to build optional hg.exe')
+ logging.warning('failed to build optional hg.exe')
if exebuilt:
# Copying hg.exe to the scripts build directory ensures it is
@@ -886,14 +886,14 @@
shutil.copy(python_x, dest)
if not pythonlib:
- log.warn(
+ logging.warning(
'could not determine Python DLL filename; assuming pythonXY'
)
hv = sys.hexversion
pythonlib = b'python%d%d' % (hv >> 24, (hv >> 16) & 0xFF)
- log.info('using %s as Python library name' % pythonlib)
+ logging.info('using %s as Python library name', pythonlib)
with open('mercurial/hgpythonlib.h', 'wb') as f:
f.write(b'/* this file is autogenerated by setup.py */\n')
f.write(b'#define HGPYTHONLIB "%s"\n' % pythonlib)
@@ -920,9 +920,9 @@
os.close(fdauto)
with open(manfname, 'w', encoding="UTF-8") as f:
f.write(self.LONG_PATHS_MANIFEST)
- log.info("long paths manifest is written to '%s'" % manfname)
+ logging.info("long paths manifest is written to '%s'", manfname)
outputresource = '-outputresource:%s;#1' % exefname
- log.info("running mt.exe to update hg.exe's manifest in-place")
+ logging.info("running mt.exe to update hg.exe's manifest in-place")
self.spawn(
[
@@ -933,7 +933,7 @@
outputresource,
]
)
- log.info("done updating hg.exe's manifest")
+ logging.info("done updating hg.exe's manifest")
os.remove(manfname)
@property
@@ -973,13 +973,13 @@
if b'\r\n' not in orig:
return
- log.info('normalizing %s to LF line endings' % p)
+ logging.info('normalizing %s to LF line endings', p)
with open(p, 'wb') as fh:
fh.write(orig.replace(b'\r\n', b'\n'))
def gentxt(root):
txt = 'doc/%s.txt' % root
- log.info('generating %s' % txt)
+ logging.info('generating %s', txt)
res, out, err = runcmd(
[sys.executable, 'gendoc.py', root], os.environ, cwd='doc'
)
@@ -995,7 +995,7 @@
def gengendoc(root):
gendoc = 'doc/%s.gendoc.txt' % root
- log.info('generating %s' % gendoc)
+ logging.info('generating %s', gendoc)
res, out, err = runcmd(
[sys.executable, 'gendoc.py', '%s.gendoc' % root],
os.environ,
@@ -1011,7 +1011,7 @@
fh.write(out)
def genman(root):
- log.info('generating doc/%s' % root)
+ logging.info('generating doc/%s', root)
res, out, err = runcmd(
[
sys.executable,
@@ -1036,7 +1036,7 @@
normalizecrlf('doc/%s' % root)
def genhtml(root):
- log.info('generating doc/%s.html' % root)
+ logging.info('generating doc/%s.html', root)
res, out, err = runcmd(
[
sys.executable,
@@ -1210,9 +1210,10 @@
# install path. During wheel packaging, the shebang has a special
# value.
if data.startswith(b'#!python'):
- log.info(
+ logging.info(
'not rewriting @LIBDIR@ in %s because install path '
- 'not known' % outfile
+ 'not known',
+ outfile,
)
continue