-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackager.bat
More file actions
56 lines (47 loc) · 1.51 KB
/
packager.bat
File metadata and controls
56 lines (47 loc) · 1.51 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
@echo off
REM packager.bat
setlocal
REM Define the build and package directories
if defined TEMP (
set "BUILD_DIR=%TEMP%\ryan-tools-build"
) else (
set "BUILD_DIR=%~dp0build"
)
set "PACKAGE_DIR=%~dp0dist"
set "PROJECT_BUILD_DIR=%~dp0build"
set "EGG_INFO_DIR=%~dp0ryan_functions.egg-info"
REM Navigate to the directory containing the setup.py script
cd /d "%~dp0"
REM Clean previous builds
if exist "%PACKAGE_DIR%" rmdir /s /q "%PACKAGE_DIR%"
if exist "%BUILD_DIR%" rmdir /s /q "%BUILD_DIR%"
if exist "%PROJECT_BUILD_DIR%" rmdir /s /q "%PROJECT_BUILD_DIR%"
if exist "%EGG_INFO_DIR%" rmdir /s /q "%EGG_INFO_DIR%"
mkdir "%BUILD_DIR%" >nul 2>&1
if %ERRORLEVEL% neq 0 (
echo Failed to create build directory at %BUILD_DIR%.
endlocal
goto :EOF
)
REM Install the build tool if it's not already installed
python -m pip install --upgrade build >nul 2>&1
REM Create the wheel distribution in the specified build directory
python -m build --wheel --outdir "%BUILD_DIR%"
REM Check if the build was successful
if %ERRORLEVEL% neq 0 (
echo Build failed. Please check the setup.py for errors.
endlocal
goto :EOF
)
REM Move the generated wheel file to the destination package directory
if not exist "%PACKAGE_DIR%" mkdir "%PACKAGE_DIR%"
move "%BUILD_DIR%\*.whl" "%PACKAGE_DIR%" >nul 2>&1
REM Check if the move was successful
if %ERRORLEVEL% neq 0 (
echo Failed to move the package to the destination folder.
endlocal
goto :EOF
)
echo Package created and moved to %PACKAGE_DIR% successfully.
endlocal
goto :EOF