From 7459a05eba65957cafa2c2afba346bfa4e012334 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Tue, 9 Feb 2016 09:16:57 +0100 Subject: os.path.join --- cleantools/clmgr.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'cleantools/clmgr.py') diff --git a/cleantools/clmgr.py b/cleantools/clmgr.py index 563f60c..cad6b95 100755 --- a/cleantools/clmgr.py +++ b/cleantools/clmgr.py @@ -30,8 +30,8 @@ class Library(): """Get the path of a library in the installation dir""" install_dir = settings.read()['General']['install_dir'] for path in settings.get_search_paths(): - if os.path.isdir(path + '/' + lib): - return path + '/' + lib + if os.path.isdir(os.path.join(path, lib): + return os.path.join(path, lib) raise ValueError('\'%s\': no such library' % lib) @staticmethod @@ -39,7 +39,7 @@ class Library(): """New library by cloning a repo to the installation dir""" install_dir = settings.read()['General']['install_dir'] settings.make_install_dir(install_dir) - Repo.clone_from(repo, install_dir + '/' + local_dir) + Repo.clone_from(repo, os.path.join(install_dir, local_dir) return Library(local_dir) @click.group() @@ -74,7 +74,7 @@ def cli_install(abs, repo, local_dir): clmgr install username/MyLibrary (local_dir will be MyLibrary) clmgr install --abs /var/git/my-library LocalName""" if local_dir == None: - local_dir = list(filter(lambda x: len(x)>0, repo.split('/')))[-1] + local_dir = list(filter(lambda x: len(x)>0, repo.split(os.sep)))[-1] click.secho('No local_dir given, using \'%s\'' % local_dir, err=True, fg='yellow') -- cgit v1.2.3