Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install.bat and madcad.bat #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions install.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
@echo off
setlocal EnableDelayedExpansion

set arch=
set platform=windows
set prefix=

:parse_args
if "%1"=="" goto end_parse_args
if "%1"=="-a" (
shift
set arch=%1
goto next_arg
)
if "%1"=="-h" (
shift
set platform=%1
goto next_arg
)
if "%1"=="-p" (
shift
set prefix=%1
goto next_arg
)
if "%1"=="-?" (
echo build uimadcad and install it at the specified prefix path
echo.
echo usage: %~nx0 [-p PREFIX] [-a ARCH] [-h PLATFORM]
exit /b 1
)

:next_arg
shift
goto parse_args

:end_parse_args

if "%arch%"=="" (
set arch=x64
)

if "%prefix%"=="" (
for /f "delims=" %%i in ('cd') do set "prefix=%%i\dist\%platform%_%arch%"
)

set data=%prefix%
set bin=%prefix%
set binformat=.exe

rem prepare directories
if not exist "%bin%" mkdir "%bin%"
if not exist "%data%" mkdir "%data%"

rem the common directories
if not exist "%data%\themes\" mkdir "%data%\themes\"
copy /y "%~dp0uimadcad\*.py" "%data%"
copy /y "%~dp0uimadcad\themes\*.qss" "%data%\themes\"
copy /y "%~dp0uimadcad\themes\*.yaml" "%data%\themes\"

rem platform specific
copy /y "%~dp0madcad.bat" "%bin%\"

if not exist "%prefix%\icons" mkdir "%prefix%\icons"
copy /y "%~dp0icons\*.svg" "%prefix%\icons\"
copy /y "%~dp0icons\*.ico" "%prefix%\"

:end_script
11 changes: 11 additions & 0 deletions madcad.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@echo off
setlocal

rem Set PYTHONPATH to include the directory of this batch file.
set "SCRIPT_DIR=%~dp0"
set PYTHONPATH=%PYTHONPATH%;%SCRIPT_DIR%

rem Execute the Python module, passing along any command-line arguments.
python -m uimadcad %*

endlocal