mirror of
https://github.com/DrewThomasson/ebook2audiobook.git
synced 2026-01-10 06:18:02 -05:00
fix cmd and sh script with Miniforge3
This commit is contained in:
11
app.py
11
app.py
@@ -51,9 +51,15 @@ def check_and_install_requirements(file_path):
|
||||
print(error)
|
||||
return False
|
||||
try:
|
||||
import regex as re
|
||||
from importlib.metadata import version, PackageNotFoundError
|
||||
from tqdm import tqdm
|
||||
try:
|
||||
import regex as re
|
||||
from tqdm import tqdm
|
||||
except Exception as e:
|
||||
subprocess.check_call([sys.executable, '-m', 'pip', 'cache', 'purge'])
|
||||
subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'regex', 'tqdm'])
|
||||
import regex as re
|
||||
from tqdm import tqdm
|
||||
with open(file_path, 'r') as f:
|
||||
contents = f.read().replace('\r', '\n')
|
||||
packages = [pkg.strip() for pkg in contents.splitlines() if pkg.strip()]
|
||||
@@ -71,7 +77,6 @@ def check_and_install_requirements(file_path):
|
||||
msg = '\nInstalling missing packages...\n'
|
||||
print(msg)
|
||||
os.environ['TMPDIR'] = tmp_dir
|
||||
subprocess.check_call([sys.executable, '-m', 'pip', 'cache', 'purge'])
|
||||
subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--upgrade', 'pip'])
|
||||
with tqdm(total=len(packages), desc='Installation 0.00%', bar_format='{desc}: {n_fmt}/{total_fmt} ', unit='step') as t:
|
||||
for package in tqdm(missing_packages, desc="Installing", unit="pkg"):
|
||||
|
||||
@@ -255,8 +255,14 @@ else
|
||||
}
|
||||
|
||||
function conda_check {
|
||||
if ! command -v conda &> /dev/null; then
|
||||
echo -e "\e[33mMiniforge3 is not installed!\e[0m"
|
||||
if ! command -v conda &> /dev/null || [ ! -f "$CONDA_ENV" ]; then
|
||||
if [ -d $HOME/miniconda3 ]; then
|
||||
echo "Miniconda3 is deprecated, switching to Miniforge3..."
|
||||
$HOME/miniconda3/bin/conda deactivate
|
||||
rm -rf $HOME/miniconda3
|
||||
else
|
||||
echo -e "\e[33mMiniforge3 is not installed!\e[0m"
|
||||
fi
|
||||
echo -e "\e[33mDownloading Miniforge3 installer...\e[0m"
|
||||
if [[ "$OSTYPE" = "darwin"* ]]; then
|
||||
curl -fsSLo "$CONDA_INSTALLER" "$CONDA_URL"
|
||||
@@ -265,10 +271,10 @@ else
|
||||
fi
|
||||
if [[ -f "$CONDA_INSTALLER" ]]; then
|
||||
echo -e "\e[33mInstalling Miniforge3...\e[0m"
|
||||
bash "$CONDA_INSTALLER" -b -p "$CONDA_INSTALL_DIR"
|
||||
bash "$CONDA_INSTALLER" -b -u -p "$CONDA_INSTALL_DIR"
|
||||
rm -f "$CONDA_INSTALLER"
|
||||
if [[ -f "$CONDA_INSTALL_DIR/bin/conda" ]]; then
|
||||
conda config --set auto_activate_base false
|
||||
$CONDA_INSTALL_DIR/bin/conda config --set auto_activate_base false
|
||||
source $CONDA_ENV
|
||||
echo -e "\e[32m===============>>> conda is installed! <<===============\e[0m"
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user