Zooko O'Whielacronx added the comment: > Here is an updated version of the patch which simply removes some > dead code and updates a URL: > > regards, > > Zooko > > diff -rN -u old-up/setuptools-0.6c7/ez_setup.py new-up/ > setuptools-0.6c7/ez_setup.py > --- old-up/setuptools-0.6c7/ez_setup.py 2007-09-28 > 16:41:24.000000000 -0600 > +++ new-up/setuptools-0.6c7/ez_setup.py 2007-09-28 > 16:41:25.000000000 -0600
Oops, the in-lined patch contents were a different patch entirely, but the attached patch file was correct. Just for completeness, here is the correct in-lined patch contents: Index: Lib/trace.py =================================================================== --- Lib/trace.py (revision 58282) +++ Lib/trace.py (working copy) @@ -85,7 +85,12 @@ -r, --report Generate a report from a counts file; do not execute any code. `--file' must specify the results file to read, which must have been created in a previous run - with `--count --file=FILE'. + with `--count --file=FILE'. If --coverdir is not + specified, the .cover files will be written into the + directory that the modules were in when the report was + generated. Whether or not --coverdir is specified, + --report will always create the cover file directory if + necessary. Modifiers: -f, --file=<file> File to accumulate counts over several runs. @@ -197,6 +202,33 @@ filename, ext = os.path.splitext(base) return filename +# The following function is copied from the fileutil module from the pyutil +# project: +# http://pypi.python.org/pypi/pyutil +# We use this function instead of os.makedirs() so that we don't get a +# spurious exception when someone else creates the directory at the same +# moment we do. (For example, another thread or process that is also running +# trace.) +def make_dirs(dirname, mode=0777): + """ + A threadsafe and idempotent version of os.makedirs(). If the dir already + exists, do nothing and return without raising an exception. If this call + creates the dir, return without raising an exception. If there is an + error that prevents creation or if the directory gets deleted after + make_dirs() creates it and before make_dirs() checks that it exists, raise + an exception. + """ + tx = None + try: + os.makedirs(dirname, mode) + except OSError, x: + tx = x + + if not os.path.isdir(dirname): + if tx: + raise tx + raise exceptions.IOError, "unknown error prevented creation of directory, or deleted the directory immediately after creation: % s" % dirname # careful not to construct an IOError with a 2-tuple, as that has a special meaning... + class CoverageResults: def __init__(self, counts=None, calledfuncs=None, infile=None, callers=None, outfile=None): @@ -290,15 +322,15 @@ if filename.endswith((".pyc", ".pyo")): filename = filename[:-1] - if coverdir is None: + if coverdir is not None: + dir = coverdir + modulename = fullmodname(filename) + else: dir = os.path.dirname(os.path.abspath(filename)) modulename = modname(filename) - else: - dir = coverdir - if not os.path.exists(dir): - os.makedirs(dir) - modulename = fullmodname(filename) + make_dirs(dir) + # If desired, get a list of the line numbers which represent # executable content (returned as a dict for better lookup speed) if show_missing: ____________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue766910> ____________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com