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


Quelle  buildlist.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/.

"""A generic script to add entries to a file
if the entry does not already exist.

Usage: buildlist.py <filename> <entry> [<entry> ...]
"""

import os.path
import sys

from filelock import SoftFileLock

from mozbuild.dirutils import ensureParentDir


def addEntriesToListFile(listFile, entries):
    """Given a file ``listFile`` containing one entry per line,
    add each entry in ``entries`` to the file, unless it is already
    present."""
    ensureParentDir(listFile)
    with SoftFileLock(listFile + ".lck", timeout=-1):
        if os.path.exists(listFile):
            with open(listFile) as f:
                existing = {x.strip() for x in f.readlines()}
        else:
            existing = set()
        existing.update(entries)
        with open(listFile, "w", newline="\n"as f:
            f.write("\n".join(sorted(existing)) + "\n")


def main(args):
    if len(args) < 2:
        print("Usage: buildlist.py [ ...]", file=sys.stderr)
        return 1

    return addEntriesToListFile(args[0], args[1:])


if __name__ == "__main__":
    sys.exit(main(sys.argv[1:]))

Messung V0.5
C=94 H=92 G=92

¤ Dauer der Verarbeitung: 0.0 Sekunden  (vorverarbeitet)  ¤

*© 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