-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_python.bat
More file actions
104 lines (93 loc) · 3.07 KB
/
Copy pathsetup_python.bat
File metadata and controls
104 lines (93 loc) · 3.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
@echo off
REM ============================================================================
REM Windows Build Helper for WSA WebDAV Server
REM ============================================================================
REM This script helps prepare the embedded Python for the APK on Windows.
REM For full CPython cross-compilation, use Linux or WSL.
REM ============================================================================
setlocal enabledelayedexpansion
set PROJECT_DIR=%~dp0..
set PYTHON_BUILD_DIR=%PROJECT_DIR%\python_build
set OUTPUT_DIR=%PYTHON_BUILD_DIR%\output
set ASSETS_DIR=%PROJECT_DIR%\app\src\main\assets\python
echo ============================================
echo WSA WebDAV - Embedded Python Setup
echo ============================================
echo.
REM Check for Python
python --version >nul 2>&1
if errorlevel 1 (
echo ERROR: Python not found. Please install Python 3.8+
echo Download from: https://www.python.org/downloads/
exit /b 1
)
REM Check for required tools
echo Checking prerequisites...
python -c "import urllib.request" >nul 2>&1
if errorlevel 1 (
echo ERROR: urllib not available
exit /b 1
)
echo.
echo Choose setup method:
echo 1. Download pre-built Python binaries (Recommended)
echo 2. Create minimal bootstrap (requires system Python on device)
echo 3. Build from source (requires Linux/WSL)
echo.
set /p choice="Enter choice (1-3): "
if "%choice%"=="1" (
echo.
echo Downloading pre-built Python binaries...
python "%PYTHON_BUILD_DIR%\scripts\download_python.py" --output "%OUTPUT_DIR%"
if errorlevel 1 (
echo.
echo Download failed. Trying minimal bootstrap...
python "%PYTHON_BUILD_DIR%\scripts\download_python.py" --output "%OUTPUT_DIR%" --minimal
)
) else if "%choice%"=="2" (
echo.
echo Creating minimal Python bootstrap...
python "%PYTHON_BUILD_DIR%\scripts\download_python.py" --output "%OUTPUT_DIR%" --minimal
) else if "%choice%"=="3" (
echo.
echo For source compilation, please use Linux or WSL.
echo See: python_build\README.md
echo.
echo Alternatively, run the Docker build:
echo cd %PYTHON_BUILD_DIR%
echo docker build -t cpython-android .
echo docker run -v %OUTPUT_DIR%:/output cpython-android
exit /b 0
) else (
echo Invalid choice
exit /b 1
)
REM Copy to assets
echo.
echo Copying Python to APK assets...
if exist "%ASSETS_DIR%" (
rmdir /s /q "%ASSETS_DIR%"
)
mkdir "%ASSETS_DIR%" 2>nul
if exist "%OUTPUT_DIR%\arm64-v8a" (
echo Copying arm64-v8a...
xcopy /E /I /Y "%OUTPUT_DIR%\arm64-v8a" "%ASSETS_DIR%\arm64-v8a"
)
if exist "%OUTPUT_DIR%\x86_64" (
echo Copying x86_64...
xcopy /E /I /Y "%OUTPUT_DIR%\x86_64" "%ASSETS_DIR%\x86_64"
)
echo.
echo ============================================
echo Setup Complete!
echo ============================================
echo.
echo Next steps:
echo 1. Open project in Android Studio
echo 2. Build APK: Build > Build Bundle(s) / APK(s)
echo 3. Install APK on WSA device
echo.
echo APK output will be at:
echo app\build\outputs\apk\debug\app-debug.apk
echo.
pause