Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  script_site_activation.py   Sprache: Python

 
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

# This script is used by "test_site_activation.py" to verify how site activations
# affect the sys.path.
# The sys.path is printed in three stages:
# 1. Once at the beginning
# 2. Once after Mach site activation
# 3. Once after the command site activation
# The output of this script should be an ast-parsable list with three nested lists: one
# for each sys.path state.
# Note that virtualenv-creation output may need to be filtered out - it can be done by
# only ast-parsing the last line of text outputted by this script.

import os
import sys
from unittest.mock import patch

from mach.requirements import MachEnvRequirements, PthSpecifier
from mach.site import CommandSiteManager, MachSiteManager


def main():
    # Should be set by calling test
    topsrcdir = os.environ["TOPSRCDIR"]
    command_site = os.environ["COMMAND_SITE"]
    mach_site_requirements = os.environ["MACH_SITE_PTH_REQUIREMENTS"]
    command_site_requirements = os.environ["COMMAND_SITE_PTH_REQUIREMENTS"]
    work_dir = os.environ["WORK_DIR"]

    def resolve_requirements(topsrcdir, site_name):
        req = MachEnvRequirements()
        if site_name == "mach":
            req.pth_requirements = [
                PthSpecifier(path) for path in mach_site_requirements.split(os.pathsep)
            ]
        else:
            req.pth_requirements = [PthSpecifier(command_site_requirements)]
        return req

    with patch("mach.site.resolve_requirements", resolve_requirements):
        initial_sys_path = sys.path.copy()

        mach_site = MachSiteManager.from_environment(
            topsrcdir,
            lambda: work_dir,
        )
        mach_site.activate()
        mach_sys_path = sys.path.copy()

        command_site = CommandSiteManager.from_environment(
            topsrcdir, lambda: work_dir, command_site, work_dir
        )
        command_site.activate()
        command_sys_path = sys.path.copy()
    print(
        [
            initial_sys_path,
            mach_sys_path,
            command_sys_path,
        ]
    )


if __name__ == "__main__":
    main()

Messung V0.5
C=94 H=99 G=96

¤ Dauer der Verarbeitung: 0.3 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge