Improved portability of relpath switching to Perl

relpath from os.path is available only for Python >= 2.6.