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
obtaining a copy of this software and associated documentation files
(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
-------------------------
This package was built and used against Python-2.7.8 (OpenSUS) and
Python-2.7.6 (Ubuntu). It has been tested (success for test suite) against
Python-3.4.1 and lightly used against Python-3.4.1.
This package was developed against Python-2.7.8 and Python-3.4.1 (on
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).
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
@ -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
tidbits.
Build an RPM:::
Build an RPM::
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
setuptools stock-generated specfile. Specifically, the package gets named
`python-tldp` instead of `tldp` and the configuration file is marked
`%config(noreplace)`.
There's a generated file, `contrib/tldp.spec`, which makes a few changes to the
setuptools stock-generated specfile. It adds the dependencies, marks the
configuration file as %config(noreplace), adds a manpage and names the binary
package `python-tldp`.
I know less about packaging for Debian. Relying on python-stdeb yields a
working and usable Debian package which has been tested out on an Ubuntu
14.04.3 system.
Build a DEB::
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
I have not tried installing the package in a virtualenv or with pip. If you
try that, please let me know any problems you encounter.
But, there is also a `debian` directory. If you are working straight from the
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

View File

@ -1,8 +1,8 @@
%define sourcename tldp
%define name python-tldp
%define version 0.7.10
%define unmangled_version 0.7.10
%define unmangled_version 0.7.10
%define version 0.7.11
%define unmangled_version 0.7.11
%define unmangled_version 0.7.11
%define release 1
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)

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
Depends: ${misc:Depends},
${python3:Depends},
python3,
python3-networkx
fop,
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
The Linux Documentation Project (TLDP) stores hundreds of documents in
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
License: MIT
# Files: extras/dsssl/* extras/css/*
# Copyright: 2000-2003 - Greg Ferguson (gferg@metalab.unc.edu)
# License: GPL-2.0+
#
Files: extras/dsssl/* extras/xsl/* extras/css/*
Files: extras/dsssl/ldp.dsl
Copyright: 2000-2003 - Greg Ferguson (gferg@metalab.unc.edu)
License: GPL-2.0+
Files: extras/xsl/tldp-*.xsl extras/css/style.css
Copyright: 2000-2002 - David Horton (dhorton@speakeasy.net)
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/*
# Copyright: Copyright (C) 2011-2012 O'Reilly Media
# License: MIT
#
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
License: MIT
Files: extras/collateindex.pl
Copyright: 1997-2001 Norman Walsh
License: MIT
@ -42,23 +42,30 @@ License: MIT
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# License: GPL-2.0+
# 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# .
# This package is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# .
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
# .
# On Debian systems, the complete text of the GNU General
# Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
#
License: GPL-2.0+
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
.
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-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
/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:
(cd docs && \
sphinx-build \
-b man -D today="$(BUILD_DATE)" \
-d _build/doctrees . _build/man)
sphinx-build -b man -d _build/doctrees . _build/man)
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 unicode_literals
@ -23,57 +26,39 @@ def load_content(ex):
ex_linuxdoc = Namespace(
doctype=tldp.doctypes.linuxdoc.Linuxdoc,
filename=opj(sampledocs, 'linuxdoc-simple.sgml'),
)
doctype=tldp.doctypes.linuxdoc.Linuxdoc,
filename=opj(sampledocs, 'linuxdoc-simple.sgml'),)
ex_docbooksgml = Namespace(
doctype=tldp.doctypes.docbooksgml.DocbookSGML,
filename=opj(sampledocs, 'docbooksgml-simple.sgml'),
)
doctype=tldp.doctypes.docbooksgml.DocbookSGML,
filename=opj(sampledocs, 'docbooksgml-simple.sgml'),)
ex_docbook4xml = Namespace(
doctype=tldp.doctypes.docbook4xml.Docbook4XML,
filename=opj(sampledocs, 'docbook4xml-simple.xml'),
)
doctype=tldp.doctypes.docbook4xml.Docbook4XML,
filename=opj(sampledocs, 'docbook4xml-simple.xml'),)
ex_docbook5xml = Namespace(
doctype=tldp.doctypes.docbook5xml.Docbook5XML,
filename=opj(sampledocs, 'docbook5xml-simple.xml'),
)
doctype=tldp.doctypes.docbook5xml.Docbook5XML,
filename=opj(sampledocs, 'docbook5xml-simple.xml'),)
ex_asciidoc = Namespace(
doctype=tldp.doctypes.asciidoc.Asciidoc,
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'),
# )
doctype=tldp.doctypes.asciidoc.Asciidoc,
filename=opj(sampledocs, 'asciidoc-complete.txt'),)
ex_linuxdoc_dir = Namespace(
doctype=tldp.doctypes.linuxdoc.Linuxdoc,
filename=opj(sampledocs, 'Linuxdoc-Larger',
'Linuxdoc-Larger.sgml'),
)
doctype=tldp.doctypes.linuxdoc.Linuxdoc,
filename=opj(sampledocs, 'Linuxdoc-Larger',
'Linuxdoc-Larger.sgml'),)
ex_docbook4xml_dir = Namespace(
doctype=tldp.doctypes.docbook4xml.Docbook4XML,
filename=opj(sampledocs, 'DocBook-4.2-WHYNOT',
'DocBook-4.2-WHYNOT.xml'),
)
doctype=tldp.doctypes.docbook4xml.Docbook4XML,
filename=opj(sampledocs, 'DocBook-4.2-WHYNOT',
'DocBook-4.2-WHYNOT.xml'),)
ex_docbooksgml_dir = Namespace(
doctype=tldp.doctypes.docbooksgml.DocbookSGML,
filename=opj(sampledocs, 'DocBookSGML-Larger',
'DocBookSGML-Larger.sgml'),
)
doctype=tldp.doctypes.docbooksgml.DocbookSGML,
filename=opj(sampledocs, 'DocBookSGML-Larger',
'DocBookSGML-Larger.sgml'),)
# -- a bit ugly, but grab each dict
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:
load_content(ex)
unknown_doctype = Namespace(
doctype=None,
filename=opj(sampledocs, 'Unknown-Doctype.xqf'),
)
doctype=None,
filename=opj(sampledocs, 'Unknown-Doctype.xqf'),)
broken_docbook4xml = Namespace(
doctype=tldp.doctypes.docbook4xml.Docbook4XML,
filename=opj(sampledocs, 'docbook4xml-broken.xml'),
)
doctype=tldp.doctypes.docbook4xml.Docbook4XML,
filename=opj(sampledocs, 'docbook4xml-broken.xml'),)
load_content(broken_docbook4xml)
# -- 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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<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>
</article>

View File

@ -1,7 +1,7 @@
<!doctype linuxdoc system>
<article>
<title>B
<author>A
<title>Linuxdoc Larger Document
<author>Another Author
<date>2016-02-11
<abstract> abstract </abstract>
<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 unicode_literals
@ -80,14 +83,13 @@ class CascadingConfigBasicTest(CCTestTools):
ap.add_argument('--size', default=9, type=int)
c = Namespace(
tag='tag',
argparser=ap,
argv=''.split(),
env=dict(),
cfg='',
exp_config=Namespace(size=9),
exp_args=[],
)
tag='tag',
argparser=ap,
argv=''.split(),
env=dict(),
cfg='',
exp_config=Namespace(size=9),
exp_args=[],)
cc = CascadingConfig(c.tag, c.argparser, argv=c.argv, env=c.env)
config, args = cc.parse()
@ -99,14 +101,13 @@ class CascadingConfigBasicTest(CCTestTools):
ap.add_argument('--size', default=9, type=int)
c = Namespace(
tag='tag',
argparser=ap,
argv=''.split(),
env=dict(),
cfg='[tag]\nsize = 8',
exp_config=Namespace(size=8),
exp_args=[],
)
tag='tag',
argparser=ap,
argv=''.split(),
env=dict(),
cfg='[tag]\nsize = 8',
exp_config=Namespace(size=8),
exp_args=[],)
self.writeconfig(c)
c.env.setdefault('TAG_CONFIGFILE', c.configfile)
@ -122,14 +123,13 @@ class CascadingConfigBasicTest(CCTestTools):
import logging
logging.getLogger().setLevel(logging.DEBUG)
c = Namespace(
tag='tag',
argparser=ap,
argv=''.split(),
env=dict(),
cfg='[tag]\nsize = 8',
exp_config=Namespace(size=8),
exp_args=[],
)
tag='tag',
argparser=ap,
argv=''.split(),
env=dict(),
cfg='[tag]\nsize = 8',
exp_config=Namespace(size=8),
exp_args=[],)
self.writeconfig(c)
c.argv.extend(['--configfile', c.configfile])
cc = CascadingConfig(c.tag, c.argparser, argv=c.argv, env=c.env)
@ -144,14 +144,13 @@ class CascadingConfigBasicTest(CCTestTools):
import logging
logging.getLogger().setLevel(logging.DEBUG)
c = Namespace(
tag='tag',
argparser=ap,
argv=''.split(),
env=dict(TAG_SIZE=7, ),
cfg='[tag]\nsize = 8',
exp_config=Namespace(size=7),
exp_args=[],
)
tag='tag',
argparser=ap,
argv=''.split(),
env=dict(TAG_SIZE=7, ),
cfg='[tag]\nsize = 8',
exp_config=Namespace(size=7),
exp_args=[],)
self.writeconfig(c)
c.argv.extend(['--configfile', c.configfile])
cc = CascadingConfig(c.tag, c.argparser, argv=c.argv, env=c.env)
@ -166,14 +165,13 @@ class CascadingConfigBasicTest(CCTestTools):
import logging
logging.getLogger().setLevel(logging.DEBUG)
c = Namespace(
tag='tag',
argparser=ap,
argv='--size 6'.split(),
env=dict(TAG_SIZE=7, ),
cfg='[tag]\nsize = 8',
exp_config=Namespace(size=6),
exp_args=[],
)
tag='tag',
argparser=ap,
argv='--size 6'.split(),
env=dict(TAG_SIZE=7, ),
cfg='[tag]\nsize = 8',
exp_config=Namespace(size=6),
exp_args=[],)
self.writeconfig(c)
c.argv.extend(['--configfile', c.configfile])
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)
c = Namespace(
tag='tag',
argparser=ap,
argv=''.split(),
env=dict(),
cfg='',
exp_config=Namespace(source=''),
exp_args=[],
)
tag='tag',
argparser=ap,
argv=''.split(),
env=dict(),
cfg='',
exp_config=Namespace(source=''),
exp_args=[],)
cc = CascadingConfig(c.tag, c.argparser, argv=c.argv, env=c.env)
config, args = cc.parse()
self.assertEqual(c.exp_config, config)
@ -203,14 +200,13 @@ class CascadingConfigBasicTest(CCTestTools):
ap.add_argument('--source', default='', action='append', type=str)
c = Namespace(
tag='tag',
argparser=ap,
argv='--source /some/path'.split(),
env=dict(),
cfg='',
exp_config=Namespace(source=['/some/path']),
exp_args=[],
)
tag='tag',
argparser=ap,
argv='--source /some/path'.split(),
env=dict(),
cfg='',
exp_config=Namespace(source=['/some/path']),
exp_args=[],)
cc = CascadingConfig(c.tag, c.argparser, argv=c.argv, env=c.env)
config, args = cc.parse()
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 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 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 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 unicode_literals
@ -38,7 +41,7 @@ class TestOutputCollection(TestToolsFilesystem):
def test_file_in_output_collection(self):
reldir, absdir = self.adddir('collection')
self.addfile('collection', __file__, stem='non-directory')
self.addfile('collection', __file__, stem='non-directory')
oc = OutputCollection(absdir)
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 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 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 unicode_literals
@ -61,6 +64,7 @@ class Test_arg_isstr(unittest.TestCase):
self.assertEqual('s', arg_isstr('s'))
self.assertEqual(None, arg_isstr(7))
class Test_arg_isloglevel(unittest.TestCase):
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 unicode_literals
import os
import time
import codecs
import random
import shutil
@ -102,7 +104,7 @@ class CCTestTools(unittest.TestCase):
tf = ntf(prefix=case.tag, suffix='.cfg', dir=self.tempdir, delete=False)
tf.close()
with codecs.open(tf.name, 'w', encoding='utf-8') as f:
f.write(case.cfg)
f.write(case.cfg)
case.configfile = tf.name

View File

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

View File

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

View File

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

View File

@ -1,7 +1,11 @@
# from .rst import RestructuredText
# from .markdown import Markdown
from .asciidoc import Asciidoc
from .linuxdoc import Linuxdoc
from .docbooksgml import DocbookSGML
from .docbook4xml import Docbook4XML
from .docbook5xml import Docbook5XML
# -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project
from __future__ import absolute_import
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
# -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project
from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,7 @@
#! /usr/bin/python
# -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project
from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals
@ -31,7 +33,7 @@ signal.signal(signal.SIGPIPE, signal.SIG_DFL)
signal.signal(signal.SIGINT, signal.SIG_DFL)
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)
logger = logging.getLogger(__name__)
@ -109,7 +111,7 @@ def summary(config, *args, **kwargs):
width.doctype = max([len(x.__name__) for x in knowndoctypes])
width.status = max([len(x) for x in status_types])
width.count = len(str(len(inv.source.keys())))
print('By Document Status (STATUS)', '---------------------------',
print('By Document Status (STATUS)', '---------------------------',
sep='\n', file=file)
for status in status_types:
count = len(getattr(inv, status, 0))
@ -129,7 +131,7 @@ def summary(config, *args, **kwargs):
if abbrev:
s = s + ', and %d more ...' % (len(abbrev))
print(s, file=file)
print('', 'By Document Type (DOCTYPE)', '--------------------------',
print('', 'By Document Type (DOCTYPE)', '--------------------------',
sep='\n', file=file)
summarybytype = collections.defaultdict(list)
for doc in inv.source.values():
@ -274,7 +276,7 @@ def docbuild(config, docs, **kwargs):
for x, source in enumerate(docs, 1):
working = source.working
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),)
logger.info("%s (%d of %d) initiating build [%s]",
source.stem, x, len(docs), status)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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