improved intendation on Input.multiple

This commit is contained in:
koumakpet 2020-03-14 11:51:21 +01:00
parent 309f8d0da3
commit 721ac3ec75

26
lib.py
View file

@ -177,9 +177,9 @@ class Input:
return inp return inp
break break
else: else:
Print.err(f'Invalid input, range: 1-{max}') Print.err(f'Invalid input, range: 0-{max}')
except ValueError: except ValueError:
Print.err(f'Invalid input (must be number: 1-{max})') Print.err(f'Invalid input (must be number: 0-{max})')
continue continue
Print.question(question) Print.question(question)
@ -240,7 +240,7 @@ class Install:
raise TypeError( raise TypeError(
'check_not_installed() only takes string or list parameters') 'check_not_installed() only takes string or list parameters')
if package_name == ['base-devel']: if package_name == ['base-devel']:
# Check dependenceis for base-devel (group packages are not detected directly) # Check dependencies for base-devel (group packages are not detected directly)
return Install.check_not_installed( return Install.check_not_installed(
'guile libmpc autoconf automake binutils bison fakeroot file findutils flex gawk gcc gettext grep groff gzip libtool m4 make pacman patch pkgconf sed sudo texinfo which') 'guile libmpc autoconf automake binutils bison fakeroot file findutils flex gawk gcc gettext grep groff gzip libtool m4 make pacman patch pkgconf sed sudo texinfo which')
for package in package_name: for package in package_name:
@ -250,6 +250,24 @@ class Install:
else: else:
return True return True
def check_dir_exists(paths):
'''Check for directory/ies existence
Arguments:
paths {str} -- single path or multiple paths separated by spaces (absolute paths)
Returns:
bool -- One of dirs exists/Single dir exists
'''
paths = paths.split(' ')
for dir_path in paths:
dir_path = os.path.expanduser(dir_path)
if os.path.isdir(dir_path):
return True
break
else:
return False
def git_aur(repository, install_text='default', force=False): def git_aur(repository, install_text='default', force=False):
'''Install package directly from AUR using only git and makepkg '''Install package directly from AUR using only git and makepkg
@ -269,7 +287,7 @@ class Install:
f'Unable to install AUR repository: {repository}, git is not installed') f'Unable to install AUR repository: {repository}, git is not installed')
return False return False
# Base-devel group includes (requered for makepkg) # Base-devel group includes (required for makepkg)
if Install.check_not_installed('base-devel'): if Install.check_not_installed('base-devel'):
Print.warning( Print.warning(
f'Unable to install AUR repository: {repository}, base-devel is not installed') f'Unable to install AUR repository: {repository}, base-devel is not installed')