Unverified Commit 3ad16b48 authored by dmMaze's avatar dmMaze Committed by GitHub
Browse files

Merge pull request #247 from hyrulelinks/dev

Update macos-build-script.sh
parents a57626fa ea8c7dba
Loading
Loading
Loading
Loading
+6 −82
Original line number Diff line number Diff line
@@ -12,94 +12,18 @@ version = "1.3.35.dev." + commit_hash

block_cipher = None


a = Analysis([
        'launch.py',
    'modules/base.py',
    'modules/inpaint/aot.py',
    'modules/inpaint/ffc.py',
    'modules/inpaint/lama.py',
    'modules/inpaint/patch_match.py',
    'modules/ocr/macos_ocr.py',
    'modules/ocr/manga_ocr.py',
    'modules/ocr/mit48px_ctc.py',
    'modules/ocr/model_32px.py',
    'modules/ocr/windows_ocr.py',
    'modules/textdetector/db_utils.py',
    'modules/textdetector/textblock.py',
    'modules/textdetector/ctd/basemodel.py',
    'modules/textdetector/ctd/inference.py',
    'modules/textdetector/ctd/textmask.py',
    'modules/textdetector/yolov5/common.py',
    'modules/textdetector/yolov5/yolo.py',
    'modules/textdetector/yolov5/yolov5_utils.py',
    'modules/translators/base.py',
    'modules/translators/constants.py',
    'modules/translators/exceptions.py',
    'modules/translators/hooks.py',
    'modules/translators/trans_baidu.py',
    'modules/translators/trans_caiyun.py',
    'modules/translators/trans_chatgpt.py',
    'modules/translators/trans_deepl.py',
    'modules/translators/trans_deeplx.py',
    'modules/translators/trans_google.py',
    'modules/translators/trans_papago.py',
    'modules/translators/trans_sugoi.py',
    'modules/translators/trans_yandex.py',
    'scripts/svgscript.py',
    'scripts/update_translation.py',
    'ui/canvas.py',
    'ui/combobox.py',
    'ui/config.py',
    'ui/configpanel.py',
    'ui/constants.py',
    'ui/cursor.py',
    'ui/dlconfig_parse_widgets.py',
    'ui/drawing_commands.py',
    'ui/drawingpanel.py',
    'ui/fontformat_commands.py',
    'ui/fontformatpanel.py',
    'ui/funcmaps.py',
    'ui/global_search_widget.py',
    'ui/image_edit.py',
    'ui/imgtrans_proj.py',
    'ui/io_thread.py',
    'ui/keywordsubwidget.py',
    'ui/mainwindow.py',
    'ui/mainwindowbars.py',
    'ui/misc.py',
    'ui/module_manager.py',
    'ui/page_search_widget.py',
    'ui/preset_widget.py',
    'ui/scene_textlayout.py',
    'ui/scenetext_manager.py',
    'ui/shared_widget.py',
    'ui/stylewidgets.py',
    'ui/text_graphical_effect.py',
    'ui/textedit_area.py',
    'ui/textedit_commands.py',
    'ui/texteditshapecontrol.py',
    'ui/textitem.py',
    'ui/framelesswindow/fw_qt6/mac/window_effect.py',
    'ui/framelesswindow/fw_qt6/utils/linux_utils.py',
    'ui/framelesswindow/fw_qt6/utils/mac_utils.py',
    'ui/framelesswindow/fw_qt6/utils/win32_utils.py',
    'utils/appinfo.py',
    'utils/imgproc_utils.py',
    'utils/io_utils.py',
    'utils/logger.py',
    'utils/registry.py',
    'utils/stroke_width_calculator.py',
    'utils/structures.py',
    'utils/text_layout.py',
    'utils/text_processing.py',
    'utils/textblock_mask.py',],
    pathex=[],
        ],
    pathex=[
        './scripts',
        ],
    binaries=[],
    datas=[
        ('config', './config'),
        ('data', './data'),
        ('doc', './doc'),
        ('fonts', './fonts'),
        ('icons', './icons'),
        ('modules', './modules'),
        ('scripts', './scripts'),
+27 −18
Original line number Diff line number Diff line
@@ -26,7 +26,8 @@ echo "STEP 2: Create and activate Python virtual environment"
python_version=$(python3 -V 2>&1 | cut -d" " -f2 | cut -d"." -f1-2)

if ! which python3 >/dev/null 2>&1; then
    echo "ERROR: The 'python3' command not found. Please check the environment configuration."
    echo "ERROR: ❌ The 'python3' command not found."
    echo "ERROR: Please check the Python environment configuration."
    exit 1
else
    echo "INFO: The 'python3' command found." 
@@ -60,7 +61,7 @@ else
fi

# Download extra data files
echo "STEP 4: Download extra data files."
echo "STEP 4: Download data files."

# Function to calculate file hash
calculate_hash() {
@@ -70,7 +71,6 @@ calculate_hash() {

# Function to download and process files
download_and_process_files() {
    echo "INFO: STEP 4: Downloading data files..."
    local files=(
        'inpainting.ckpt|https://github.com/zyddnys/manga-image-translator/releases/download/beta-0.3|no_zip||aot_inpainter.ckpt|data/models|878d541c68648969bc1b042a6e997f3a58e49b6c07c5636ad55130736977149f'
        'comictextdetector.pt|https://github.com/zyddnys/manga-image-translator/releases/download/beta-0.3|no_zip||comictextdetector.pt|data/models|1f90fa60aeeb1eb82e2ac1167a66bf139a8a61b8780acd351ead55268540cccb'
@@ -174,11 +174,13 @@ download_and_process_files() {
    done
}

# Call the download functions
download_and_process_files

# Extract libraries based on architecture
# Function to thin libraries based on system architecture
thin_liarary_files() {
    local arch=$(uname -m)
    
    # Thin multi-architecture library files into compatible single arch libraries
    echo "INFO: System architecture is $arch."
    echo "INFO: Extracting architecture specific libraries..."
    if [ "$arch" = "arm64" ]; then
        ditto --arch arm64 "$LIBS_DIR/libopencv_world.4.4.0.dylib" "$LIBS_DIR/libopencv_world2.4.4.0.dylib"
        ditto --arch arm64 "$LIBS_DIR/libpatchmatch_inpaint.dylib" "$LIBS_DIR/libpatchmatch_inpaint2.dylib"
@@ -187,11 +189,18 @@ else
        ditto --arch x86_64 "$LIBS_DIR/libpatchmatch_inpaint.dylib" "$LIBS_DIR/libpatchmatch_inpaint2.dylib"
    fi
    
# Remove unnecessary libraries
    # Remove fat libraries
    rm "$LIBS_DIR/libopencv_world.4.4.0.dylib" "$LIBS_DIR/libpatchmatch_inpaint.dylib"
    mv "$LIBS_DIR/libopencv_world2.4.4.0.dylib" "$LIBS_DIR/libopencv_world.4.4.0.dylib"
    mv "$LIBS_DIR/libpatchmatch_inpaint2.dylib" "$LIBS_DIR/libpatchmatch_inpaint.dylib"
    
    echo "INFO: ✅ Single architecture library files generated."
}

# Call the download functions
download_and_process_files
thin_liarary_files

# Checklist of extra data files
check_list="
data/alphabet-all-v5.txt
+5 −3
Original line number Diff line number Diff line
@@ -5,8 +5,10 @@ PyQt6<=6.4.2 #PyQt5>=5.15.9
numpy
urllib3==1.25.11 # https://github.com/psf/requests/issues/5740
jaconv
torch
torchvision
torch; sys_platform == 'win32'
torchvision; sys_platform == 'win32'
torch -f https://download.pytorch.org/whl/nightly/cpu; sys_platform == 'darwin'
torchvision -f https://download.pytorch.org/whl/nightly/cpu; sys_platform == 'darwin'
transformers
fugashi
unidic_lite