From f079ce89c888c68a59537e181cef81263d44418e Mon Sep 17 00:00:00 2001 From: Lubomír Sedlář Date: Apr 01 2016 13:42:46 +0000 Subject: [pungi-wrapper] Remove duplicated code This is almost exact duplicate of util.makedirs. One copy should be enough. Signed-off-by: Lubomír Sedlář --- diff --git a/pungi/wrappers/pungi.py b/pungi/wrappers/pungi.py index 4d686bb..ccd5eb6 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")