~ubuntu-branches/debian/sid/python-django/sid

« back to all changes in this revision

Viewing changes to docs/_ext/applyxrefs.py

  • Committer: Package Import Robot
  • Author(s): Raphaël Hertzog
  • Date: 2014-09-17 14:15:11 UTC
  • mfrom: (1.3.17) (6.2.18 experimental)
  • Revision ID: package-import@ubuntu.com-20140917141511-icneokthe9ww5sk4
Tags: 1.7-2
* Release to unstable.
* Add a migrate-south sample script to help users apply their South
  migrations. Thanks to Brian May.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
testing = False
7
7
 
8
8
DONT_TOUCH = (
9
 
        './index.txt',
10
 
        )
 
9
    './index.txt',
 
10
)
 
11
 
11
12
 
12
13
def target_name(fn):
13
14
    if fn.endswith('.txt'):
14
15
        fn = fn[:-4]
15
16
    return '_' + fn.lstrip('./').replace('/', '-')
16
17
 
 
18
 
17
19
def process_file(fn, lines):
18
20
    lines.insert(0, '\n')
19
21
    lines.insert(0, '.. %s:\n' % target_name(fn))
23
25
    except IOError:
24
26
        print("Can't open %s for writing. Not touching it." % fn)
25
27
 
 
28
 
26
29
def has_target(fn):
27
30
    try:
28
31
        with open(fn, 'r') as fp:
39
42
        return (True, None)
40
43
    return (False, lines)
41
44
 
 
45
 
42
46
def main(argv=None):
43
47
    if argv is None:
44
48
        argv = sys.argv