Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
from config import Configuration
import os
import subprocess
if __name__ == '__main__':
# Grab the Python source-code files to include in the submission document
files = [f for f in os.listdir('src') if os.path.isfile(os.path.join('src/', f))]
# Create the Markdown version of the submission document
with open(f'{Configuration.STUDENT_ID}_submission_document.md', 'w') as f:
yml = open('header.yml', 'r')
f.write(f'{yml.read()}')
f.write('\n')
yml.close()
f.write('# GitHub Repository Link\n')
f.write(f'{Configuration.GIT_REPO_LINK}\n')
for file in files:
f.write(f'\n\\newpage\n')
f.write(f'# {file}\n')
f.write(f'```python\n')
f.write(f'!include src/{file}\n')
f.write(f'```\n')
# Create the PDF for submission
mdDoc = os.path.join(f'{Configuration.STUDENT_ID}_submission_document.md')
pdfDoc = os.path.join(f'{Configuration.STUDENT_ID}_submission_document.pdf')
cmd = f'pandoc -s {mdDoc} --listings --filter pandoc-include -o out/{pdfDoc}'.split()
p = subprocess.Popen(cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE).communicate()
# Delete the Markdown File
os.remove(mdDoc)