def make_path_spec_relative(filename, spec_dir):
 if os.path.isabs(filename):
  return filename
 else:
  filename = os.path.abspath(filename)
  filename = os.path.relpath(filename, start=spec_dir)
  return filename

def make_path_spec_relative ( filename , spec_dir ) : if os . path . isabs ( filename ) : return filename else : filename = os . path . abspath ( filename ) filename = os . path . relpath ( filename , start = spec_dir ) return filename
make the filename relative to the directory containing .