mirror of https://github.com/tLDP/python-tldp
Merge pull request #11 from martin-a-brown/master
catch up to 0.7.14 (from May 2016) in tLDP repo: add --version flag
This commit is contained in:
commit
8f34526e4f
|
@ -1,8 +1,8 @@
|
||||||
%define sourcename tldp
|
%define sourcename tldp
|
||||||
%define name python-tldp
|
%define name python-tldp
|
||||||
%define version 0.7.13
|
%define version 0.7.14
|
||||||
%define unmangled_version 0.7.13
|
%define unmangled_version 0.7.14
|
||||||
%define unmangled_version 0.7.13
|
%define unmangled_version 0.7.14
|
||||||
%define release 1
|
%define release 1
|
||||||
|
|
||||||
Summary: automatic publishing tool for DocBook, Linuxdoc and Asciidoc
|
Summary: automatic publishing tool for DocBook, Linuxdoc and Asciidoc
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
tldp (0.7.14-1) unstable; urgency=low
|
||||||
|
|
||||||
|
* Add --version option.
|
||||||
|
|
||||||
|
-- Martin A. Brown <martin@linux-ip.net> Mon, 16 May 2016 16:54:47 +0000
|
||||||
|
|
||||||
tldp (0.7.13-1) unstable; urgency=low
|
tldp (0.7.13-1) unstable; urgency=low
|
||||||
|
|
||||||
* Fix testsuite when run as root (Closes: #824201).
|
* Fix testsuite when run as root (Closes: #824201).
|
||||||
|
@ -8,4 +14,4 @@ tldp (0.7.12-1) unstable; urgency=low
|
||||||
|
|
||||||
* Initial release (Closes: #822181)
|
* Initial release (Closes: #822181)
|
||||||
|
|
||||||
-- Martin A. Brown <martin@linux-ip.net> Wed, 27 Apr 2016 17:09:56 +0000
|
-- Martin A. Brown <martin@linux-ip.net> Wed, 27 Apr 2016 17:09:56 +0000
|
||||||
|
|
|
@ -14,7 +14,8 @@ Description
|
||||||
|
|
||||||
:program:`ldptool` creates chunked HTML, single-page HTML, PDF and plain text
|
:program:`ldptool` creates chunked HTML, single-page HTML, PDF and plain text
|
||||||
outputs for each source document it is passed as a *pathname*. See
|
outputs for each source document it is passed as a *pathname*. See
|
||||||
`Source document discovery`_.
|
`Source document discovery`_. It will compare the source document and output
|
||||||
|
document and rebuild an output only if the content has changed.
|
||||||
|
|
||||||
If it is not passed any arguments, `ldptool` will collect all of the
|
If it is not passed any arguments, `ldptool` will collect all of the
|
||||||
directories specified with the --sourcedir option and scan through these
|
directories specified with the --sourcedir option and scan through these
|
||||||
|
@ -47,6 +48,9 @@ Action options
|
||||||
-h, --help
|
-h, --help
|
||||||
show a help message and exit
|
show a help message and exit
|
||||||
|
|
||||||
|
-V, --version
|
||||||
|
print out the version number
|
||||||
|
|
||||||
-b, --build
|
-b, --build
|
||||||
Build LDP documentation into the `--builddir` and exit.
|
Build LDP documentation into the `--builddir` and exit.
|
||||||
This is the default action if no other action is specified.
|
This is the default action if no other action is specified.
|
||||||
|
@ -166,14 +170,15 @@ span multiple files. Although more than half of the LDP document collection
|
||||||
consists of single-file HOWTO contributions, there are a number of documents
|
consists of single-file HOWTO contributions, there are a number of documents
|
||||||
that are composed of dozens, even hundreds of files. In order to accommodate
|
that are composed of dozens, even hundreds of files. In order to accommodate
|
||||||
both the simple documents and these much more complex documents, LDP adopted a
|
both the simple documents and these much more complex documents, LDP adopted a
|
||||||
simple (unoriginal) naming strategy to allow a single document to span
|
simple (though not unique) naming strategy to allow a single document to span
|
||||||
multiple files::
|
multiple files::
|
||||||
|
|
||||||
Each document is referred to by a stem, which is the filename without any
|
Each document is referred to by a stem, which is the filename
|
||||||
extension. A single file document is simple STEM.EXT. A document that
|
without any extension. A single file document is simple
|
||||||
requires many files must be contained in a directory with the STEM name.
|
STEM.EXT. A document that requires many files must be contained
|
||||||
Therefore, the primary source document will always be called either STEM.EXT
|
in a directory with the STEM name. Therefore, the primary
|
||||||
or STEM/STEM.EXT.
|
source document will always be called either STEM.EXT or
|
||||||
|
STEM/STEM.EXT.
|
||||||
|
|
||||||
(If there is a STEM/STEM.xml and STEM/STEM.sgml in the same directory, that is
|
(If there is a STEM/STEM.xml and STEM/STEM.sgml in the same directory, that is
|
||||||
an error, and `ldptool` will freak out and shoot pigeons.)
|
an error, and `ldptool` will freak out and shoot pigeons.)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
.\" Man page generated from reStructuredText.
|
.\" Man page generated from reStructuredText.
|
||||||
.
|
.
|
||||||
.TH "LDPTOOL" "1" "2016-04-21" "1.9.2" "ldptool"
|
.TH "LDPTOOL" "1" "May 16, 2016" "1.9.2" "ldptool"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
ldptool \- DocBook, Linuxdoc and Asciidoc build/publishing tool.
|
ldptool \- DocBook, Linuxdoc and Asciidoc build/publishing tool.
|
||||||
.
|
.
|
||||||
|
@ -37,7 +37,8 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||||
.sp
|
.sp
|
||||||
\fBldptool\fP creates chunked HTML, single\-page HTML, PDF and plain text
|
\fBldptool\fP creates chunked HTML, single\-page HTML, PDF and plain text
|
||||||
outputs for each source document it is passed as a \fIpathname\fP\&. See
|
outputs for each source document it is passed as a \fIpathname\fP\&. See
|
||||||
\fI\%Source document discovery\fP\&.
|
\fI\%Source document discovery\fP\&. It will compare the source document and output
|
||||||
|
document and rebuild an output only if the content has changed.
|
||||||
.sp
|
.sp
|
||||||
If it is not passed any arguments, \fIldptool\fP will collect all of the
|
If it is not passed any arguments, \fIldptool\fP will collect all of the
|
||||||
directories specified with the \-\-sourcedir option and scan through these
|
directories specified with the \-\-sourcedir option and scan through these
|
||||||
|
@ -81,6 +82,9 @@ generate configuration files that it can then take as input
|
||||||
.B \-h\fP,\fB \-\-help
|
.B \-h\fP,\fB \-\-help
|
||||||
show a help message and exit
|
show a help message and exit
|
||||||
.TP
|
.TP
|
||||||
|
.B \-V\fP,\fB \-\-version
|
||||||
|
print out the version number
|
||||||
|
.TP
|
||||||
.B \-b\fP,\fB \-\-build
|
.B \-b\fP,\fB \-\-build
|
||||||
Build LDP documentation into the \fI\-\-builddir\fP and exit.
|
Build LDP documentation into the \fI\-\-builddir\fP and exit.
|
||||||
This is the default action if no other action is specified.
|
This is the default action if no other action is specified.
|
||||||
|
@ -204,18 +208,19 @@ span multiple files. Although more than half of the LDP document collection
|
||||||
consists of single\-file HOWTO contributions, there are a number of documents
|
consists of single\-file HOWTO contributions, there are a number of documents
|
||||||
that are composed of dozens, even hundreds of files. In order to accommodate
|
that are composed of dozens, even hundreds of files. In order to accommodate
|
||||||
both the simple documents and these much more complex documents, LDP adopted a
|
both the simple documents and these much more complex documents, LDP adopted a
|
||||||
simple (unoriginal) naming strategy to allow a single document to span
|
simple (though not unique) naming strategy to allow a single document to span
|
||||||
multiple files:
|
multiple files:
|
||||||
.INDENT 0.0
|
.INDENT 0.0
|
||||||
.INDENT 3.5
|
.INDENT 3.5
|
||||||
.sp
|
.sp
|
||||||
.nf
|
.nf
|
||||||
.ft C
|
.ft C
|
||||||
Each document is referred to by a stem, which is the filename without any
|
Each document is referred to by a stem, which is the filename
|
||||||
extension. A single file document is simple STEM.EXT. A document that
|
without any extension. A single file document is simple
|
||||||
requires many files must be contained in a directory with the STEM name.
|
STEM.EXT. A document that requires many files must be contained
|
||||||
Therefore, the primary source document will always be called either STEM.EXT
|
in a directory with the STEM name. Therefore, the primary
|
||||||
or STEM/STEM.EXT.
|
source document will always be called either STEM.EXT or
|
||||||
|
STEM/STEM.EXT.
|
||||||
.ft P
|
.ft P
|
||||||
.fi
|
.fi
|
||||||
.UNINDENT
|
.UNINDENT
|
||||||
|
|
|
@ -12,6 +12,7 @@ import uuid
|
||||||
import errno
|
import errno
|
||||||
import codecs
|
import codecs
|
||||||
import random
|
import random
|
||||||
|
import unittest
|
||||||
from tempfile import NamedTemporaryFile as ntf
|
from tempfile import NamedTemporaryFile as ntf
|
||||||
from argparse import Namespace
|
from argparse import Namespace
|
||||||
|
|
||||||
|
@ -20,6 +21,7 @@ from tldp.typeguesser import knowndoctypes
|
||||||
from tldp.inventory import stypes, status_types
|
from tldp.inventory import stypes, status_types
|
||||||
from tldp.sources import SourceDocument
|
from tldp.sources import SourceDocument
|
||||||
from tldp.outputs import OutputDirectory
|
from tldp.outputs import OutputDirectory
|
||||||
|
from tldp import VERSION
|
||||||
|
|
||||||
# -- Test Data
|
# -- Test Data
|
||||||
import example
|
import example
|
||||||
|
@ -127,6 +129,22 @@ class TestDriverShowStatustypes(TestToolsFilesystem):
|
||||||
self.assertEqual(exitcode, os.EX_OK)
|
self.assertEqual(exitcode, os.EX_OK)
|
||||||
|
|
||||||
|
|
||||||
|
class TestDriverShowVersion(unittest.TestCase):
|
||||||
|
|
||||||
|
def test_show_version(self):
|
||||||
|
stdout = io.StringIO()
|
||||||
|
result = tldp.driver.show_version(Namespace(), file=stdout)
|
||||||
|
self.assertEqual(result, os.EX_OK)
|
||||||
|
stdout.seek(0)
|
||||||
|
data = stdout.read().strip()
|
||||||
|
for status in status_types:
|
||||||
|
self.assertEqual(VERSION, data)
|
||||||
|
|
||||||
|
def test_run_statustypes(self):
|
||||||
|
exitcode = tldp.driver.run(['--version'])
|
||||||
|
self.assertEqual(exitcode, os.EX_OK)
|
||||||
|
|
||||||
|
|
||||||
class TestDriverSummary(TestInventoryBase):
|
class TestDriverSummary(TestInventoryBase):
|
||||||
|
|
||||||
def test_run_summary(self):
|
def test_run_summary(self):
|
||||||
|
|
|
@ -3,10 +3,11 @@
|
||||||
# Copyright (c) 2016 Linux Documentation Project
|
# Copyright (c) 2016 Linux Documentation Project
|
||||||
|
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import tldp.config
|
import tldp.config
|
||||||
import tldp.outputs
|
import tldp.outputs
|
||||||
import tldp.sources
|
import tldp.sources
|
||||||
import tldp.inventory
|
import tldp.inventory
|
||||||
|
|
||||||
VERSION = "0.7.13"
|
VERSION = "0.7.14"
|
||||||
|
|
|
@ -146,6 +146,11 @@ def collectconfiguration(tag, argv):
|
||||||
action='store_true', default=False,
|
action='store_true', default=False,
|
||||||
help='show status types and classes [%(default)s]')
|
help='show status types and classes [%(default)s]')
|
||||||
|
|
||||||
|
g.add_argument('--version',
|
||||||
|
'-V',
|
||||||
|
action='store_true', default=False,
|
||||||
|
help='print out the version number [%(default)s]')
|
||||||
|
|
||||||
# -- collect up the distributed configuration fragments
|
# -- collect up the distributed configuration fragments
|
||||||
#
|
#
|
||||||
for cls in tldp.typeguesser.knowndoctypes:
|
for cls in tldp.typeguesser.knowndoctypes:
|
||||||
|
|
|
@ -24,6 +24,7 @@ from tldp.config import collectconfiguration
|
||||||
from tldp.utils import arg_isloglevel, arg_isdirectory
|
from tldp.utils import arg_isloglevel, arg_isdirectory
|
||||||
from tldp.utils import swapdirs, sameFilesystem
|
from tldp.utils import swapdirs, sameFilesystem
|
||||||
from tldp.doctypes.common import preamble, postamble
|
from tldp.doctypes.common import preamble, postamble
|
||||||
|
from tldp import VERSION
|
||||||
|
|
||||||
# -- Don't freak out with IOError when our STDOUT, handled with
|
# -- Don't freak out with IOError when our STDOUT, handled with
|
||||||
# head, sed, awk, grep, etc; and, also deal with a user's ctrl-C
|
# head, sed, awk, grep, etc; and, also deal with a user's ctrl-C
|
||||||
|
@ -52,6 +53,11 @@ ERR_UNKNOWNARGS = "Unknown arguments received: "
|
||||||
ERR_EXTRAARGS = "Extra arguments received: "
|
ERR_EXTRAARGS = "Extra arguments received: "
|
||||||
|
|
||||||
|
|
||||||
|
def show_version(config, *args, **kwargs):
|
||||||
|
file = kwargs.get('file', sys.stdout)
|
||||||
|
print(VERSION, file=file)
|
||||||
|
return os.EX_OK
|
||||||
|
|
||||||
def show_doctypes(config, *args, **kwargs):
|
def show_doctypes(config, *args, **kwargs):
|
||||||
if args:
|
if args:
|
||||||
return ERR_EXTRAARGS + ' '.join(args)
|
return ERR_EXTRAARGS + ' '.join(args)
|
||||||
|
@ -508,6 +514,9 @@ def collectWorkset(config, args):
|
||||||
|
|
||||||
def handleArgs(config, args):
|
def handleArgs(config, args):
|
||||||
|
|
||||||
|
if config.version:
|
||||||
|
return show_version(config, *args)
|
||||||
|
|
||||||
if config.doctypes:
|
if config.doctypes:
|
||||||
return show_doctypes(config, *args)
|
return show_doctypes(config, *args)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue