generated from carpentries/workshop-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lesson_initialize.py
49 lines (39 loc) · 1.01 KB
/
lesson_initialize.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
"""Initialize a newly-created repository."""
import sys
import os
import shutil
BOILERPLATE = (
'.travis.yml',
'AUTHORS',
'CITATION',
'CONTRIBUTING.md',
'README.md',
'_config.yml',
os.path.join('_episodes', '01-introduction.md'),
os.path.join('_extras', 'about.md'),
os.path.join('_extras', 'discuss.md'),
os.path.join('_extras', 'figures.md'),
os.path.join('_extras', 'guide.md'),
'index.md',
'reference.md',
'setup.md',
)
def main():
"""Check for collisions, then create."""
# Check.
errors = False
for path in BOILERPLATE:
if os.path.exists(path):
print('Warning: {0} already exists.'.format(path), file=sys.stderr)
errors = True
if errors:
print('**Exiting without creating files.**', file=sys.stderr)
sys.exit(1)
# Create.
for path in BOILERPLATE:
shutil.copyfile(
os.path.join('bin', 'boilerplate', path),
path
)
if __name__ == '__main__':
main()