From c5c22614898d62b2d08d7e995b9811c6e15658ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Thu, 31 Mar 2016 10:07:09 +0200 Subject: [PATCH] [pungi-wrapper] Remove duplicated code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is almost exact duplicate of util.makedirs. One copy should be enough. Signed-off-by: Lubomír Sedlář --- pungi/wrappers/pungi.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pungi/wrappers/pungi.py b/pungi/wrappers/pungi.py index 4d686bb1..ccd5eb6f 100644 --- a/pungi/wrappers/pungi.py +++ b/pungi/wrappers/pungi.py @@ -15,10 +15,11 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -import errno import os import re +from .. import util + PACKAGES_RE = { "rpm": re.compile(r"^RPM(\((?P[^\)]+)\))?: (?:file://)?(?P/?[^ ]+)$"), @@ -43,11 +44,7 @@ class PungiWrapper(object): ks_path = os.path.abspath(ks_path) ks_dir = os.path.dirname(ks_path) - try: - os.makedirs(ks_dir) - except OSError as ex: - if ex.errno != errno.EEXIST: - raise + util.makedirs(ks_dir) kickstart = open(ks_path, "w")