From 91dd9754139b93791971feccd575c3fd19710116 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sat, 27 Jan 2018 13:54:15 +0100 Subject: [PATCH] mkdir_p replaced with os.makedirs --- platypush/backend/http/request/rss/__init__.py | 3 +-- platypush/config/__init__.py | 4 +--- platypush/utils/__init__.py | 7 ------- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/platypush/backend/http/request/rss/__init__.py b/platypush/backend/http/request/rss/__init__.py index fac5c6b4c8..515f32a7d6 100644 --- a/platypush/backend/http/request/rss/__init__.py +++ b/platypush/backend/http/request/rss/__init__.py @@ -14,7 +14,6 @@ from sqlalchemy.ext.declarative import declarative_base from platypush.backend.http.request import HttpRequest from platypush.config import Config from platypush.message.event.http.rss import NewFeedEvent -from platypush.utils import mkdir_p Base = declarative_base() Session = scoped_session(sessionmaker()) @@ -32,7 +31,7 @@ class GetRssUpdates(HttpRequest): self.mercury_api_key = mercury_api_key # Mercury Reader API used to parse the content of the link if dbfile: self.dbfile = dbfile - mkdir_p(os.path.dirname(self.dbfile)) + os.makedirs(os.path.expanduser(os.path.dirname(self.dbfile)), exist_ok=True) self.engine = create_engine('sqlite:///{}'.format(self.dbfile)) Base.metadata.create_all(self.engine) diff --git a/platypush/config/__init__.py b/platypush/config/__init__.py index 45820318a2..fa761bed12 100644 --- a/platypush/config/__init__.py +++ b/platypush/config/__init__.py @@ -5,8 +5,6 @@ import socket import time import yaml -from platypush.utils import mkdir_p - """ Config singleton instance """ _default_config_instance = None @@ -63,7 +61,7 @@ class Config(object): if 'workdir' not in self._config: self._config['workdir'] = self._workdir_location - mkdir_p(self._config['workdir']) + os.makedirs(self._config['workdir'], exist_ok=True) if 'logging' not in self._config: self._config['logging'] = logging.INFO diff --git a/platypush/utils/__init__.py b/platypush/utils/__init__.py index ada4492ada..f254a453e9 100644 --- a/platypush/utils/__init__.py +++ b/platypush/utils/__init__.py @@ -64,12 +64,5 @@ def clear_timeout(): signal.alarm(0) -def mkdir_p(path): - try: os.makedirs(path) - except OSError as exc: # Python >2.5 - if exc.errno == errno.EEXIST and os.path.isdir(path): pass - else: raise - - # vim:sw=4:ts=4:et: