| Server IP : 107.13.46.68 / Your IP : 216.73.216.232 Web Server : Apache/2.4.58 (Ubuntu) System : Linux mariOS 6.8.0-51-generic #52-Ubuntu SMP PREEMPT_DYNAMIC Thu Dec 5 13:09:44 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /lib/python3/dist-packages/repolib/ |
Upload File : |
#!/usr/bin/python3
"""
Copyright (c) 2022, Ian Santopietro
All rights reserved.
This file is part of RepoLib.
RepoLib is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
RepoLib is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with RepoLib. If not, see <https://www.gnu.org/licenses/>.
"""
import logging
from pathlib import Path
from . import util
from .file import SourceFile
from .source import Source
from .shortcuts import popdev, ppa
log = logging.getLogger(__name__)
def load_all_sources() -> None:
"""Loads all of the sources present on the system."""
log.info('Loading all sources')
util.sources.clear()
util.files.clear()
util.keys.clear()
util.errors.clear()
sources_path = Path(util.SOURCES_DIR)
sources_files = sources_path.glob('*.sources')
legacy_files = sources_path.glob('*.list')
for file in [*sources_files, *legacy_files]:
if file.is_dir():
log.info("Ignoring directory '%s'", file)
continue
try:
sourcefile = SourceFile(name=file.stem)
log.debug('Loading %s', file)
sourcefile.load()
if file.name not in util.files:
util.files[file.name] = sourcefile
except Exception as err:
util.errors[file.name] = err
for f in util.files:
file = util.files[f]
for source in file.sources:
if source.ident in util.sources:
source.ident = f'{file.name}-{source.ident}'
util.sources[source.ident] = source