Commit 2b4e74ac47e30e4b39cef4d32b15226e880ff3e5

Authored by Etienne Pallier
1 parent 9c2e4eb3
Exists in dev

sphinx autodoc v5

Showing 2 changed files with 55 additions and 44 deletions   Show diff stats
Dockerfile
... ... @@ -7,7 +7,7 @@ RUN apt-get update && apt-get install -y \
7 7 nano \
8 8 vim \
9 9 # for PNG diagrams generation with pyreverse (pylint)
10   - graphviz
  10 + graphviz graphviz-dev
11 11  
12 12 # Get IRAP self signed certificate
13 13 RUN echo | openssl s_client -connect gitlab.irap.omp.eu:443 -servername gitlab.irap.omp.eu 2>/dev/null | openssl x509 > /etc/ssl/certs/gitlab.irap.omp.eu.crt
... ... @@ -37,3 +37,4 @@ RUN pip install --user click
37 37  
38 38 # installing packages required for PyROS
39 39 RUN pip install --user -r ./install/requirements.txt
  40 +RUN pip install --user -r ./install/requirements_dev.txt
... ...
pyros.py
... ... @@ -501,33 +501,69 @@ def dbshell():
501 501 return True
502 502  
503 503  
  504 +@pyros_launcher.command(help="Update (only if necessary) the python packages AND the source code AND the DB structure")
  505 +def update():
  506 + install_or_update(UPDATE=True)
  507 + '''
  508 + print("Running update command")
  509 + # 1) Update source code (git pull)
  510 + printFullTerm(Colors.BLUE, "1) UPDATING SOURCE CODE: Running git pull")
  511 + _gitpull() or die()
  512 +
  513 + # Re-install VENV if disappeared
  514 + install_venv(False)
  515 +
  516 + # 2) Update python packages (pip upgrade AND pip install requirements)
  517 + printFullTerm(Colors.BLUE, "2) UPDATING PYTHON PACKAGES")
  518 + ##_update_python_packages_from_requirements() or die()
  519 + install_packages()
  520 + print(os.getcwd())
  521 + # 3) Update PlantUML diagrams
  522 + printFullTerm(Colors.BLUE, "3) UPDATING PLANTUML DIAGRAMS")
  523 + _update_plantuml_diags() or die()
  524 + print(os.getcwd())
  525 +
  526 + # 4) Update database structure (make migrations + migrate)
  527 + printFullTerm(Colors.BLUE, "4) UPDATING DATABASE")
  528 + _updatedb() or die()
  529 + return True
  530 + '''
  531 +
  532 +
504 533 @pyros_launcher.command(help="Install the pyros software")
505 534 @click.option('--packages_only', '-p', is_flag=True, help='install only the python packages (no database installation)')
506 535 @click.option('--database_only', '-d', is_flag=True, help='install only the pyros database (no python packages installation)')
507 536 # @global_test_options
508 537 def install(packages_only, database_only):
509   - install_or_update(UPDATE=False, packages_only=packages_only,
510   - database_only=database_only)
  538 + with_packages = not database_only
  539 + with_database = not packages_only
  540 + install_or_update(UPDATE=False, with_packages=with_packages, with_database=with_database)
  541 + #install_or_update(UPDATE=False, with_packages=packages_only, with_database=database_only)
  542 + #install_or_update(UPDATE=False, packages_only=packages_only, database_only=database_only)
511 543  
512 544  
513   -def install_or_update(UPDATE: bool = False, packages_only: bool = False, database_only: bool = False):
  545 +#def install_or_update(UPDATE: bool = False, with_packages: bool = False, with_database: bool = False):
  546 +def install_or_update(UPDATE: bool = False, with_packages: bool = True, with_database: bool = True):
514 547 SQL_USER = os.environ.get("MYSQL_PYROS_LOGIN").strip()
515 548 SQL_PSWD = os.environ.get("MYSQL_PYROS_PWD").strip()
516 549 os.environ["PATH_TO_OBSCONF_FOLDER"] = os.path.join(os.path.abspath(
517 550 PYROS_DJANGO_BASE_DIR), "../../../privatedev/config/default/")
518 551 ACTION = "UPDATING" if UPDATE else "INSTALLING"
519 552  
520   - if WITH_DOCKER:
521   - database_only = True
522   - if not packages_only and not database_only:
523   - packages_only = database_only = True
  553 + #if WITH_DOCKER: with_database = True
  554 + #if not with_packages and not with_database: with_packages = with_database = True
524 555  
  556 + print("- with_packages:", with_packages)
  557 + print("- with_database:", with_database)
  558 + if UPDATE:
  559 + print("Running UPDATE command")
  560 + else:
  561 + print("Running INSTALL command")
  562 + exit()
525 563 if UPDATE:
526 564 print("Running UPDATE command")
527 565 else:
528 566 print("Running INSTALL command")
529   - print("- packages_only:", packages_only)
530   - print("- database_only:", database_only)
531 567 # Git clone Guitastro if not already cloned:
532 568 try:
533 569 from git import Repo
... ... @@ -557,8 +593,7 @@ def install_or_update(UPDATE: bool = False, packages_only: bool = False, databas
557 593 print("Installing/Updating Guitastro python package dependencies")
558 594 # Upgrade pip if new version available
559 595 os.system(VENV_PYTHON + ' -m pip install --user --upgrade pip')
560   - venv_pip_install2(
561   - GUITASTRO_PATH + '/install/requirements.txt', '-r')
  596 + venv_pip_install2(GUITASTRO_PATH + '/install/requirements.txt', '-r')
562 597  
563 598 #if test_mode(): print("in test mode")
564 599 # self.execProcess("python3 install/install.py install")
... ... @@ -574,7 +609,7 @@ def install_or_update(UPDATE: bool = False, packages_only: bool = False, databas
574 609 _gitpull() or die()
575 610  
576 611 # 2) Update python packages (pip upgrade AND pip install requirements)
577   - if packages_only:
  612 + if with_packages:
578 613 num += 1
579 614 printFullTerm(Colors.BLUE, f"{num}) {ACTION} PYTHON PACKAGES")
580 615 # (UPDATE) Re-install VENV if disappeared
... ... @@ -591,10 +626,9 @@ def install_or_update(UPDATE: bool = False, packages_only: bool = False, databas
591 626 num += 1
592 627 printFullTerm(Colors.BLUE, f"{num}) UPDATING API DOC (with Sphinx)")
593 628 _update_api_doc() or die()
594   - exit()
595 629  
596 630 # 5) Install/Update database structure (make migrations + migrate)
597   - if database_only:
  631 + if with_database:
598 632 num += 1
599 633 printFullTerm(Colors.BLUE, f"{num}) {ACTION} DATABASE")
600 634 if UPDATE:
... ... @@ -659,33 +693,6 @@ def testall():
659 693 return True
660 694  
661 695  
662   -@pyros_launcher.command(help="Update (only if necessary) the python packages AND the source code AND the DB structure")
663   -def update():
664   - install_or_update(UPDATE=True)
665   - '''
666   - print("Running update command")
667   - # 1) Update source code (git pull)
668   - printFullTerm(Colors.BLUE, "1) UPDATING SOURCE CODE: Running git pull")
669   - _gitpull() or die()
670   -
671   - # Re-install VENV if disappeared
672   - install_venv(False)
673   -
674   - # 2) Update python packages (pip upgrade AND pip install requirements)
675   - printFullTerm(Colors.BLUE, "2) UPDATING PYTHON PACKAGES")
676   - ##_update_python_packages_from_requirements() or die()
677   - install_packages()
678   - print(os.getcwd())
679   - # 3) Update PlantUML diagrams
680   - printFullTerm(Colors.BLUE, "3) UPDATING PLANTUML DIAGRAMS")
681   - _update_plantuml_diags() or die()
682   - print(os.getcwd())
683   -
684   - # 4) Update database structure (make migrations + migrate)
685   - printFullTerm(Colors.BLUE, "4) UPDATING DATABASE")
686   - _updatedb() or die()
687   - return True
688   - '''
689 696  
690 697  
691 698 def _gitpull():
... ... @@ -1241,8 +1248,11 @@ def install_packages():
1241 1248 #os.system(VENV_PIP+' install -r ../install' + os.sep + REQUIREMENTS)
1242 1249  
1243 1250 # DEV only packages
1244   - print(Colors.LOG_BLUE + "-----------------------------Installing DEV python packages via pip-----------------------------" + Colors.END)
1245   - venv_pip_install('../install/'+REQUIREMENTS_DEV, '-r')
  1251 + if DEV:
  1252 + print(Colors.LOG_BLUE + "-----------------------------Installing DEV python packages via pip-----------------------------" + Colors.END)
  1253 + venv_pip_install('../install/'+REQUIREMENTS_DEV, '-r')
  1254 + print("FIN INSTALL PACKAGES")
  1255 + exit()
1246 1256  
1247 1257 #print(Colors.LOG_BLUE + "-----------------------------cd ../install-----------------------------" + Colors.END)
1248 1258  
... ...