Use os.path.expanduser() to simplify code.
authorArfrever Frehtes Taifersar Arahesis <Arfrever@Gentoo.Org>
Wed, 30 Mar 2011 15:03:22 +0000 (17:03 +0200)
committerZac Medico <zmedico@gentoo.org>
Wed, 13 Apr 2011 07:40:21 +0000 (00:40 -0700)
bin/repoman

index 8b1efc5a3102015b49fa10c49c21319c0edb5fd1..86eba81e4433090ef2f23b94ef9fb7a62b347320 100755 (executable)
@@ -2426,10 +2426,7 @@ else:
                                logging.info("Automatically setting PORTAGE_GPG_DIR to %s" % repoman_settings["PORTAGE_GPG_DIR"])
                        else:
                                raise portage.exception.MissingParameter("PORTAGE_GPG_DIR is unset!")
-               gpg_dir = repoman_settings["PORTAGE_GPG_DIR"]
-               if gpg_dir.startswith("~") and "HOME" in os.environ:
-                       repoman_settings["PORTAGE_GPG_DIR"] = os.path.join(
-                               os.environ["HOME"], gpg_dir[1:].lstrip(os.path.sep))
+               repoman_settings["PORTAGE_GPG_DIR"] = os.path.expanduser(repoman_settings["PORTAGE_GPG_DIR"])
                if not os.access(repoman_settings["PORTAGE_GPG_DIR"], os.X_OK):
                        raise portage.exception.InvalidLocation(
                                "Unable to access directory: PORTAGE_GPG_DIR='%s'" % \