Mercurial > hg
annotate doc/Makefile @ 51723:9367571fea21
cext: correct the argument handling of `b85encode()`
The type stub indicated that this argument is `Optional`, which implies None is
allowed. I don't see in the documentation where that's the case for `i`[1], and
trying it in `hg debugshell` resulted in the method failing with a TypeError. I
guess it was typed as an `int` argument because the `p` format unit wasn't added
until Python 3.3[2].
In any event, 2 clients in core (`pvec` and `obsolete`) call this with no
argument supplied, and `mdiff` calls it with True. So I guess we've avoided the
None arg case, and when no arg is supplied, it defaults to the 0 initialization
of the `pad` variable in C. Since the `p` format unit accepts both `int` and
None, as well as `bool`, I'm not bothering to bump the module version- this code
is more permissive than it was, in addition to being more correct.
Interestingly, when I first imported the `cext` and `pure` methods in the same
manner as the previous commit, it dropped the `Optional` part of the argument
type when generating `util.pyi`. No idea why.
[1] https://docs.python.org/3/c-api/arg.html#numbers
[2] https://docs.python.org/3/c-api/arg.html#other-objects
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sat, 20 Jul 2024 01:55:09 -0400 |
parents | dc101c236219 |
children |
rev | line source |
---|---|
43736
640bae94f2f3
cleanup: update references to /help/ that should now be /helptext/
Augie Fackler <augie@google.com>
parents:
42058
diff
changeset
|
1 SOURCES=$(notdir $(wildcard ../mercurial/helptext/*.[0-9].txt)) |
671
efa4a7e2f322
Move hgrc documentation out to its own man page, hgrc(5).
Bryan O'Sullivan <bos@serpentine.com>
parents:
465
diff
changeset
|
2 MAN=$(SOURCES:%.txt=%) |
efa4a7e2f322
Move hgrc documentation out to its own man page, hgrc(5).
Bryan O'Sullivan <bos@serpentine.com>
parents:
465
diff
changeset
|
3 HTML=$(SOURCES:%.txt=%.html) |
12921
6b6e7da9bccd
doc/Makefile: docs now also depend on extensions
Martin Geisler <mg@aragost.com>
parents:
12841
diff
changeset
|
4 GENDOC=gendoc.py ../mercurial/commands.py ../mercurial/help.py \ |
43736
640bae94f2f3
cleanup: update references to /help/ that should now be /helptext/
Augie Fackler <augie@google.com>
parents:
42058
diff
changeset
|
5 ../mercurial/helptext/*.txt ../hgext/*.py ../hgext/*/__init__.py |
2233 | 6 PREFIX=/usr/local |
4030
a48971ae1387
install man pages by default into $(PREFIX)/share/man not $(PREFIX)/man since the FHS puts them there
Jonathan Smith <https://issues.rpath.com/>
parents:
3908
diff
changeset
|
7 MANDIR=$(PREFIX)/share/man |
44721
eb9026a84e83
make: drop the `-c` arg to `install` in the documentation makefile
Matt Harbison <matt_harbison@yahoo.com>
parents:
43736
diff
changeset
|
8 INSTALL=install -m 644 |
46817
dc101c236219
makefile: use Python 3 by default when building docs as well
Martin von Zweigbergk <martinvonz@google.com>
parents:
44721
diff
changeset
|
9 # Default to Python 3. |
dc101c236219
makefile: use Python 3 by default when building docs as well
Martin von Zweigbergk <martinvonz@google.com>
parents:
44721
diff
changeset
|
10 # |
dc101c236219
makefile: use Python 3 by default when building docs as well
Martin von Zweigbergk <martinvonz@google.com>
parents:
44721
diff
changeset
|
11 # Windows ships Python 3 as `python.exe`, which may not be on PATH. py.exe is. |
dc101c236219
makefile: use Python 3 by default when building docs as well
Martin von Zweigbergk <martinvonz@google.com>
parents:
44721
diff
changeset
|
12 ifeq ($(OS),Windows_NT) |
dc101c236219
makefile: use Python 3 by default when building docs as well
Martin von Zweigbergk <martinvonz@google.com>
parents:
44721
diff
changeset
|
13 PYTHON?=py -3 |
dc101c236219
makefile: use Python 3 by default when building docs as well
Martin von Zweigbergk <martinvonz@google.com>
parents:
44721
diff
changeset
|
14 else |
dc101c236219
makefile: use Python 3 by default when building docs as well
Martin von Zweigbergk <martinvonz@google.com>
parents:
44721
diff
changeset
|
15 PYTHON?=python3 |
dc101c236219
makefile: use Python 3 by default when building docs as well
Martin von Zweigbergk <martinvonz@google.com>
parents:
44721
diff
changeset
|
16 endif |
13054
25200c7efe0f
runrst: add RSTARGS Makefile variable to allow customization
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
12921
diff
changeset
|
17 RSTARGS= |
465 | 18 |
19427
80983af366b5
doc: make i18n man and html
Takumi IINO <trot.thunder@gmail.com>
parents:
19426
diff
changeset
|
19 export HGENCODING=UTF-8 |
9971
fa99480d5135
doc/Makefile: ensure C locale
Martin Geisler <mg@lazybytes.net>
parents:
9703
diff
changeset
|
20 |
1006
b0e581438835
Generate html documentation by default, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
671
diff
changeset
|
21 all: man html |
465 | 22 |
23 man: $(MAN) | |
24 | |
25 html: $(HTML) | |
26 | |
41850
d80d48928eb1
setup: define build_doc command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
34622
diff
changeset
|
27 # This logic is duplicated in setup.py:hgbuilddoc() |
19426
e43184680461
doc: make man and html from translated documents
Takumi IINO <trot.thunder@gmail.com>
parents:
19425
diff
changeset
|
28 common.txt $(SOURCES) $(SOURCES:%.txt=%.gendoc.txt): $(GENDOC) |
34622
b584ed1b225d
build: make install in "/doc" failed if the destination dir contained spaces
muxator <a.mux@inwind.it>
parents:
19427
diff
changeset
|
29 ${PYTHON} gendoc.py "$(basename $@)" > $@.tmp |
9444
2f7f6e43d52b
doc/Makefile: do not create files in case of errors
Martin Geisler <mg@lazybytes.net>
parents:
9422
diff
changeset
|
30 mv $@.tmp $@ |
1814
7956893e8458
generate hg manpage from commands.py docstring
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1689
diff
changeset
|
31 |
19426
e43184680461
doc: make man and html from translated documents
Takumi IINO <trot.thunder@gmail.com>
parents:
19425
diff
changeset
|
32 %: %.txt %.gendoc.txt common.txt |
13054
25200c7efe0f
runrst: add RSTARGS Makefile variable to allow customization
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
12921
diff
changeset
|
33 $(PYTHON) runrst hgmanpage $(RSTARGS) --halt warning \ |
9445
f0105f2c424c
doc/Makefile: make rst2html and rst2man halt on warnings
Martin Geisler <mg@lazybytes.net>
parents:
9444
diff
changeset
|
34 --strip-elements-with-class htmlonly $*.txt $* |
465 | 35 |
19426
e43184680461
doc: make man and html from translated documents
Takumi IINO <trot.thunder@gmail.com>
parents:
19425
diff
changeset
|
36 %.html: %.txt %.gendoc.txt common.txt |
13054
25200c7efe0f
runrst: add RSTARGS Makefile variable to allow customization
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
12921
diff
changeset
|
37 $(PYTHON) runrst html $(RSTARGS) --halt warning \ |
9626
d1aa5393bef4
doc: add a style sheet to the generated HTML pages
Martin Geisler <mg@lazybytes.net>
parents:
9445
diff
changeset
|
38 --link-stylesheet --stylesheet-path style.css $*.txt $*.html |
465 | 39 |
3872
9d7ac8613340
fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3269
diff
changeset
|
40 MANIFEST: man html |
9401
2a5144687727
doc/Makefile: Don't show Makefile comments in output
Mads Kiilerich <mads@kiilerich.com>
parents:
9400
diff
changeset
|
41 # tracked files are already in the main MANIFEST |
3872
9d7ac8613340
fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3269
diff
changeset
|
42 $(RM) $@ |
12841
5fbc2c38a98f
doc/Makefile: do not include hg.1.gendoc.txt in MANIFEST
Martin Geisler <mg@lazybytes.net>
parents:
12840
diff
changeset
|
43 for i in $(MAN) $(HTML); do \ |
3872
9d7ac8613340
fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3269
diff
changeset
|
44 echo "doc/$$i" >> $@ ; \ |
9d7ac8613340
fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3269
diff
changeset
|
45 done |
9d7ac8613340
fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3269
diff
changeset
|
46 |
2233 | 47 install: man |
48 for i in $(MAN) ; do \ | |
8822
1027da7d2fb9
doc: fix regexp for determining the man page section
Cédric Duval <cedricduval@free.fr>
parents:
8311
diff
changeset
|
49 subdir=`echo $$i | sed -n 's/^.*\.\([0-9]\)$$/man\1/p'` ; \ |
34622
b584ed1b225d
build: make install in "/doc" failed if the destination dir contained spaces
muxator <a.mux@inwind.it>
parents:
19427
diff
changeset
|
50 mkdir -p "$(DESTDIR)$(MANDIR)"/$$subdir ; \ |
b584ed1b225d
build: make install in "/doc" failed if the destination dir contained spaces
muxator <a.mux@inwind.it>
parents:
19427
diff
changeset
|
51 $(INSTALL) $$i "$(DESTDIR)$(MANDIR)"/$$subdir ; \ |
2233 | 52 done |
53 | |
465 | 54 clean: |
19426
e43184680461
doc: make man and html from translated documents
Takumi IINO <trot.thunder@gmail.com>
parents:
19425
diff
changeset
|
55 $(RM) $(MAN) $(HTML) common.txt $(SOURCES) $(SOURCES:%.txt=%.gendoc.txt) MANIFEST |