##// END OF EJS Templates
using pathlib on update_whatsnew.py
dswij -
Show More
@@ -7,23 +7,22 b' whatsnew/development.rst (chronologically ordered), and deletes the snippets.'
7
7
8 import io
8 import io
9 import sys
9 import sys
10 from glob import glob
10 from pathlib import Path
11 from os.path import dirname, basename, abspath, join as pjoin
12 from subprocess import check_call, check_output
11 from subprocess import check_call, check_output
13
12
14 repo_root = dirname(dirname(abspath(__file__)))
13 repo_root = Path(__file__).resolve().parent.parent
15 whatsnew_dir = pjoin(repo_root, 'docs', 'source', 'whatsnew')
14 whatsnew_dir = repo_root / 'docs' / 'source' / 'whatsnew'
16 pr_dir = pjoin(whatsnew_dir, 'pr')
15 pr_dir = whatsnew_dir / 'pr'
17 target = pjoin(whatsnew_dir, 'development.rst')
16 target = whatsnew_dir / 'development.rst'
18
17
19 FEATURE_MARK = ".. DO NOT EDIT THIS LINE BEFORE RELEASE. FEATURE INSERTION POINT."
18 FEATURE_MARK = ".. DO NOT EDIT THIS LINE BEFORE RELEASE. FEATURE INSERTION POINT."
20 INCOMPAT_MARK = ".. DO NOT EDIT THIS LINE BEFORE RELEASE. INCOMPAT INSERTION POINT."
19 INCOMPAT_MARK = ".. DO NOT EDIT THIS LINE BEFORE RELEASE. INCOMPAT INSERTION POINT."
21
20
22 # 1. Collect the whatsnew snippet files ---------------------------------------
21 # 1. Collect the whatsnew snippet files ---------------------------------------
23
22
24 files = set(glob(pjoin(pr_dir, '*.rst')))
23 files = set(pr_dir.glob('*.rst'))
25 # Ignore explanatory and example files
24 # Ignore explanatory and example files
26 files.difference_update({pjoin(pr_dir, f) for f in {
25 files.difference_update({pr_dir / f for f in {
27 'incompat-switching-to-perl.rst',
26 'incompat-switching-to-perl.rst',
28 'antigravity-feature.rst'}
27 'antigravity-feature.rst'}
29 })
28 })
@@ -46,7 +45,7 b' for path in files:'
46 except Exception as e:
45 except Exception as e:
47 raise Exception('Error reading "{}"'.format(f)) from e
46 raise Exception('Error reading "{}"'.format(f)) from e
48
47
49 if basename(path).startswith('incompat-'):
48 if path.name.startswith('incompat-'):
50 incompats.append(content)
49 incompats.append(content)
51 else:
50 else:
52 features.append(content)
51 features.append(content)
General Comments 0
You need to be logged in to leave comments. Login now