Author jimb
Recipients eli.bendersky, jimb, ocean-city
Date 2009-03-04.22:01:20
SpamBayes Score 2.39219e-07
Marked as misclassified No
Message-id <1236204083.42.0.408273257211.issue5117@psf.upfronthosting.co.za>
In-reply-to
Content
In case the behavior requested here is controversial, here's an example
of where it would be nice to have relpath(x, '/') return a path for x
that is relative to the root directory:

The 'oprofile' system profiler for Linux profiles everything running on
the system at once.  Its profile count database takes the form of a
directory tree of counter files that mirrors the whole filesystem:
/var/lib/oprofile/samples/current/{root}/bin/ls holds the samples for
/bin/ls, and so on.  Also, the 'opannotate' command annotates source
trees with profile counts: if /bin/ls were built from /src/ls.c, then
'opannotate -o ~/ann-tree' would put a count-annotated copy of ls's
source '~/ann-tree/src/ls.c'.

At the moment, I wish I could simply say:

src=path to source file
real_src = os.path.realpath(src)
rel_real_src = os.path.relpath(real_src, '/')
annotated_source = os.path.join(annotation_dir, rel_real_src)

but this bug gets in the way.
History
Date User Action Args
2009-03-04 22:01:23jimbsetrecipients: + jimb, ocean-city, eli.bendersky
2009-03-04 22:01:23jimbsetmessageid: <1236204083.42.0.408273257211.issue5117@psf.upfronthosting.co.za>
2009-03-04 22:01:21jimblinkissue5117 messages
2009-03-04 22:01:20jimbcreate