dagger Module API

class dagger.dagger(hashfile='', sqlite=False, sqlite_memory=1)

Evaluates file dependencies in pure python.

add(target, sources=[])

Make target depend on optional sources.

dot(out=None, format=None, color=True)

Return dot graph as string and optionally write to file ‘out’. Stale nodes will be colored red.

You can set the file name ‘format’ for node labels.

dump()

Text dump of nodes.

exporthash()

Write hashdb for all nodes.

get(name)

Get node by name.

hash(name, enable=1)

Enable hashing for file node.

iter(names=[])

Return iterator for all stale nodes listed by name (and their dependents). If [] is given, then all stale nodes (and their dependents) will be returned.

ordernames()

Return names of files discovered during graph evaluation.

pathnames(name)

Return list of lists where paths use names instead of object references.

phony(name)

Set node with name to be phony, so even when file with name is missing, it won’t be considered stale, unless it has a stale child.

resetnodes()

Reset all nodes.

run(allpaths=True)

Find stale nodes based on modtime or hash.

allpaths: If true, also find all paths from roots to leaf nodes.

stale(name, force=1)

Force node with name to be stale (force=1) or uptodate (force=0).

tree()

Return simple tree string of all nodes.

class dagger.hashdb(fn='')

Loads, queries, computes and exports “file,hash” per line.

export()

Write out db to text file with file names and hashes.

get(fn)

Get hash for given filename in db.

load(silent=False)

Loads db text file.

static md5(fn)

Return md5 checksum for file named ‘fn’ or None if error.

set(fn, hash)

Put hash for file into table.

update(fn)

Compute hash for file and update db entry.

class dagger.hashdb_sqlite(fn='', memory=False)

Uses a sqlite database. Can be used inmemory after loading file.

export()

Write out db to file with file names and hashes.

get(fn)

Get hash for given filename in db.

load(silent=False)

Loads sqlite db file if it exists and optionally into memory. If none exists, a new db is created.

set(fn, hash)

Put hash for file into table.

class dagger.idict

Stores append index and O(1) lookup of index using key.

append(item)

Add unique item, store its index and return index.

index(item)

Return index for item. None if not in container.

class dagger.iterator(dag, items)

Iterate over dagger results and get groups of items mutually exclusive in dependency graph. Use for guiding serial or parallel processing.

next(n=1)

Get next n independent item names. n=1 by default.

remove(item)

Remove item from candidate list.

class dagger.ldict(lst=[])

Hybrid linked-list/dict container for O(1) removal of append-sorted data keys. Benchmark shows that it is much faster than plain list for large arrays (see bench/bench_ldict.py).

get(data)

Returns ldict_node for data item.

class dagger.ldict_node(data)

Node for ldict that wraps data and holds double-links.

class dagger.node(name)

File node for dependecy graph.

add(*nodes)

Add one or more nodes as children.

build_paths_set()

Make set of nodes that are in paths lists to allow quick lookups.

dump()

Return string with basic node info.

format(pat=None)

@return formatted string. @param pat: Supported format specifiers: %a: absolute name %d: date %b: base name %r: root name (no directory prefix or extension suffix) %m: modified time None: as-is name

reset()

Reset staleness, hash and time.

update(time=True, hash=False)

Get modified time for file from system and optionally compute hash.

dagger.time2strings(t)

Convert time (from os.path.getmtime) to date and time strings.

This Page