Jim Blandy <j...@red-bean.com> added the comment: 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. ---------- nosy: +jimb _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5117> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com