Mercurial > hg-stable
view tests/seq.py @ 41855:d80d48928eb1
setup: define build_doc command
Currently, various processes for packaging Mercurial state to
manually invoke `make -C doc` in order to generate the documentation.
This Makefile merely invokes `gendoc.py` and `runrst` to produce
man pages and HTML pages.
Not all environments may have the ability to easily run
Makefiles. Windows is notably in this set.
This commit ports the man page and HTML generation logic from
doc/Makefile to setup.py. We introduce a new build_doc command
which generates documentation by calling gendoc.py and runrst.
The documentation can now be built via pure Python by running
`python setup.py build_doc`.
We don't implement dependency tracking because IMO it is more
effort than it is worth.
We could potentially remove the duplicated functionality in
doc/Makefile. But I'm not sure what all is depending on it. So
I plan to keep it around.
# no-check-commit because forced foo_bar function names
Differential Revision: https://phab.mercurial-scm.org/D6063
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 03 Mar 2019 10:31:23 -0800 |
parents | 0605726179a0 |
children | 2372284d9457 |
line wrap: on
line source
#!/usr/bin/env python # # A portable replacement for 'seq' # # Usage: # seq STOP [1, STOP] stepping by 1 # seq START STOP [START, STOP] stepping by 1 # seq START STEP STOP [START, STOP] stepping by STEP from __future__ import absolute_import, print_function import os import sys try: import msvcrt msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY) msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY) except ImportError: pass if sys.version_info[0] >= 3: xrange = range start = 1 if len(sys.argv) > 2: start = int(sys.argv[1]) step = 1 if len(sys.argv) > 3: step = int(sys.argv[2]) stop = int(sys.argv[-1]) + 1 for i in xrange(start, stop, step): print(i)