Change shebang to Python3
[rnaseq-cwl-training.git] / bin / lesson_initialize.py
1 #!/usr/bin/env python3
2
3 """Initialize a newly-created repository."""
4
5
6 import sys
7 import os
8 import shutil
9
10 BOILERPLATE = (
11     '.travis.yml',
12     'AUTHORS',
13     'CITATION',
14     'CONTRIBUTING.md',
15     'README.md',
16     '_config.yml',
17     '_episodes/01-introduction.md',
18     '_extras/about.md',
19     '_extras/discuss.md',
20     '_extras/figures.md',
21     '_extras/guide.md',
22     'aio.md',
23     'index.md',
24     'reference.md',
25     'setup.md',
26 )
27
28
29 def main():
30     """Check for collisions, then create."""
31
32     # Check.
33     errors = False
34     for path in BOILERPLATE:
35         if os.path.exists(path):
36             print('Warning: {0} already exists.'.format(path), file=sys.stderr)
37             errors = True
38     if errors:
39         print('**Exiting without creating files.**', file=sys.stderr)
40         sys.exit(1)
41
42     # Create.
43     for path in BOILERPLATE:
44         shutil.copyfile(
45             "bin/boilerplate/{}".format(path),
46             path
47         )
48
49
50 if __name__ == '__main__':
51     main()