The getportageversion function uses this function which returns None if the profile is not in the gentoo repository: profilever = relative_profile_path(portdir, profile) It would be nicer if it checked all available repositories.