Merge branch 'master' of github.com:martin-a-brown/python-tldp

This commit is contained in:
Martin A. Brown 2016-04-30 14:57:29 -07:00
commit 7bea460452
47 changed files with 264 additions and 183 deletions

View File

@ -1,3 +1,5 @@
Copyright (c) 2016, Linux Documentation Project
Permission is hereby granted, free of charge, to any person Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files obtaining a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction, (the "Software"), to deal in the Software without restriction,

View File

@ -338,9 +338,11 @@ called ldp-docbook-{xsl,dsssl}. There aren't any such packages for RPM (yet).
Supported Python versions Supported Python versions
------------------------- -------------------------
This package was built and used against Python-2.7.8 (OpenSUS) and This package was developed against Python-2.7.8 and Python-3.4.1 (on
Python-2.7.6 (Ubuntu). It has been tested (success for test suite) against OpenSUSE). It has been used on Python-2.7.6 (Ubuntu-14.04) and Python-3.4.2 and Python-2.7.9 (on Debian 8).
Python-3.4.1 and lightly used against Python-3.4.1.
Continuous Integration testing information and coverage can be reviewed at
`this project's Travis CI page <https://travis-ci.org/martin-a-brown/python-tldp/>`_.
Installation Installation
@ -351,25 +353,39 @@ requires a large number of other packages, most of which are outside of the
Python ecosystem. There's room for improvement here, but here are a few Python ecosystem. There's room for improvement here, but here are a few
tidbits. tidbits.
Build an RPM::: Build an RPM::
python setup.py sdist && rpmbuild -ta ./dist/python-tldp-${VERSION}.tar.gz python setup.py sdist && rpmbuild -ta ./dist/python-tldp-${VERSION}.tar.gz
There's a file, `contrib/tldp.spec`, which makes a few changes to the There's a generated file, `contrib/tldp.spec`, which makes a few changes to the
setuptools stock-generated specfile. Specifically, the package gets named setuptools stock-generated specfile. It adds the dependencies, marks the
`python-tldp` instead of `tldp` and the configuration file is marked configuration file as %config(noreplace), adds a manpage and names the binary
`%config(noreplace)`. package `python-tldp`.
I know less about packaging for Debian. Relying on python-stdeb yields a Build a DEB::
working and usable Debian package which has been tested out on an Ubuntu
14.04.3 system.
Build a DEB::: Check to see if the package is available from upstream. It may be included in
the Debian repositories already::
apt-cache search tldp
The quick and dirty way is as follows::
python setup.py --command-packages=stdeb.command bdist_deb python setup.py --command-packages=stdeb.command bdist_deb
I have not tried installing the package in a virtualenv or with pip. If you But, there is also a `debian` directory. If you are working straight from the
try that, please let me know any problems you encounter. git checkout, you should be able to generate an installable (unsigned) Debian
package with::
bash contrib/debian-release.sh -us -uc
Install using pip:
Unknown. Because the tool relies so heavily on system-installed non-Python
tools, I have not bothered to try installing the package using pip. It should
work equivalently as well as running the program straight from a checkout.
If you learn anything here or have suggestions, for me, please feel free to
send them along.
Links Links

View File

@ -1,8 +1,8 @@
%define sourcename tldp %define sourcename tldp
%define name python-tldp %define name python-tldp
%define version 0.7.10 %define version 0.7.11
%define unmangled_version 0.7.10 %define unmangled_version 0.7.11
%define unmangled_version 0.7.10 %define unmangled_version 0.7.11
%define release 1 %define release 1
Summary: automatic publishing tool for DocBook, Linuxdoc and Asciidoc Summary: automatic publishing tool for DocBook, Linuxdoc and Asciidoc

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
tldp (0.7.10-1) unstable; urgency=low tldp (0.7.11-1) unstable; urgency=low
* Initial release (Closes: #822181) * Initial release (Closes: #822181)

2
debian/clean vendored Normal file
View File

@ -0,0 +1,2 @@
tldp.egg-info/
docs/_build/

16
debian/control vendored
View File

@ -34,8 +34,20 @@ Package: python3-tldp
Architecture: all Architecture: all
Depends: ${misc:Depends}, Depends: ${misc:Depends},
${python3:Depends}, ${python3:Depends},
python3, fop,
python3-networkx jing,
xsltproc,
docbook,
docbook5-xml,
docbook-xsl-ns,
htmldoc,
html2text,
sgml2x,
asciidoc,
linuxdoc-tools-latex,
linuxdoc-tools-text,
ldp-docbook-xsl,
ldp-docbook-dsssl
Description: automatic publishing tool for DocBook, Linuxdoc and Asciidoc Description: automatic publishing tool for DocBook, Linuxdoc and Asciidoc
The Linux Documentation Project (TLDP) stores hundreds of documents in The Linux Documentation Project (TLDP) stores hundreds of documents in
DocBook SGML, DocBook XML, Linuxdoc and Asciidoc formats. This tool DocBook SGML, DocBook XML, Linuxdoc and Asciidoc formats. This tool

59
debian/copyright vendored
View File

@ -7,18 +7,18 @@ Files: *
Copyright: 2016 Linux Documentation Project Copyright: 2016 Linux Documentation Project
License: MIT License: MIT
# Files: extras/dsssl/* extras/css/* Files: extras/dsssl/ldp.dsl
# Copyright: 2000-2003 - Greg Ferguson (gferg@metalab.unc.edu) Copyright: 2000-2003 - Greg Ferguson (gferg@metalab.unc.edu)
# License: GPL-2.0+ License: GPL-2.0+
#
Files: extras/dsssl/* extras/xsl/* extras/css/* Files: extras/xsl/tldp-*.xsl extras/css/style.css
Copyright: 2000-2002 - David Horton (dhorton@speakeasy.net) Copyright: 2000-2002 - David Horton (dhorton@speakeasy.net)
License: GFDL-1.2 License: GFDL-1.2
# Files: tests/sample-documents/Docbook-4.2-WHYNOT/images/* tests/sample-documents/DocBookSGML-Larger/images/bullet.png tests/sample-documents/Linuxdoc-Larger/images/* Files: tests/sample-documents/DocBook-4.2-WHYNOT/images/* tests/sample-documents/DocBookSGML-Larger/images/bullet.png
# Copyright: Copyright (C) 2011-2012 O'Reilly Media Copyright: Copyright (C) 2011-2012 O'Reilly Media
# License: MIT License: MIT
#
Files: extras/collateindex.pl Files: extras/collateindex.pl
Copyright: 1997-2001 Norman Walsh Copyright: 1997-2001 Norman Walsh
License: MIT License: MIT
@ -42,23 +42,30 @@ License: MIT
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# License: GPL-2.0+ License: GPL-2.0+
# This package is free software; you can redistribute it and/or modify This package is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. (at your option) any later version.
# . .
# This package is distributed in the hope that it will be useful, This package is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. GNU General Public License for more details.
# . .
# You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/> along with this program. If not, see <http://www.gnu.org/licenses/>
# . .
# On Debian systems, the complete text of the GNU General On Debian systems, the complete text of the GNU General
# Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
#
License: GFDL-1.2 License: GFDL-1.2
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
.
On Debian systems, the complete text of the GFDL-1.2 can be found in On Debian systems, the complete text of the GFDL-1.2 can be found in
/usr/share/common-licenses/GFDL-1.2 /usr/share/common-licenses/GFDL-1.2

View File

@ -1 +0,0 @@
library-package-name-for-application

10
debian/rules vendored
View File

@ -7,13 +7,5 @@ export PYBUILD_NAME=tldp
override_dh_installman: override_dh_installman:
(cd docs && \ (cd docs && \
sphinx-build \ sphinx-build -b man -d _build/doctrees . _build/man)
-b man -D today="$(BUILD_DATE)" \
-d _build/doctrees . _build/man)
dh_installman docs/_build/man/ldptool.1 dh_installman docs/_build/man/ldptool.1
override_dh_clean:
(cd docs && \
rm -rf -- ./_build)
rm -rf -- ./$(PYBUILD_NAME).egg-info
dh_clean

4
debian/upstream/metadata vendored Normal file
View File

@ -0,0 +1,4 @@
Bug-Database: https://github.com/tLDP/LDP/issues
Contact: discuss@en.tldp.org
Name: python-tldp
Repository: https://github.com/tLDP/LDP

View File

@ -1,3 +1,6 @@
# -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals from __future__ import unicode_literals
@ -23,57 +26,39 @@ def load_content(ex):
ex_linuxdoc = Namespace( ex_linuxdoc = Namespace(
doctype=tldp.doctypes.linuxdoc.Linuxdoc, doctype=tldp.doctypes.linuxdoc.Linuxdoc,
filename=opj(sampledocs, 'linuxdoc-simple.sgml'), filename=opj(sampledocs, 'linuxdoc-simple.sgml'),)
)
ex_docbooksgml = Namespace( ex_docbooksgml = Namespace(
doctype=tldp.doctypes.docbooksgml.DocbookSGML, doctype=tldp.doctypes.docbooksgml.DocbookSGML,
filename=opj(sampledocs, 'docbooksgml-simple.sgml'), filename=opj(sampledocs, 'docbooksgml-simple.sgml'),)
)
ex_docbook4xml = Namespace( ex_docbook4xml = Namespace(
doctype=tldp.doctypes.docbook4xml.Docbook4XML, doctype=tldp.doctypes.docbook4xml.Docbook4XML,
filename=opj(sampledocs, 'docbook4xml-simple.xml'), filename=opj(sampledocs, 'docbook4xml-simple.xml'),)
)
ex_docbook5xml = Namespace( ex_docbook5xml = Namespace(
doctype=tldp.doctypes.docbook5xml.Docbook5XML, doctype=tldp.doctypes.docbook5xml.Docbook5XML,
filename=opj(sampledocs, 'docbook5xml-simple.xml'), filename=opj(sampledocs, 'docbook5xml-simple.xml'),)
)
ex_asciidoc = Namespace( ex_asciidoc = Namespace(
doctype=tldp.doctypes.asciidoc.Asciidoc, doctype=tldp.doctypes.asciidoc.Asciidoc,
filename=opj(sampledocs, 'asciidoc-complete.txt'), filename=opj(sampledocs, 'asciidoc-complete.txt'),)
)
#
# ex_rst = Namespace(
# doctype=tldp.doctypes.rst.RestructuredText,
# filename=opj(sampledocs, 'restructuredtext-simple.rst'),
# )
#
# ex_markdown = Namespace(
# doctype=tldp.doctypes.markdown.Markdown,
# filename=opj(sampledocs, 'markdown-simple.md'),
# )
ex_linuxdoc_dir = Namespace( ex_linuxdoc_dir = Namespace(
doctype=tldp.doctypes.linuxdoc.Linuxdoc, doctype=tldp.doctypes.linuxdoc.Linuxdoc,
filename=opj(sampledocs, 'Linuxdoc-Larger', filename=opj(sampledocs, 'Linuxdoc-Larger',
'Linuxdoc-Larger.sgml'), 'Linuxdoc-Larger.sgml'),)
)
ex_docbook4xml_dir = Namespace( ex_docbook4xml_dir = Namespace(
doctype=tldp.doctypes.docbook4xml.Docbook4XML, doctype=tldp.doctypes.docbook4xml.Docbook4XML,
filename=opj(sampledocs, 'DocBook-4.2-WHYNOT', filename=opj(sampledocs, 'DocBook-4.2-WHYNOT',
'DocBook-4.2-WHYNOT.xml'), 'DocBook-4.2-WHYNOT.xml'),)
)
ex_docbooksgml_dir = Namespace( ex_docbooksgml_dir = Namespace(
doctype=tldp.doctypes.docbooksgml.DocbookSGML, doctype=tldp.doctypes.docbooksgml.DocbookSGML,
filename=opj(sampledocs, 'DocBookSGML-Larger', filename=opj(sampledocs, 'DocBookSGML-Larger',
'DocBookSGML-Larger.sgml'), 'DocBookSGML-Larger.sgml'),)
)
# -- a bit ugly, but grab each dict # -- a bit ugly, but grab each dict
sources = [y for x, y in locals().items() if x.startswith('ex_')] sources = [y for x, y in locals().items() if x.startswith('ex_')]
@ -81,18 +66,14 @@ sources = [y for x, y in locals().items() if x.startswith('ex_')]
for ex in sources: for ex in sources:
load_content(ex) load_content(ex)
unknown_doctype = Namespace( unknown_doctype = Namespace(
doctype=None, doctype=None,
filename=opj(sampledocs, 'Unknown-Doctype.xqf'), filename=opj(sampledocs, 'Unknown-Doctype.xqf'),)
)
broken_docbook4xml = Namespace( broken_docbook4xml = Namespace(
doctype=tldp.doctypes.docbook4xml.Docbook4XML, doctype=tldp.doctypes.docbook4xml.Docbook4XML,
filename=opj(sampledocs, 'docbook4xml-broken.xml'), filename=opj(sampledocs, 'docbook4xml-broken.xml'),)
)
load_content(broken_docbook4xml) load_content(broken_docbook4xml)
# -- end of file # -- end of file

View File

@ -1,3 +1,6 @@
# -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function

View File

@ -1,3 +1,6 @@
# -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function

View File

@ -1,7 +1,7 @@
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V4.1//EN"> <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
<article> <article>
<articleinfo> <articleinfo>
<title>T</title> <title>Bad Dir Multiple Doctypes (DocBook SGML 4.1)</title>
<author> <author>
<firstname>A</firstname> <surname>B</surname> <firstname>A</firstname> <surname>B</surname>
<affiliation> <affiliation>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<article xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="en"> <article xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="en">
<title>Simple article</title> <title>Bad Dir Multiple Doctypes (DocBook XML 5.0)</title>
<para>This is a ridiculously terse article.</para> <para>This is a ridiculously terse article.</para>
</article> </article>

View File

@ -1,7 +1,7 @@
<!doctype linuxdoc system> <!doctype linuxdoc system>
<article> <article>
<title>B <title>Linuxdoc Larger Document
<author>A <author>Another Author
<date>2016-02-11 <date>2016-02-11
<abstract> abstract </abstract> <abstract> abstract </abstract>
<toc> <toc>

View File

@ -1 +0,0 @@
No content.

View File

@ -1 +0,0 @@
No content.

View File

@ -1,3 +1,6 @@
# -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals from __future__ import unicode_literals
@ -80,14 +83,13 @@ class CascadingConfigBasicTest(CCTestTools):
ap.add_argument('--size', default=9, type=int) ap.add_argument('--size', default=9, type=int)
c = Namespace( c = Namespace(
tag='tag', tag='tag',
argparser=ap, argparser=ap,
argv=''.split(), argv=''.split(),
env=dict(), env=dict(),
cfg='', cfg='',
exp_config=Namespace(size=9), exp_config=Namespace(size=9),
exp_args=[], exp_args=[],)
)
cc = CascadingConfig(c.tag, c.argparser, argv=c.argv, env=c.env) cc = CascadingConfig(c.tag, c.argparser, argv=c.argv, env=c.env)
config, args = cc.parse() config, args = cc.parse()
@ -99,14 +101,13 @@ class CascadingConfigBasicTest(CCTestTools):
ap.add_argument('--size', default=9, type=int) ap.add_argument('--size', default=9, type=int)
c = Namespace( c = Namespace(
tag='tag', tag='tag',
argparser=ap, argparser=ap,
argv=''.split(), argv=''.split(),
env=dict(), env=dict(),
cfg='[tag]\nsize = 8', cfg='[tag]\nsize = 8',
exp_config=Namespace(size=8), exp_config=Namespace(size=8),
exp_args=[], exp_args=[],)
)
self.writeconfig(c) self.writeconfig(c)
c.env.setdefault('TAG_CONFIGFILE', c.configfile) c.env.setdefault('TAG_CONFIGFILE', c.configfile)
@ -122,14 +123,13 @@ class CascadingConfigBasicTest(CCTestTools):
import logging import logging
logging.getLogger().setLevel(logging.DEBUG) logging.getLogger().setLevel(logging.DEBUG)
c = Namespace( c = Namespace(
tag='tag', tag='tag',
argparser=ap, argparser=ap,
argv=''.split(), argv=''.split(),
env=dict(), env=dict(),
cfg='[tag]\nsize = 8', cfg='[tag]\nsize = 8',
exp_config=Namespace(size=8), exp_config=Namespace(size=8),
exp_args=[], exp_args=[],)
)
self.writeconfig(c) self.writeconfig(c)
c.argv.extend(['--configfile', c.configfile]) c.argv.extend(['--configfile', c.configfile])
cc = CascadingConfig(c.tag, c.argparser, argv=c.argv, env=c.env) cc = CascadingConfig(c.tag, c.argparser, argv=c.argv, env=c.env)
@ -144,14 +144,13 @@ class CascadingConfigBasicTest(CCTestTools):
import logging import logging
logging.getLogger().setLevel(logging.DEBUG) logging.getLogger().setLevel(logging.DEBUG)
c = Namespace( c = Namespace(
tag='tag', tag='tag',
argparser=ap, argparser=ap,
argv=''.split(), argv=''.split(),
env=dict(TAG_SIZE=7, ), env=dict(TAG_SIZE=7, ),
cfg='[tag]\nsize = 8', cfg='[tag]\nsize = 8',
exp_config=Namespace(size=7), exp_config=Namespace(size=7),
exp_args=[], exp_args=[],)
)
self.writeconfig(c) self.writeconfig(c)
c.argv.extend(['--configfile', c.configfile]) c.argv.extend(['--configfile', c.configfile])
cc = CascadingConfig(c.tag, c.argparser, argv=c.argv, env=c.env) cc = CascadingConfig(c.tag, c.argparser, argv=c.argv, env=c.env)
@ -166,14 +165,13 @@ class CascadingConfigBasicTest(CCTestTools):
import logging import logging
logging.getLogger().setLevel(logging.DEBUG) logging.getLogger().setLevel(logging.DEBUG)
c = Namespace( c = Namespace(
tag='tag', tag='tag',
argparser=ap, argparser=ap,
argv='--size 6'.split(), argv='--size 6'.split(),
env=dict(TAG_SIZE=7, ), env=dict(TAG_SIZE=7, ),
cfg='[tag]\nsize = 8', cfg='[tag]\nsize = 8',
exp_config=Namespace(size=6), exp_config=Namespace(size=6),
exp_args=[], exp_args=[],)
)
self.writeconfig(c) self.writeconfig(c)
c.argv.extend(['--configfile', c.configfile]) c.argv.extend(['--configfile', c.configfile])
cc = CascadingConfig(c.tag, c.argparser, argv=c.argv, env=c.env) cc = CascadingConfig(c.tag, c.argparser, argv=c.argv, env=c.env)
@ -185,14 +183,13 @@ class CascadingConfigBasicTest(CCTestTools):
ap.add_argument('--source', default='', action='append', type=str) ap.add_argument('--source', default='', action='append', type=str)
c = Namespace( c = Namespace(
tag='tag', tag='tag',
argparser=ap, argparser=ap,
argv=''.split(), argv=''.split(),
env=dict(), env=dict(),
cfg='', cfg='',
exp_config=Namespace(source=''), exp_config=Namespace(source=''),
exp_args=[], exp_args=[],)
)
cc = CascadingConfig(c.tag, c.argparser, argv=c.argv, env=c.env) cc = CascadingConfig(c.tag, c.argparser, argv=c.argv, env=c.env)
config, args = cc.parse() config, args = cc.parse()
self.assertEqual(c.exp_config, config) self.assertEqual(c.exp_config, config)
@ -203,14 +200,13 @@ class CascadingConfigBasicTest(CCTestTools):
ap.add_argument('--source', default='', action='append', type=str) ap.add_argument('--source', default='', action='append', type=str)
c = Namespace( c = Namespace(
tag='tag', tag='tag',
argparser=ap, argparser=ap,
argv='--source /some/path'.split(), argv='--source /some/path'.split(),
env=dict(), env=dict(),
cfg='', cfg='',
exp_config=Namespace(source=['/some/path']), exp_config=Namespace(source=['/some/path']),
exp_args=[], exp_args=[],)
)
cc = CascadingConfig(c.tag, c.argparser, argv=c.argv, env=c.env) cc = CascadingConfig(c.tag, c.argparser, argv=c.argv, env=c.env)
config, args = cc.parse() config, args = cc.parse()
self.assertEqual(c.exp_config, config) self.assertEqual(c.exp_config, config)

View File

@ -1,3 +1,6 @@
# -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals from __future__ import unicode_literals

View File

@ -1,3 +1,6 @@
# -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals from __future__ import unicode_literals

View File

@ -1,3 +1,6 @@
# -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals from __future__ import unicode_literals

View File

@ -1,3 +1,6 @@
# -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals from __future__ import unicode_literals
@ -38,7 +41,7 @@ class TestOutputCollection(TestToolsFilesystem):
def test_file_in_output_collection(self): def test_file_in_output_collection(self):
reldir, absdir = self.adddir('collection') reldir, absdir = self.adddir('collection')
self.addfile('collection', __file__, stem='non-directory') self.addfile('collection', __file__, stem='non-directory')
oc = OutputCollection(absdir) oc = OutputCollection(absdir)
self.assertEqual(0, len(oc)) self.assertEqual(0, len(oc))

View File

@ -1,3 +1,6 @@
# -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals from __future__ import unicode_literals

View File

@ -1,3 +1,6 @@
# -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals from __future__ import unicode_literals

View File

@ -1,3 +1,6 @@
# -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals from __future__ import unicode_literals
@ -61,6 +64,7 @@ class Test_arg_isstr(unittest.TestCase):
self.assertEqual('s', arg_isstr('s')) self.assertEqual('s', arg_isstr('s'))
self.assertEqual(None, arg_isstr(7)) self.assertEqual(None, arg_isstr(7))
class Test_arg_isloglevel(unittest.TestCase): class Test_arg_isloglevel(unittest.TestCase):
def test_arg_isloglevel_integer(self): def test_arg_isloglevel_integer(self):

View File

@ -1,9 +1,11 @@
# -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals from __future__ import unicode_literals
import os import os
import time
import codecs import codecs
import random import random
import shutil import shutil
@ -102,7 +104,7 @@ class CCTestTools(unittest.TestCase):
tf = ntf(prefix=case.tag, suffix='.cfg', dir=self.tempdir, delete=False) tf = ntf(prefix=case.tag, suffix='.cfg', dir=self.tempdir, delete=False)
tf.close() tf.close()
with codecs.open(tf.name, 'w', encoding='utf-8') as f: with codecs.open(tf.name, 'w', encoding='utf-8') as f:
f.write(case.cfg) f.write(case.cfg)
case.configfile = tf.name case.configfile = tf.name

View File

@ -1,4 +1,6 @@
# -*- coding: utf8 -*- # -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project
from __future__ import absolute_import from __future__ import absolute_import
@ -7,4 +9,4 @@ import tldp.outputs
import tldp.sources import tldp.sources
import tldp.inventory import tldp.inventory
VERSION="0.7.10" VERSION = "0.7.11"

View File

@ -1,5 +1,7 @@
#! /usr/bin/python #! /usr/bin/python
# -*- coding: utf8 -*- # -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals from __future__ import unicode_literals

View File

@ -1,5 +1,7 @@
#! /usr/bin/python #! /usr/bin/python
# -*- coding: utf8 -*- # -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals from __future__ import unicode_literals

View File

@ -1,7 +1,11 @@
# from .rst import RestructuredText # -*- coding: utf8 -*-
# from .markdown import Markdown #
from .asciidoc import Asciidoc # Copyright (c) 2016 Linux Documentation Project
from .linuxdoc import Linuxdoc
from .docbooksgml import DocbookSGML from __future__ import absolute_import
from .docbook4xml import Docbook4XML
from .docbook5xml import Docbook5XML from tldp.doctypes.asciidoc import Asciidoc
from tldp.doctypes.linuxdoc import Linuxdoc
from tldp.doctypes.docbooksgml import DocbookSGML
from tldp.doctypes.docbook4xml import Docbook4XML
from tldp.doctypes.docbook5xml import Docbook5XML

View File

@ -1,5 +1,7 @@
#! /usr/bin/python #! /usr/bin/python
# -*- coding: utf8 -*- # -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals from __future__ import unicode_literals

View File

@ -1,5 +1,7 @@
#! /usr/bin/python #! /usr/bin/python
# -*- coding: utf8 -*- # -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals from __future__ import unicode_literals

View File

@ -1,5 +1,7 @@
#! /usr/bin/python #! /usr/bin/python
# -*- coding: utf8 -*- # -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals from __future__ import unicode_literals

View File

@ -1,5 +1,7 @@
#! /usr/bin/python #! /usr/bin/python
# -*- coding: utf8 -*- # -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals from __future__ import unicode_literals

View File

@ -1,5 +1,7 @@
#! /usr/bin/python #! /usr/bin/python
# -*- coding: utf8 -*- # -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals from __future__ import unicode_literals

View File

@ -1,5 +1,7 @@
#! /usr/bin/python #! /usr/bin/python
# -*- coding: utf8 -*- # -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals from __future__ import unicode_literals

View File

@ -1,5 +1,7 @@
#! /usr/bin/python #! /usr/bin/python
# -*- coding: utf8 -*- # -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals from __future__ import unicode_literals

View File

@ -1,5 +1,7 @@
#! /usr/bin/python #! /usr/bin/python
# -*- coding: utf8 -*- # -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals from __future__ import unicode_literals

View File

@ -1,5 +1,7 @@
#! /usr/bin/python #! /usr/bin/python
# -*- coding: utf8 -*- # -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals from __future__ import unicode_literals

View File

@ -1,5 +1,7 @@
#! /usr/bin/python #! /usr/bin/python
# -*- coding: utf8 -*- # -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals from __future__ import unicode_literals
@ -31,7 +33,7 @@ signal.signal(signal.SIGPIPE, signal.SIG_DFL)
signal.signal(signal.SIGINT, signal.SIG_DFL) signal.signal(signal.SIGINT, signal.SIG_DFL)
logformat = '%(levelname)-9s %(name)s %(filename)s#%(lineno)s ' \ logformat = '%(levelname)-9s %(name)s %(filename)s#%(lineno)s ' \
+ '%(funcName)s %(message)s' + '%(funcName)s %(message)s'
logging.basicConfig(stream=sys.stderr, format=logformat, level=logging.ERROR) logging.basicConfig(stream=sys.stderr, format=logformat, level=logging.ERROR)
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -109,7 +111,7 @@ def summary(config, *args, **kwargs):
width.doctype = max([len(x.__name__) for x in knowndoctypes]) width.doctype = max([len(x.__name__) for x in knowndoctypes])
width.status = max([len(x) for x in status_types]) width.status = max([len(x) for x in status_types])
width.count = len(str(len(inv.source.keys()))) width.count = len(str(len(inv.source.keys())))
print('By Document Status (STATUS)', '---------------------------', print('By Document Status (STATUS)', '---------------------------',
sep='\n', file=file) sep='\n', file=file)
for status in status_types: for status in status_types:
count = len(getattr(inv, status, 0)) count = len(getattr(inv, status, 0))
@ -129,7 +131,7 @@ def summary(config, *args, **kwargs):
if abbrev: if abbrev:
s = s + ', and %d more ...' % (len(abbrev)) s = s + ', and %d more ...' % (len(abbrev))
print(s, file=file) print(s, file=file)
print('', 'By Document Type (DOCTYPE)', '--------------------------', print('', 'By Document Type (DOCTYPE)', '--------------------------',
sep='\n', file=file) sep='\n', file=file)
summarybytype = collections.defaultdict(list) summarybytype = collections.defaultdict(list)
for doc in inv.source.values(): for doc in inv.source.values():
@ -274,7 +276,7 @@ def docbuild(config, docs, **kwargs):
for x, source in enumerate(docs, 1): for x, source in enumerate(docs, 1):
working = source.working working = source.working
runner = source.doctype(source=source, output=working, config=config) runner = source.doctype(source=source, output=working, config=config)
status = 'progress, %d failures, %d successes' status = 'progress, %d failures, %d successes'
status = status % (result.count(False), result.count(True),) status = status % (result.count(False), result.count(True),)
logger.info("%s (%d of %d) initiating build [%s]", logger.info("%s (%d of %d) initiating build [%s]",
source.stem, x, len(docs), status) source.stem, x, len(docs), status)

View File

@ -1,5 +1,7 @@
#! /usr/bin/python #! /usr/bin/python
# -*- coding: utf8 -*- # -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals from __future__ import unicode_literals
@ -71,8 +73,7 @@ class Inventory(object):
len(self.orphan), len(self.orphan),
len(self.new), len(self.new),
len(self.stale), len(self.stale),
len(self.broken), len(self.broken),)
)
def __init__(self, pubdir, sourcedirs): def __init__(self, pubdir, sourcedirs):
'''construct an Inventory '''construct an Inventory

View File

@ -1,5 +1,7 @@
#! /usr/bin/python #! /usr/bin/python
# -*- coding: utf8 -*- # -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function

View File

@ -1,5 +1,7 @@
#! /usr/bin/python #! /usr/bin/python
# -*- coding: utf8 -*- # -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals from __future__ import unicode_literals
@ -11,7 +13,7 @@ import codecs
import logging import logging
from tldp.ldpcollection import LDPDocumentCollection from tldp.ldpcollection import LDPDocumentCollection
from tldp.utils import logdir, statfiles from tldp.utils import logdir
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@ -1,5 +1,7 @@
#! /usr/bin/python #! /usr/bin/python
# -*- coding: utf8 -*- # -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals from __future__ import unicode_literals

View File

@ -1,5 +1,7 @@
#! /usr/bin/python #! /usr/bin/python
# -*- coding: utf8 -*- # -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function

View File

@ -1,5 +1,7 @@
#! /usr/bin/python #! /usr/bin/python
# -*- coding: utf8 -*- # -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals from __future__ import unicode_literals
@ -9,7 +11,6 @@ import time
import errno import errno
import codecs import codecs
import hashlib import hashlib
import operator
import subprocess import subprocess
import functools import functools
from functools import wraps from functools import wraps
@ -285,6 +286,7 @@ def md5files(name, relative=None):
'''get all of the MD5s for files from here downtree''' '''get all of the MD5s for files from here downtree'''
return fileinfo(name, relative=relative, func=md5file) return fileinfo(name, relative=relative, func=md5file)
def statfiles(name, relative=None): def statfiles(name, relative=None):
''' '''
>>> statfiles('./docs/x509').keys() >>> statfiles('./docs/x509').keys()
@ -296,6 +298,7 @@ def statfiles(name, relative=None):
''' '''
return fileinfo(name, relative=relative, func=statfile) return fileinfo(name, relative=relative, func=statfile)
def fileinfo(name, relative=None, func=statfile): def fileinfo(name, relative=None, func=statfile):
'''return a dict() with keys being filenames and posix.stat_result values '''return a dict() with keys being filenames and posix.stat_result values