From 56932f9067122ca5da266e952f37b3de1ce50024 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Thu, 26 Jan 2017 09:01:44 +0100 Subject: [PATCH] repoclosure: Remove duplicated code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Lubomír Sedlář --- pungi/wrappers/repoclosure.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pungi/wrappers/repoclosure.py b/pungi/wrappers/repoclosure.py index 8774ba51..8ea7b951 100644 --- a/pungi/wrappers/repoclosure.py +++ b/pungi/wrappers/repoclosure.py @@ -41,16 +41,18 @@ def get_repoclosure_cmd(arch=None, builddeps=False, repos = repos or {} for repo_id, repo_path in repos.iteritems(): - if "://" not in repo_path: - repo_path = "file://%s" % os.path.abspath(repo_path) - cmd.append("--repofrompath=%s,%s" % (repo_id, repo_path)) + cmd.append("--repofrompath=%s,%s" % (repo_id, _to_url(repo_path))) cmd.append("--repoid=%s" % repo_id) lookaside = lookaside or {} for repo_id, repo_path in lookaside.iteritems(): - if "://" not in repo_path: - repo_path = "file://%s" % os.path.abspath(repo_path) - cmd.append("--repofrompath=%s,%s" % (repo_id, repo_path)) + cmd.append("--repofrompath=%s,%s" % (repo_id, _to_url(repo_path))) cmd.append("--lookaside=%s" % repo_id) return cmd + + +def _to_url(path): + if "://" not in path: + return "file://%s" % os.path.abspath(path) + return path