Show More
@@ -196,6 +196,7 b' from distutils.command.build_ext import ' | |||
|
196 | 196 | from distutils.command.build_py import build_py |
|
197 | 197 | from distutils.command.build_scripts import build_scripts |
|
198 | 198 | from distutils.command.install import install |
|
199 | from distutils.command.install_data import install_data | |
|
199 | 200 | from distutils.command.install_lib import install_lib |
|
200 | 201 | from distutils.command.install_scripts import install_scripts |
|
201 | 202 | from distutils import log |
@@ -212,6 +213,12 b' from distutils.version import StrictVers' | |||
|
212 | 213 | # Explain to distutils.StrictVersion how our release candidates are versionned |
|
213 | 214 | StrictVersion.version_re = re.compile(r'^(\d+)\.(\d+)(\.(\d+))?-?(rc(\d+))?$') |
|
214 | 215 | |
|
216 | # Can we build the documentation? | |
|
217 | try: | |
|
218 | import docutils | |
|
219 | except ImportError: | |
|
220 | docutils = None | |
|
221 | ||
|
215 | 222 | |
|
216 | 223 | def write_if_changed(path, content): |
|
217 | 224 | """Write content to a file iff the content hasn't changed.""" |
@@ -471,6 +478,14 b' class hgbuild(build):' | |||
|
471 | 478 | # when build_py is run next. |
|
472 | 479 | sub_commands = [('build_mo', None)] + build.sub_commands |
|
473 | 480 | |
|
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 | ||
|
474 | 489 | |
|
475 | 490 | class hgbuildmo(build): |
|
476 | 491 | |
@@ -1040,6 +1055,43 b' class hgbuilddoc(Command):' | |||
|
1040 | 1055 | genhtml(root) |
|
1041 | 1056 | |
|
1042 | 1057 | |
|
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 | ||
|
1043 | 1095 | class hginstall(install): |
|
1044 | 1096 | |
|
1045 | 1097 | user_options = install.user_options + [ |
@@ -1053,17 +1105,26 b' class hginstall(install):' | |||
|
1053 | 1105 | None, |
|
1054 | 1106 | 'noop, present for eggless setuptools compat', |
|
1055 | 1107 | ), |
|
1108 | ( | |
|
1109 | 'install-man=', | |
|
1110 | None, | |
|
1111 | 'installation directory for manual pages [share/man]', | |
|
1112 | ), | |
|
1056 | 1113 | ] |
|
1057 | 1114 | |
|
1058 | 1115 | # Also helps setuptools not be sad while we refuse to create eggs. |
|
1059 | 1116 | single_version_externally_managed = True |
|
1060 | 1117 | |
|
1118 | install_man = None | |
|
1119 | ||
|
1061 | 1120 | def get_sub_commands(self): |
|
1121 | subcommands = install.get_sub_commands(self) | |
|
1122 | subcommands.append('install_data') | |
|
1062 | 1123 | # Screen out egg related commands to prevent egg generation. But allow |
|
1063 | 1124 | # mercurial.egg-info generation, since that is part of modern |
|
1064 | 1125 | # packaging. |
|
1065 | 1126 | excl = {'bdist_egg'} |
|
1066 |
return filter(lambda x: x not in excl, |
|
|
1127 | return filter(lambda x: x not in excl, subcommands) | |
|
1067 | 1128 | |
|
1068 | 1129 | |
|
1069 | 1130 | class hginstalllib(install_lib): |
@@ -1265,6 +1326,7 b' cmdclass = {' | |||
|
1265 | 1326 | 'build_hgextindex': buildhgextindex, |
|
1266 | 1327 | 'install': hginstall, |
|
1267 | 1328 | 'install_lib': hginstalllib, |
|
1329 | 'install_data': hginstalldata, | |
|
1268 | 1330 | 'install_scripts': hginstallscripts, |
|
1269 | 1331 | 'build_hgexe': buildhgexe, |
|
1270 | 1332 | } |
General Comments 0
You need to be logged in to leave comments.
Login now