diff --git a/installsystems/database.py b/installsystems/database.py index 8bb13b2066f6934155a31d65180ea1c5b9af1deb..bd28df30e7752aea4f700a5f76541dbc291a5496 100644 --- a/installsystems/database.py +++ b/installsystems/database.py @@ -25,7 +25,7 @@ class Database(object): def create(cls, path): arrow("Creating repository database") # check locality - if istools.pathtype(path) != "file": + if not istools.isfile(path): raise Exception("Database creation must be local") path = os.path.abspath(path) if os.path.exists(path): @@ -42,7 +42,7 @@ class Database(object): def __init__(self, path): # check locality - if istools.pathtype(path) != "file": + if not istools.isfile(path): raise Exception("Database must be local") self.path = os.path.abspath(path) self.conn = sqlite3.connect(self.path, isolation_level=None) diff --git a/installsystems/image.py b/installsystems/image.py index dcebb71b05685fbf59312ccd0b42c71349f1ce10..8c8a511da29d6226ab6c82f7774cae528fc7799c 100644 --- a/installsystems/image.py +++ b/installsystems/image.py @@ -56,7 +56,7 @@ class SourceImage(Image): Create an empty source image ''' # check local repository - if istools.pathtype(path) != "file": + if not istools.isfile(path): raise NotImplementedError("SourceImage must be local") # main path parser_path = os.path.join(path, "parser") @@ -100,7 +100,7 @@ class SourceImage(Image): def __init__(self, path): # check local repository - if istools.pathtype(path) != "file": + if not istools.isfile(path): raise NotImplementedError("SourceImage must be local") Image.__init__(self) self.base_path = path diff --git a/installsystems/repository.py b/installsystems/repository.py index 2539c6da9ba22de3b1d157343a39325611ca7535..f250b856f3f733edbc8ded8709ee6de0402aa96f 100644 --- a/installsystems/repository.py +++ b/installsystems/repository.py @@ -82,7 +82,7 @@ class Repository(object): Update last file to current time ''' # check local repository - if istools.pathtype(self.config.path) != "file": + if not istools.isfile(self.config.path): raise Exception("Repository addition must be local") try: arrow("Updating last file") @@ -109,7 +109,7 @@ class Repository(object): if delete is true, remove original files ''' # check local repository - if istools.pathtype(self.config.path) != "file": + if not istools.isfile(self.config.path): raise Exception("Repository addition must be local") # cannot add already existant image if self.has(image.name, image.version): @@ -174,7 +174,7 @@ class Repository(object): Delete an image from repository ''' # check local repository - if istools.pathtype(self.config.path) != "file": + if not istools.isfile(self.config.path): raise Exception("Repository deletion must be local") # get md5 of files related to images (exception is raised if not exists md5s = self.getmd5(name, version) @@ -375,7 +375,7 @@ class RepositoryConfig(object): Set db path ''' # dbpath must be local, sqlite3 requirment - if istools.pathtype(value) != "file": + if not istools.isfile(value): raise ValueError("Database path must be local") self._dbpath = os.path.abspath(value)