Skip to content

Commit

Permalink
feat: support for personal repos (#3464)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vingian authored Aug 13, 2024
1 parent 7e60ede commit c796752
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions bottles/backend/managers/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def __init__(self, get_index=True):
self.aborted_connections = 0
SignalManager.connect(Signals.ForceStopNetworking, self.__stop_index)

self.__check_locals()
self.__check_personals()
if get_index:
self.__get_index()

Expand All @@ -66,32 +66,28 @@ def get_repo(self, name: str, offline: bool = False):

logging.error(f"Repository {name} not found")

def __check_locals(self):
_locals = {}
def __check_personals(self):
_personals = {}

if "LOCAL_COMPONENTS" in os.environ:
_locals["components"] = os.environ["LOCAL_COMPONENTS"]
if "PERSONAL_COMPONENTS" in os.environ:
_personals["components"] = os.environ["PERSONAL_COMPONENTS"]

if "LOCAL_DEPENDENCIES" in os.environ:
_locals["dependencies"] = os.environ["LOCAL_DEPENDENCIES"]
if "PERSONAL_DEPENDENCIES" in os.environ:
_personals["dependencies"] = os.environ["PERSONAL_DEPENDENCIES"]

if "LOCAL_INSTALLERS" in os.environ:
_locals["installers"] = os.environ["LOCAL_INSTALLERS"]
if "PERSONAL_INSTALLERS" in os.environ:
_personals["installers"] = os.environ["PERSONAL_INSTALLERS"]

if not _locals:
if not _personals:
return

for repo in self.__repositories:
if repo not in _locals:
if repo not in _personals:
continue

_path = _locals[repo]

if os.path.exists(_path):
self.__repositories[repo]["url"] = f"file://{_path}/"
logging.info(f"Using local {repo} repository at {_path}")
else:
logging.error(f"Local {repo} path does not exist: {_path}")
_url = _personals[repo]
self.__repositories[repo]["url"] = _url
logging.info(f"Using personal {repo} repository at {_url}")

def __curl_progress(self, _download_t, _download_d, _upload_t, _upload_d):
if self.do_get_index:
Expand Down

0 comments on commit c796752

Please sign in to comment.