Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-06-01 07:07:52

0001 """Initialize a newly-created repository."""
0002 
0003 
0004 import sys
0005 import os
0006 import shutil
0007 
0008 BOILERPLATE = (
0009     'AUTHORS',
0010     'CITATION',
0011     'CONTRIBUTING.md',
0012     'README.md',
0013     '_config.yml',
0014     os.path.join('_episodes', '01-introduction.md'),
0015     os.path.join('_extras', 'about.md'),
0016     os.path.join('_extras', 'discuss.md'),
0017     os.path.join('_extras', 'figures.md'),
0018     os.path.join('_extras', 'guide.md'),
0019     'index.md',
0020     'reference.md',
0021     'setup.md',
0022 )
0023 
0024 
0025 def main():
0026     """Check for collisions, then create."""
0027 
0028     # Check.
0029     errors = False
0030     for path in BOILERPLATE:
0031         if os.path.exists(path):
0032             print('Warning: {0} already exists.'.format(path), file=sys.stderr)
0033             errors = True
0034     if errors:
0035         print('**Exiting without creating files.**', file=sys.stderr)
0036         sys.exit(1)
0037 
0038     # Create.
0039     for path in BOILERPLATE:
0040         shutil.copyfile(
0041             os.path.join('bin', 'boilerplate', path),
0042             path
0043         )
0044 
0045 
0046 if __name__ == '__main__':
0047     main()