aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPer Øyvind Karlsen <proyvind@moondrake.org>2016-06-28 20:25:13 +0200
committerPer Øyvind Karlsen <proyvind@moondrake.org>2016-06-28 20:25:13 +0200
commitdb101fdddb6f631a342fedc0ef2560edbef580b5 (patch)
treee7b49cfc453a1cf4883eb28dff0e9af324d53bc6
parent51641610aea61c0633912dafc5a8f51e454cade9 (diff)
downloadmgarepo-db101fdddb6f631a342fedc0ef2560edbef580b5.tar
mgarepo-db101fdddb6f631a342fedc0ef2560edbef580b5.tar.gz
mgarepo-db101fdddb6f631a342fedc0ef2560edbef580b5.tar.bz2
mgarepo-db101fdddb6f631a342fedc0ef2560edbef580b5.tar.xz
mgarepo-db101fdddb6f631a342fedc0ef2560edbef580b5.zip
improve getpkgtopdir() to return "friendlier" (normalized) paths
-rw-r--r--MgaRepo/rpmutil.py11
1 files changed, 2 insertions, 9 deletions
diff --git a/MgaRepo/rpmutil.py b/MgaRepo/rpmutil.py
index 0bd2ef8..c541fc9 100644
--- a/MgaRepo/rpmutil.py
+++ b/MgaRepo/rpmutil.py
@@ -625,19 +625,12 @@ def clone(pkgdirurl, path=None, revision=None, branch=None, distro=None, backpor
if not spec:
binrepo.download_binaries(path)
-def getpkgtopdir(basedir=None):
-
- #FIXME this implementation doesn't work well with relative path names,
- # which is something we need in order to have a friendlier output
- if basedir is None:
- basedir = os.path.curdir
+def getpkgtopdir(basedir=os.path.curdir):
while not ispkgtopdir(basedir):
if os.path.abspath(basedir) == "/":
raise Error("can't find top package directories SOURCES and SPECS")
basedir = os.path.join(basedir, os.path.pardir)
- if basedir.startswith("./"):
- basedir = basedir[2:]
- return basedir
+ return os.path.normpath(basedir)
def ispkgtopdir(path=None):
if path is None: