Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support for personal repos #3464

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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