Skip to content

Commit 6535a82

Browse files
authored
Merge pull request #7 from AlbertShown/main
Python WebUI v2.4.1
2 parents 912885a + 7e2882a commit 6535a82

File tree

29 files changed

+394
-1005
lines changed

29 files changed

+394
-1005
lines changed

.github/workflows/pypi-publish.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Publish PyPi Package
22

33
on:
44
release:
5-
types: [published]
5+
types: [created]
66

77
permissions:
88
contents: read
@@ -24,6 +24,8 @@ jobs:
2424
python -m pip install --upgrade pip
2525
python -m pip install --upgrade build
2626
python -m pip install --upgrade twine
27-
cd /PyPI/Package
27+
cd PyPI/Package/src/webui
28+
sh bootstrap.sh
29+
cd ../..
2830
python -m build
2931
python -m twine upload --repository pypi dist/* --username __token__ --password ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/update_binaries.yml

Lines changed: 0 additions & 103 deletions
This file was deleted.

.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
# Python binaries
2+
PyPI/Package/src/webui/webui-windows-msvc-x64/
3+
PyPI/Package/src/webui/webui-windows-msvc-arm/
4+
PyPI/Package/src/webui/webui-windows-msvc-arm64/
5+
PyPI/Package/src/webui/webui-macos-clang-x64/
6+
PyPI/Package/src/webui/webui-macos-clang-arm/
7+
PyPI/Package/src/webui/webui-macos-clang-arm64/
8+
PyPI/Package/src/webui/webui-linux-gcc-x64/
9+
PyPI/Package/src/webui/webui-linux-gcc-arm/
10+
PyPI/Package/src/webui/webui-linux-gcc-arm64/
11+
*.dll
12+
*.so
13+
*.dylib
14+
15+
# Archives
16+
*.zip
17+
*.tar
18+
*.gz
19+
120
# Build
221
*.exe
322
*.ilk

PyPI/Package/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "webui2"
7-
version = "2.4.0.3"
7+
version = "2.4.1"
88
authors = [
99
{ name="Hassan Draga" },
1010
]
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
@echo off
2+
SETLOCAL
3+
4+
:: This script downloads the trusted WebUI compiled library by GitHub CI for Windows.
5+
6+
IF "%1"=="minimal" (
7+
goto MINIMAL
8+
)
9+
10+
:: --- Full -------------------------------------
11+
:: Download WebUI library for all supported OS.
12+
echo WebUI Deno Bootstrap
13+
echo.
14+
15+
:: Creating the temporary cache folder
16+
mkdir "cache" 2>nul 1>nul
17+
18+
:: Nightly Build
19+
:: SET "LINUX_ARM=https://github.com/webui-dev/webui/releases/download/nightly/webui-linux-gcc-arm.zip"
20+
:: SET "LINUX_ARM64=https://github.com/webui-dev/webui/releases/download/nightly/webui-linux-gcc-arm64.zip"
21+
:: SET "LINUX_X64=https://github.com/webui-dev/webui/releases/download/nightly/webui-linux-gcc-x64.zip"
22+
:: SET "MACOS_ARM64=https://github.com/webui-dev/webui/releases/download/nightly/webui-macos-clang-arm64.zip"
23+
:: SET "MACOS_X64=https://github.com/webui-dev/webui/releases/download/nightly/webui-macos-clang-x64.zip"
24+
:: SET "WINDOWS_MSVC_X64=https://github.com/webui-dev/webui/releases/download/nightly/webui-windows-msvc-x64.zip"
25+
26+
:: Release
27+
SET "LINUX_ARM=https://github.com/webui-dev/webui/releases/download/2.4.1/webui-linux-gcc-arm.zip"
28+
SET "LINUX_ARM64=https://github.com/webui-dev/webui/releases/download/2.4.1/webui-linux-gcc-arm64.zip"
29+
SET "LINUX_X64=https://github.com/webui-dev/webui/releases/download/2.4.1/webui-linux-gcc-x64.zip"
30+
SET "MACOS_ARM64=https://github.com/webui-dev/webui/releases/download/2.4.1/webui-macos-clang-arm64.zip"
31+
SET "MACOS_X64=https://github.com/webui-dev/webui/releases/download/2.4.1/webui-macos-clang-x64.zip"
32+
SET "WINDOWS_MSVC_X64=https://github.com/webui-dev/webui/releases/download/2.4.1/webui-windows-msvc-x64.zip"
33+
34+
:: Download and extract archives
35+
CALL :DOWNLOAD_AND_EXTRACT %LINUX_ARM% webui-linux-gcc-arm webui-2.so
36+
CALL :DOWNLOAD_AND_EXTRACT %LINUX_ARM64% webui-linux-gcc-arm64 webui-2.so
37+
CALL :DOWNLOAD_AND_EXTRACT %LINUX_X64% webui-linux-gcc-x64 webui-2.so
38+
CALL :DOWNLOAD_AND_EXTRACT %MACOS_ARM64% webui-macos-clang-arm64 webui-2.dylib
39+
CALL :DOWNLOAD_AND_EXTRACT %MACOS_X64% webui-macos-clang-x64 webui-2.dylib
40+
CALL :DOWNLOAD_AND_EXTRACT %WINDOWS_MSVC_X64% webui-windows-msvc-x64 webui-2.dll
41+
42+
:: Remove cache folder
43+
echo * Cleaning...
44+
rmdir /S /Q "cache" 2>nul 1>nul
45+
exit /b
46+
47+
:: Download and Extract Function
48+
:DOWNLOAD_AND_EXTRACT
49+
echo * Downloading [%1]...
50+
SET FULL_URL=%1
51+
SET FILE_NAME=%2
52+
SET LIB_DYN=%3
53+
SET LIB_STATIC=%4
54+
powershell -Command "Invoke-WebRequest '%FULL_URL%' -OutFile 'cache\%FILE_NAME%.zip'"
55+
echo * Extracting [%FILE_NAME%.zip]...
56+
mkdir "cache\%FILE_NAME%" 2>nul 1>nul
57+
tar -xf "cache\%FILE_NAME%.zip" -C "cache"
58+
IF NOT "%LIB_DYN%"=="" (
59+
:: Copy dynamic library
60+
echo * Copying [%LIB_DYN%]...
61+
mkdir "%FILE_NAME%" 2>nul 1>nul
62+
copy /Y "cache\%FILE_NAME%\%LIB_DYN%" "%FILE_NAME%\%LIB_DYN%" 2>nul 1>nul
63+
)
64+
IF NOT "%LIB_STATIC%"=="" (
65+
:: Copy dynamic library
66+
echo * Copying [%LIB_STATIC%]...
67+
mkdir "%FILE_NAME%" 2>nul 1>nul
68+
copy /Y "cache\%FILE_NAME%\%LIB_STATIC%" "%FILE_NAME%\%LIB_STATIC%" 2>nul 1>nul
69+
)
70+
GOTO :EOF
71+
72+
:: --- Minimal ----------------------------------
73+
:: Download WebUI library for only the current OS.
74+
:MINIMAL
75+
76+
SET "BASE_URL=https://github.com/webui-dev/webui/releases/download/2.4.1/"
77+
78+
:: Check the CPU architecture
79+
IF "%PROCESSOR_ARCHITECTURE%"=="x86" (
80+
:: x86 32Bit
81+
:: SET "FILENAME=webui-windows-msvc-x86"
82+
ECHO Error: Windows x86 32Bit architecture is not supported yet
83+
exit /b
84+
) ELSE IF "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
85+
:: x86 64Bit
86+
SET "FILENAME=webui-windows-msvc-x64"
87+
) ELSE IF "%PROCESSOR_ARCHITECTURE%"=="ARM" (
88+
:: ARM 32Bit
89+
:: SET "FILENAME=webui-windows-msvc-arm"
90+
ECHO Error: Windows ARM architecture is unsupported yet
91+
exit /b
92+
) ELSE IF "%PROCESSOR_ARCHITECTURE%"=="ARM64" (
93+
:: ARM 64Bit
94+
:: SET "FILENAME=webui-windows-msvc-arm64"
95+
ECHO Error: Windows ARM64 architecture is unsupported yet
96+
exit /b
97+
) ELSE (
98+
ECHO Error: Unknown architecture '%PROCESSOR_ARCHITECTURE%'
99+
exit /b
100+
)
101+
102+
:: Creating the temporary cache folder
103+
mkdir "cache" 2>nul 1>nul
104+
mkdir "cache\%FILENAME%" 2>nul 1>nul
105+
106+
:: Download the archive using PowerShell
107+
powershell -Command "Invoke-WebRequest '%BASE_URL%%FILENAME%.zip' -OutFile 'cache\%FILENAME%.zip'"
108+
109+
:: Extract archive (Windows 10 and later)
110+
tar -xf "cache\%FILENAME%.zip" -C "cache"
111+
112+
:: Copy library
113+
mkdir "%FILENAME%" 2>nul 1>nul
114+
copy /Y "cache\%FILENAME%\webui-2.dll" "%FILENAME%\webui-2.dll" 2>nul 1>nul
115+
116+
:: Remove cache folder
117+
rmdir /S /Q "cache" 2>nul 1>nul
118+
119+
ENDLOCAL
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
#!/bin/bash
2+
3+
# This script downloads the trusted WebUI compiled library by GitHub CI for Linux.
4+
5+
if [[ "$1" == "" ]]; then
6+
7+
# --- Full -------------------------------------
8+
# Download WebUI library for all supported OS.
9+
echo "WebUI Deno Bootstrap"
10+
echo
11+
12+
# Creating the temporary cache folder
13+
mkdir -p "cache" 2>/dev/null
14+
15+
# Nightly Build
16+
# LINUX_ARM="https://github.com/webui-dev/webui/releases/download/nightly/webui-linux-gcc-arm.zip"
17+
# LINUX_ARM64="https://github.com/webui-dev/webui/releases/download/nightly/webui-linux-gcc-arm64.zip"
18+
# LINUX_X64="https://github.com/webui-dev/webui/releases/download/nightly/webui-linux-gcc-x64.zip"
19+
# MACOS_ARM64="https://github.com/webui-dev/webui/releases/download/nightly/webui-macos-clang-arm64.zip"
20+
# MACOS_X64="https://github.com/webui-dev/webui/releases/download/nightly/webui-macos-clang-x64.zip"
21+
# WINDOWS_MSVC_X64="https://github.com/webui-dev/webui/releases/download/nightly/webui-windows-msvc-x64.zip"
22+
23+
# Release
24+
LINUX_ARM="https://github.com/webui-dev/webui/releases/download/2.4.1/webui-linux-gcc-arm.zip"
25+
LINUX_ARM64="https://github.com/webui-dev/webui/releases/download/2.4.1/webui-linux-gcc-arm64.zip"
26+
LINUX_X64="https://github.com/webui-dev/webui/releases/download/2.4.1/webui-linux-gcc-x64.zip"
27+
MACOS_ARM64="https://github.com/webui-dev/webui/releases/download/2.4.1/webui-macos-clang-arm64.zip"
28+
MACOS_X64="https://github.com/webui-dev/webui/releases/download/2.4.1/webui-macos-clang-x64.zip"
29+
WINDOWS_MSVC_X64="https://github.com/webui-dev/webui/releases/download/2.4.1/webui-windows-msvc-x64.zip"
30+
31+
# Download and extract archives
32+
download_and_extract() {
33+
echo "* Downloading [$1]..."
34+
wget -q "$1" -O "cache/$2.zip"
35+
echo "* Extracting [$2.zip]..."
36+
mkdir -p "cache/$2" 2>/dev/null
37+
unzip -q "cache/$2.zip" -d "cache"
38+
if [ -n "$3" ]; then
39+
echo "* Copying [$3]..."
40+
mkdir -p "$2" 2>/dev/null
41+
cp -f "cache/$2/$3" "$2/$3"
42+
fi
43+
if [ -n "$4" ]; then
44+
echo "* Copying [$4]..."
45+
mkdir -p "$2" 2>/dev/null
46+
cp -f "cache/$2/$4" "$2/$4"
47+
fi
48+
}
49+
50+
download_and_extract $LINUX_ARM "webui-linux-gcc-arm" "webui-2.so"
51+
download_and_extract $LINUX_ARM64 "webui-linux-gcc-arm64" "webui-2.so"
52+
download_and_extract $LINUX_X64 "webui-linux-gcc-x64" "webui-2.so"
53+
download_and_extract $MACOS_ARM64 "webui-macos-clang-arm64" "webui-2.dylib"
54+
download_and_extract $MACOS_X64 "webui-macos-clang-x64" "webui-2.dylib"
55+
download_and_extract $WINDOWS_MSVC_X64 "webui-windows-msvc-x64" "webui-2.dll"
56+
57+
# Remove cache folder
58+
echo "* Cleaning..."
59+
rm -rf "cache"
60+
exit 0
61+
fi
62+
63+
if [[ "$1" == "minimal" ]]; then
64+
65+
# --- Minimal ----------------------------------
66+
# Download WebUI library for only the current OS.
67+
68+
# Nightly Build
69+
# BASE_URL="https://github.com/webui-dev/webui/releases/download/nightly/"
70+
71+
# Release
72+
BASE_URL="https://github.com/webui-dev/webui/releases/download/2.4.1/"
73+
74+
# Detect OS (macOS / Linux)
75+
OS="linux"
76+
CC="gcc"
77+
EXT="so"
78+
if [[ "$OSTYPE" == "darwin"* ]]; then
79+
OS="macos"
80+
CC="clang"
81+
EXT="dylib"
82+
fi
83+
84+
# Check the CPU architecture
85+
ARCH=$(uname -m)
86+
if [ "$ARCH" = "x86" ]; then
87+
# x86 32Bit
88+
# FILENAME="webui-${OS}-${CC}-x86"
89+
echo "Error: Linux/macOS x86 32Bit architecture is not supported yet"
90+
exit 1
91+
elif [ "$ARCH" = "x86_64" ]; then
92+
# x86 64Bit
93+
FILENAME="webui-${OS}-${CC}-x64"
94+
elif [ "$ARCH" = "arm" ]; then
95+
# ARM 32Bit
96+
FILENAME="webui-${OS}-${CC}-arm"
97+
elif [ "$ARCH" = "aarch64" ]; then
98+
# ARM 64Bit
99+
FILENAME="webui-${OS}-${CC}-arm64"
100+
else
101+
echo "Error: Unknown architecture '$ARCH'"
102+
exit 1
103+
fi
104+
105+
# Creating the temporary cache folder
106+
mkdir -p "cache/$FILENAME" 2>/dev/null
107+
108+
# Download the archive using wget
109+
wget -q "$BASE_URL$FILENAME.zip" -O "cache/$FILENAME.zip"
110+
111+
# Extract archive
112+
unzip -q "cache/$FILENAME.zip" -d "cache"
113+
114+
# Copy library
115+
mkdir -p "$FILENAME" 2>/dev/null
116+
cp -f "cache/$FILENAME/webui-2.${EXT}" "$FILENAME/webui-2.${EXT}"
117+
118+
# Remove cache folder
119+
rm -rf "cache"
120+
121+
exit 0
122+
fi

0 commit comments

Comments
 (0)