ci: remove add_pmbootstrap_to_import_path
Unused since the previous commit Signed-off-by: Pablo Correa Gómez <pabloyoyoista@postmarketos.org> Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7868>
This commit is contained in:
parent
69e772d561
commit
41e2d23210
2 changed files with 0 additions and 45 deletions
|
|
@ -1 +0,0 @@
|
|||
../testcases/add_pmbootstrap_to_import_path
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
# Copyright 2021 Oliver Smith
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import shutil
|
||||
import sys
|
||||
import os
|
||||
import importlib
|
||||
import importlib.util
|
||||
from site import getsitepackages
|
||||
|
||||
|
||||
def path_pmbootstrap():
|
||||
""" Find the pmbootstrap installation folder, so we can import the Python
|
||||
code from there.
|
||||
returns: pmbootstrap installation folder
|
||||
"""
|
||||
# This variable is set by pmbootstrap 1.52 and later
|
||||
# If it's undefined, try to find 'pmbootstrap' in path
|
||||
bin = os.environ.get("PMBOOTSTRAP_CMD") or shutil.which("pmbootstrap")
|
||||
|
||||
if not bin:
|
||||
print("ERROR: 'pmbootstrap' not found in $PATH")
|
||||
sys.exit(1)
|
||||
|
||||
# Resolve the symlink and verify the folder
|
||||
directory = os.path.dirname(os.path.realpath(bin))
|
||||
if os.path.exists(directory + "/pmb/__init__.py"):
|
||||
return directory
|
||||
|
||||
directories = getsitepackages()
|
||||
for directory in directories:
|
||||
if os.path.exists(directory + "/pmb/__init__.py"):
|
||||
return directory
|
||||
|
||||
# Symlink not set up properly
|
||||
print("ERROR: unable to find path to pmbootstrap.py. Try setting 'PMBOOTSTRAP_CMD'.")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
# Check if pmb module can be imported
|
||||
if importlib.util.find_spec("pmb") is None:
|
||||
# Add pmbootstrap dir to import path
|
||||
sys.path.append(os.path.realpath(path_pmbootstrap()))
|
||||
Loading…
Add table
Add a link
Reference in a new issue