##// END OF EJS Templates
Take Thomas comments into account
Matthias Bussonnier -
Show More
@@ -1,2 +1,3 b''
1 1 IPython debugger (IPdb) now supports the number of context lines for the
2 2 ``where`` (and ``w``) commands. The `context` keyword is also available in various APIs.
3 See PR #9097
@@ -1,80 +1,78 b''
1 1 #!/usr/bin/env python
2 2 """Update the What's New doc (development version)
3 3
4 4 This collects the snippets from whatsnew/pr/, moves their content into
5 5 whatsnew/development.rst (chronologically ordered), and deletes the snippets.
6 6 """
7 7
8 8 import io
9 9 import os
10 10 from glob import glob
11 11 from os.path import dirname, basename, abspath, join as pjoin
12 12 from subprocess import check_call, check_output
13 13
14 14 repo_root = dirname(dirname(abspath(__file__)))
15 15 whatsnew_dir = pjoin(repo_root, 'docs', 'source', 'whatsnew')
16 16 pr_dir = pjoin(whatsnew_dir, 'pr')
17 17 target = pjoin(whatsnew_dir, 'development.rst')
18 18
19 19 FEATURE_MARK = ".. DO NOT EDIT THIS LINE BEFORE RELEASE. FEATURE INSERTION POINT."
20 20 INCOMPAT_MARK = ".. DO NOT EDIT THIS LINE BEFORE RELEASE. INCOMPAT INSERTION POINT."
21 21
22 22 # 1. Collect the whatsnew snippet files ---------------------------------------
23 23
24 files = set()
25 for f in glob(pjoin(pr_dir, '*.rst')):
26 files.add(f)
24 files = set(glob(pjoin(pr_dir, '*.rst')))
27 25 # Ignore explanatory and example files
28 files.difference_update({pjoin(pr_dir, f) for f in {'README.md',
26 files.difference_update({pjoin(pr_dir, f) for f in {
29 27 'incompat-switching-to-perl.rst',
30 28 'antigravity-feature.rst'}
31 29 })
32 30
33 31
34 32 def getmtime(f):
35 33 return check_output(['git', 'log', '-1', '--format="%ai"', '--', f])
36 34
37 35 files = sorted(files, key=getmtime)
38 36
39 37 features, incompats = [], []
40 38 for path in files:
41 39 with io.open(path, encoding='utf-8') as f:
42 40 try:
43 41 content = f.read().rstrip()
44 42 except Exception as e:
45 raise Exception('Error reading "{}"'.format(f))
43 raise Exception('Error reading "{}"'.format(f)) from e
46 44
47 45 if basename(path).startswith('incompat-'):
48 46 incompats.append(content)
49 47 else:
50 48 features.append(content)
51 49
52 50 # Put the insertion markers back on the end, so they're ready for next time.
53 51 feature_block = '\n\n'.join(features + [FEATURE_MARK])
54 52 incompat_block = '\n\n'.join(incompats + [INCOMPAT_MARK])
55 53
56 54 # 2. Update the target file ---------------------------------------------------
57 55
58 56 with io.open(target, encoding='utf-8') as f:
59 57 content = f.read()
60 58
61 59 assert content.count(FEATURE_MARK) == 1
62 60 assert content.count(INCOMPAT_MARK) == 1
63 61
64 62 content = content.replace(FEATURE_MARK, feature_block)
65 63 content = content.replace(INCOMPAT_MARK, incompat_block)
66 64
67 65 # Clean trailing whitespace
68 66 content = '\n'.join(l.rstrip() for l in content.splitlines())
69 67
70 68 with io.open(target, 'w', encoding='utf-8') as f:
71 69 f.write(content)
72 70
73 71 # 3. Stage the changes in git -------------------------------------------------
74 72
75 73 for file in files:
76 74 check_call(['git', 'rm', file])
77 75
78 76 check_call(['git', 'add', target])
79 77
80 78 print("Merged what's new changes. Check the diff and commit the change.")
General Comments 0
You need to be logged in to leave comments. Login now