Commit 4fac45d09c2f387d830b6408e21e0404c8fbe747

Authored by Etienne Pallier
1 parent a6ce0e13
Exists in dev

petit bugfix de pyros.py + simplification et commentaires

Showing 2 changed files with 45 additions and 46 deletions   Show diff stats
docker/docker-compose.yml
1 version: "3.9" 1 version: "3.9"
2 2
  3 +# Application name (group name for the 4 images composing the PyROS app)
3 name: pyros-app 4 name: pyros-app
4 5
5 services: 6 services:
@@ -587,9 +587,7 @@ def _install_or_update(UPDATE: bool = False, with_packages: bool = True, with_da @@ -587,9 +587,7 @@ def _install_or_update(UPDATE: bool = False, with_packages: bool = True, with_da
587 # if WITH_DOCKER: only install the DB (with_database = True) 587 # if WITH_DOCKER: only install the DB (with_database = True)
588 if WITH_DOCKER: 588 if WITH_DOCKER:
589 with_packages = False 589 with_packages = False
590 -  
591 # if not with_packages and not with_database: with_packages = with_database = True 590 # if not with_packages and not with_database: with_packages = with_database = True
592 -  
593 print("- with_packages:", with_packages) 591 print("- with_packages:", with_packages)
594 print("- with_database:", with_database) 592 print("- with_database:", with_database)
595 593
@@ -600,13 +598,14 @@ def _install_or_update(UPDATE: bool = False, with_packages: bool = True, with_da @@ -600,13 +598,14 @@ def _install_or_update(UPDATE: bool = False, with_packages: bool = True, with_da
600 num = 0 598 num = 0
601 599
602 if UPDATE: 600 if UPDATE:
603 - # Update source code (git pull) 601 + # 1) Update source code (git pull)
604 num += 1 602 num += 1
605 printFullTerm(Colors.BLUE, f"{num}) UPDATING SOURCE CODE: Running git pull") 603 printFullTerm(Colors.BLUE, f"{num}) UPDATING SOURCE CODE: Running git pull")
606 if not WITH_DOCKER: 604 if not WITH_DOCKER:
607 _gitpull() or die() 605 _gitpull() or die()
608 606
609 if with_packages: 607 if with_packages:
  608 + # 2) Install venv and packages in it
610 # Update python packages (pip upgrade AND pip install requirements) 609 # Update python packages (pip upgrade AND pip install requirements)
611 num += 1 610 num += 1
612 printFullTerm(Colors.BLUE, f"{num}) {ACTION} PYTHON PACKAGES") 611 printFullTerm(Colors.BLUE, f"{num}) {ACTION} PYTHON PACKAGES")
@@ -617,7 +616,7 @@ def _install_or_update(UPDATE: bool = False, with_packages: bool = True, with_da @@ -617,7 +616,7 @@ def _install_or_update(UPDATE: bool = False, with_packages: bool = True, with_da
617 if UPDATE: 616 if UPDATE:
618 print("Running UPDATE command") 617 print("Running UPDATE command")
619 else: 618 else:
620 - # Install GitPython package for git support inside python 619 + # 3) Install GitPython package for git support inside python
621 print("Running INSTALL command") 620 print("Running INSTALL command")
622 try: 621 try:
623 from git import Repo 622 from git import Repo
@@ -644,59 +643,58 @@ def _install_or_update(UPDATE: bool = False, with_packages: bool = True, with_da @@ -644,59 +643,58 @@ def _install_or_update(UPDATE: bool = False, with_packages: bool = True, with_da
644 change_dir("PREVIOUS") 643 change_dir("PREVIOUS")
645 ''' 644 '''
646 645
647 - #  
648 - # Guitastro  
649 - #  
650 - GUITASTRO_PATH = os.path.join(os.getcwd(), "./vendor/guitastro")  
651 - if with_packages: # and not WITH_DOCKER:  
652 - #GUITASTRO_PATH = os.path.join(os.getcwd(), "../vendor/guitastro")  
653 - change_dir("..") 646 + # 4) Install GUITASTRO + its requirements
  647 + # (ONLY FOR NON DOCKER INSTALL)
654 print(os.getcwd()) 648 print(os.getcwd())
655 - # 1) clone repo if not yet done  
656 - if not WITH_DOCKER and not os.path.exists(GUITASTRO_PATH):  
657 - print("Guitastro : Cloning repository")  
658 - cloned_repo = Repo.clone_from(  
659 - "https://gitlab.irap.omp.eu/guitastrolib/guitastro.git", GUITASTRO_PATH)  
660 - print("Cloned successfully: ", cloned_repo.__class__ is Repo)  
661 - if UPDATE and os.path.exists(GUITASTRO_PATH) and and not WITH_DOCKER:  
662 - gitpull_guitastro()  
663 - change_dir("PREVIOUS")  
664 - # 2) install/update requirements & generate API doc  
665 - if not WITH_DOCKER and os.path.exists(GUITASTRO_PATH):  
666 - # TODO: update guitastro (git pull from vendor/guitastro/)  
667 - print("\nGuitastro : Installing/Updating python package dependencies\n")  
668 - # Upgrade pip if new version available  
669 - os.system(VENV_PYTHON + ' -m pip install --upgrade pip')  
670 - # TODO: faire les apt-get intall aussi (indi, ...)  
671 - venv_pip_install2(GUITASTRO_PATH + '/install/requirements.txt', '-r')  
672 - #venv_pip_install2(GUITASTRO_PATH + '/install/requirements_linux.txt', '-r')  
673 - venv_pip_install2(GUITASTRO_PATH + '/install/requirements_dev.txt', '-r')  
674 - '''  
675 - print("Guitastro : Generating (updating) API documentation (using Sphinx)")  
676 - # Make html doc from RST  
677 - # cd doc/sourcedoc/  
678 - change_dir(GUITASTRO_PATH + '/doc_rst/')  
679 - # ./MAKE_DOC.sh  
680 - res = execProcess('/bin/bash MAKE_DOC.sh')  
681 - # Come back to where we were before  
682 - # cd -  
683 - change_dir("PREVIOUS")  
684 - '''  
685 -  
686 -  
687 - # 3) Update PlantUML diagrams 649 + if not WITH_DOCKER:
  650 + GUITASTRO_PATH = os.path.join(os.getcwd(), "./vendor/guitastro")
  651 + if with_packages:
  652 + change_dir("..")
  653 + print(os.getcwd())
  654 + if not os.path.exists(GUITASTRO_PATH):
  655 + # a) clone repo if not yet done
  656 + print("Guitastro : Cloning repository")
  657 + cloned_repo = Repo.clone_from(
  658 + "https://gitlab.irap.omp.eu/guitastrolib/guitastro.git", GUITASTRO_PATH)
  659 + print("Cloned successfully: ", cloned_repo.__class__ is Repo)
  660 + if os.path.exists(GUITASTRO_PATH):
  661 + if UPDATE:
  662 + gitpull_guitastro()
  663 + change_dir("PREVIOUS")
  664 + # b) install/update requirements & generate API doc
  665 + # TODO: update guitastro (git pull from vendor/guitastro/)
  666 + print("\nGuitastro : Installing/Updating python package dependencies\n")
  667 + # Upgrade pip if new version available
  668 + os.system(VENV_PYTHON + ' -m pip install --upgrade pip')
  669 + # TODO: faire les apt-get intall aussi (indi, ...)
  670 + venv_pip_install2(GUITASTRO_PATH + '/install/requirements.txt', '-r')
  671 + #venv_pip_install2(GUITASTRO_PATH + '/install/requirements_linux.txt', '-r')
  672 + venv_pip_install2(GUITASTRO_PATH + '/install/requirements_dev.txt', '-r')
  673 + '''
  674 + print("Guitastro : Generating (updating) API documentation (using Sphinx)")
  675 + # Make html doc from RST
  676 + # cd doc/sourcedoc/
  677 + change_dir(GUITASTRO_PATH + '/doc_rst/')
  678 + # ./MAKE_DOC.sh
  679 + res = execProcess('/bin/bash MAKE_DOC.sh')
  680 + # Come back to where we were before
  681 + # cd -
  682 + change_dir("PREVIOUS")
  683 + '''
  684 +
  685 + # 5) Update PlantUML diagrams
688 num += 1 686 num += 1
689 printFullTerm(Colors.BLUE, f"{num}) UPDATING UML DIAGRAMS") 687 printFullTerm(Colors.BLUE, f"{num}) UPDATING UML DIAGRAMS")
690 _update_plantuml_diags() or die() 688 _update_plantuml_diags() or die()
691 print(os.getcwd()) 689 print(os.getcwd())
692 690
693 - # 4) Update Sphinx API doc 691 + # 6) Update Sphinx API doc (Non Windows only)
694 num += 1 692 num += 1
695 printFullTerm(Colors.BLUE, f"{num}) UPDATING API DOC (with Sphinx)") 693 printFullTerm(Colors.BLUE, f"{num}) UPDATING API DOC (with Sphinx)")
696 if not IS_WINDOWS: 694 if not IS_WINDOWS:
697 _update_api_doc() or die() 695 _update_api_doc() or die()
698 696
699 - # 5) Install/Update database structure (make migrations + migrate) 697 + # 7) Install/Update database structure (make migrations + migrate)
700 if with_database: 698 if with_database:
701 num += 1 699 num += 1
702 printFullTerm(Colors.BLUE, f"{num}) {ACTION} DATABASE") 700 printFullTerm(Colors.BLUE, f"{num}) {ACTION} DATABASE")