comparison setup.py @ 46315:2ef575c62f10

test-regression: backing out D9640 (63c923fd7fa8) Since D9640 was pushed, we have seen failure on at least: - test-commit-interactive.t - test-i18n.t - test-log.t The author that change requested it to be removed until he can investigate. For reference: https://phab.mercurial-scm.org/D9640 Backed out changeset 63c923fd7fa8 Differential Revision: https://phab.mercurial-scm.org/D9803
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 17 Jan 2021 02:48:15 +0100
parents 63c923fd7fa8
children d6cfe45afb18 cabc5e9366c5
comparison
equal deleted inserted replaced
46314:95a615dd77bf 46315:2ef575c62f10
194 from distutils.command.build import build 194 from distutils.command.build import build
195 from distutils.command.build_ext import build_ext 195 from distutils.command.build_ext import build_ext
196 from distutils.command.build_py import build_py 196 from distutils.command.build_py import build_py
197 from distutils.command.build_scripts import build_scripts 197 from distutils.command.build_scripts import build_scripts
198 from distutils.command.install import install 198 from distutils.command.install import install
199 from distutils.command.install_data import install_data
200 from distutils.command.install_lib import install_lib 199 from distutils.command.install_lib import install_lib
201 from distutils.command.install_scripts import install_scripts 200 from distutils.command.install_scripts import install_scripts
202 from distutils import log 201 from distutils import log
203 from distutils.spawn import spawn, find_executable 202 from distutils.spawn import spawn, find_executable
204 from distutils import file_util 203 from distutils import file_util
210 from distutils.sysconfig import get_python_inc, get_config_var 209 from distutils.sysconfig import get_python_inc, get_config_var
211 from distutils.version import StrictVersion 210 from distutils.version import StrictVersion
212 211
213 # Explain to distutils.StrictVersion how our release candidates are versionned 212 # Explain to distutils.StrictVersion how our release candidates are versionned
214 StrictVersion.version_re = re.compile(r'^(\d+)\.(\d+)(\.(\d+))?-?(rc(\d+))?$') 213 StrictVersion.version_re = re.compile(r'^(\d+)\.(\d+)(\.(\d+))?-?(rc(\d+))?$')
215
216 # Can we build the documentation?
217 try:
218 import docutils
219 except ImportError:
220 docutils = None
221 214
222 215
223 def write_if_changed(path, content): 216 def write_if_changed(path, content):
224 """Write content to a file iff the content hasn't changed.""" 217 """Write content to a file iff the content hasn't changed."""
225 if os.path.exists(path): 218 if os.path.exists(path):
476 class hgbuild(build): 469 class hgbuild(build):
477 # Insert hgbuildmo first so that files in mercurial/locale/ are found 470 # Insert hgbuildmo first so that files in mercurial/locale/ are found
478 # when build_py is run next. 471 # when build_py is run next.
479 sub_commands = [('build_mo', None)] + build.sub_commands 472 sub_commands = [('build_mo', None)] + build.sub_commands
480 473
481 def run(self):
482 if os.name == 'nt':
483 pass
484 elif docutils is None:
485 log.warn('not building optional documentation')
486 else:
487 self.run_command('build_doc')
488
489 474
490 class hgbuildmo(build): 475 class hgbuildmo(build):
491 476
492 description = "build translations (.mo files)" 477 description = "build translations (.mo files)"
493 478
1053 genman(root) 1038 genman(root)
1054 if self.html: 1039 if self.html:
1055 genhtml(root) 1040 genhtml(root)
1056 1041
1057 1042
1058 class hginstalldata(install_data):
1059 user_options = install_data.user_options + [
1060 (
1061 'install-man=',
1062 None,
1063 'installation directory for manual pages [share/man]',
1064 ),
1065 ]
1066
1067 install_man = None
1068
1069 def finalize_options(self):
1070 install_data.finalize_options(self)
1071
1072 self.set_undefined_options('install', ('install_man', 'install_man'))
1073
1074 if self.install_man is None:
1075 self.install_man = os.path.join('share', 'man')
1076
1077 if os.name == 'nt':
1078 pass
1079 elif docutils is None:
1080 log.warn('not installing manual pages')
1081 else:
1082 manpages = [
1083 f for f in os.listdir('doc') if re.search(r'\.[0-9]$', f)
1084 ]
1085
1086 self.data_files += [
1087 (
1088 os.path.join(self.install_man, 'man' + ext[1:]),
1089 ['doc/' + f for f in manpages if f.endswith(ext)],
1090 )
1091 for ext in set(os.path.splitext(f)[1] for f in manpages)
1092 ]
1093
1094
1095 class hginstall(install): 1043 class hginstall(install):
1096 1044
1097 user_options = install.user_options + [ 1045 user_options = install.user_options + [
1098 ( 1046 (
1099 'old-and-unmanageable', 1047 'old-and-unmanageable',
1103 ( 1051 (
1104 'single-version-externally-managed', 1052 'single-version-externally-managed',
1105 None, 1053 None,
1106 'noop, present for eggless setuptools compat', 1054 'noop, present for eggless setuptools compat',
1107 ), 1055 ),
1108 (
1109 'install-man=',
1110 None,
1111 'installation directory for manual pages [share/man]',
1112 ),
1113 ] 1056 ]
1114 1057
1115 # Also helps setuptools not be sad while we refuse to create eggs. 1058 # Also helps setuptools not be sad while we refuse to create eggs.
1116 single_version_externally_managed = True 1059 single_version_externally_managed = True
1117 1060
1118 install_man = None
1119
1120 def get_sub_commands(self): 1061 def get_sub_commands(self):
1121 subcommands = install.get_sub_commands(self)
1122 subcommands.append('install_data')
1123 # Screen out egg related commands to prevent egg generation. But allow 1062 # Screen out egg related commands to prevent egg generation. But allow
1124 # mercurial.egg-info generation, since that is part of modern 1063 # mercurial.egg-info generation, since that is part of modern
1125 # packaging. 1064 # packaging.
1126 excl = {'bdist_egg'} 1065 excl = {'bdist_egg'}
1127 return filter(lambda x: x not in excl, subcommands) 1066 return filter(lambda x: x not in excl, install.get_sub_commands(self))
1128 1067
1129 1068
1130 class hginstalllib(install_lib): 1069 class hginstalllib(install_lib):
1131 """ 1070 """
1132 This is a specialization of install_lib that replaces the copy_file used 1071 This is a specialization of install_lib that replaces the copy_file used
1324 'build_py': hgbuildpy, 1263 'build_py': hgbuildpy,
1325 'build_scripts': hgbuildscripts, 1264 'build_scripts': hgbuildscripts,
1326 'build_hgextindex': buildhgextindex, 1265 'build_hgextindex': buildhgextindex,
1327 'install': hginstall, 1266 'install': hginstall,
1328 'install_lib': hginstalllib, 1267 'install_lib': hginstalllib,
1329 'install_data': hginstalldata,
1330 'install_scripts': hginstallscripts, 1268 'install_scripts': hginstallscripts,
1331 'build_hgexe': buildhgexe, 1269 'build_hgexe': buildhgexe,
1332 } 1270 }
1333 1271
1334 if py2exehacked: 1272 if py2exehacked: