trac.util.compat

Various classes and functions to provide some backwards-compatibility with previous versions of Python from 2.6 onward.

class trac.util.compat.Popen(args, bufsize=0, executable=None, stdin=None, stdout=None, stderr=None, preexec_fn=None, close_fds=False, shell=False, cwd=None, env=None, universal_newlines=False, startupinfo=None, creationflags=0)

Bases: subprocess.Popen

Popen objects are supported as context managers starting in Python 3.2. This code was taken from Python 3.5 and can be removed when support for Python < 3.2 is dropped.

Create new Popen instance.

trac.util.compat.wait_for_file_mtime_change(filename)

This function is typically called before a file save operation, waiting if necessary for the file modification time to change. The purpose is to avoid successive file updates going undetected by the caching mechanism that depends on a change in the file modification time to know when the file should be reparsed.