mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-18 10:26:29 +01:00
fix read file if exist
This commit is contained in:
parent
ea08f4a1ff
commit
1565449998
1 changed files with 8 additions and 7 deletions
|
@ -64,13 +64,14 @@ def update_repositories(repositories):
|
|||
Upadate with user custom repositories
|
||||
'''
|
||||
repo_file = "{0}custom-repositories".format(conf_path)
|
||||
f = open(repo_file, "r")
|
||||
repositories_list = f.read()
|
||||
f.close()
|
||||
for line in repositories_list.splitlines():
|
||||
line = line.lstrip()
|
||||
if line and not line.startswith("#"):
|
||||
repositories.append(line.split()[0])
|
||||
if os.path.isfile(repo_file):
|
||||
f = open(repo_file, "r")
|
||||
repositories_list = f.read()
|
||||
f.close()
|
||||
for line in repositories_list.splitlines():
|
||||
line = line.lstrip()
|
||||
if line and not line.startswith("#"):
|
||||
repositories.append(line.split()[0])
|
||||
return repositories
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue