Python-ELMO is a Python library which offers an encapsulation of the binary tool ELMO, in order to manipulate it easily in Python and SageMath script.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

create-project.py 1.5KB

  1. import os, shutil
  2. import re
  3. from .manage import create_simulation
  4. print('Creation of a new simulation project...')
  5. ### Create the repository of the projects
  6. global_path = 'projects'
  7. os.makedirs(global_path, exist_ok=True)
  8. ### Get the project classname
  9. project_classname = ''
  10. search = re.compile(r'[^a-zA-Z0-9_]').search
  11. while not project_classname:
  12. classname = input(' - What is the project classname? ')
  13. if search(classname):
  14. print(' > Illegal characters detected! Please enter a name with only the following characters : a-z, A-Z, 0-9, and "_".')
  15. else:
  16. project_classname = classname.strip()
  17. ### Get and create the project repository
  18. search = re.compile(r'[^a-zA-Z0-9.-_/]').search
  19. project_repository = ''
  20. while not project_repository:
  21. repository = input(' - What is the project repository? ')
  22. if search(repository):
  23. print('Illegal characters detected! Please enter a name with only the following characters : a-z, A-Z, 0-9, ".", "-", "_" and "/".')
  24. else:
  25. project_repository = repository
  26. project_path = global_path+'/'+repository
  27. project_path = create_simulation(project_path, classname)
  28. print('')
  29. print('Creation complete !')
  30. print(' - Project repository: {}'.format(project_path))
  31. print(' - Project class "{}" in {}'.format(project_classname, project_path+'/projectclass.py'))
  32. print(' - Linker script: {}'.format(project_path+'/project.ld')))
  33. print('')
  34. print('Please don\'t to compile the project with the present Makefile before using it!')