Message83146
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. |
|
Date |
User |
Action |
Args |
2009-03-04 22:01:23 | jimb | set | recipients:
+ jimb, ocean-city, eli.bendersky |
2009-03-04 22:01:23 | jimb | set | messageid: <1236204083.42.0.408273257211.issue5117@psf.upfronthosting.co.za> |
2009-03-04 22:01:21 | jimb | link | issue5117 messages |
2009-03-04 22:01:20 | jimb | create | |
|