/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to tools/prepare_for_latex.py

  • Committer: Jelmer Vernooij
  • Date: 2018-05-06 11:48:54 UTC
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@jelmer.uk-20180506114854-h4qd9ojaqy8wxjsd
Move .mailmap to root.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/python3
 
1
#!/usr/bin/python
2
2
#
3
3
# Modify reStructuredText 'image' directives by adding a percentage 'width'
4
4
# attribute so that the images are scaled to fit on the page when the document
26
26
# along with this program; if not, write to the Free Software
27
27
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
28
28
 
29
 
from __future__ import print_function
30
 
 
31
29
import os
32
30
import re
33
31
import shutil
37
35
 
38
36
verbose = False
39
37
 
40
 
IMAGE_DIRECTIVE_PATTERN = re.compile(u'^..\\s+image::\\s+(.*)\\`\\s+$')
41
 
DIRECTIVE_ELEMENT_PATTERN = re.compile(u'^\\s+:[^:]+:\\s+')
 
38
IMAGE_DIRECTIVE_PATTERN = re.compile(ur'^..\s+image::\s+(.*)\s+$')
 
39
DIRECTIVE_ELEMENT_PATTERN = re.compile(ur'^\s+:[^:]+:\s+')
42
40
 
43
41
class Converter(object):
44
42
    def __init__(self, srcdir, destdir):
96
94
    def replace_extension(self, path, newext):
97
95
        if path.endswith(newext):
98
96
            raise Exception("File '" + path + "' already has extension '"
99
 
                            + newext + "'")
 
97
                            + newext +"'")
100
98
        dot = path.rfind('.')
101
99
        if dot == -1:
102
100
            return path + newext