make the program only a onefile executable
This commit is contained in:
parent
d99bd325ba
commit
39a3555384
4 changed files with 46 additions and 3 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -4,3 +4,5 @@ bin/
|
|||
lib/
|
||||
|
||||
pyvenv.cfg
|
||||
|
||||
na.bat
|
||||
|
|
15
Makefile
Normal file
15
Makefile
Normal file
|
@ -0,0 +1,15 @@
|
|||
ECHO = echo -e
|
||||
CAT = cat
|
||||
|
||||
HEADER = header.bat
|
||||
PYTHON = main.py
|
||||
|
||||
OUTPUT = na.bat
|
||||
|
||||
all: build
|
||||
|
||||
build:
|
||||
$(CAT) $(HEADER) > $(OUTPUT)
|
||||
$(ECHO) "\n::python_beg" >> $(OUTPUT)
|
||||
$(CAT) $(PYTHON) >> $(OUTPUT)
|
||||
$(ECHO) "::python_end" >> $(OUTPUT)
|
29
header.bat
Normal file
29
header.bat
Normal file
|
@ -0,0 +1,29 @@
|
|||
@ECHO OFF
|
||||
SETLOCAL ENABLEDELAYEDEXPANSION
|
||||
|
||||
SET "tmpFile=%TEMP%\~searchBea.py"
|
||||
|
||||
CALL :getLine "::python_beg" "::python_end" > "!tmpFile!"
|
||||
|
||||
:: Install dependencies
|
||||
python -m pip install pyautogui >NUL
|
||||
|
||||
:: Run the program
|
||||
PowerShell -Command "Start-Process cmd -Argument '/c START /B python !tmpFile!' -WindowStyle hidden"
|
||||
EXIT /B
|
||||
|
||||
:getLine <beg str> <end str>
|
||||
SET "bBegEnd=0"
|
||||
FOR /F "usebackq delims=" %%i IN ("%~f0") do (
|
||||
IF !bBegEnd! EQU 1 (
|
||||
IF "%%i" EQU "%~2" ( EXIT /B )
|
||||
SETLOCAL DISABLEDELAYEDEXPANSION
|
||||
ECHO %%i
|
||||
ENDLOCAL
|
||||
) ELSE (
|
||||
IF "%%i" EQU "%~1" ( SET "bBegEnd=1" )
|
||||
)
|
||||
)
|
||||
|
||||
ENDLOCAL
|
||||
EXIT /B
|
3
run.bat
3
run.bat
|
@ -1,3 +0,0 @@
|
|||
@ECHO OFF
|
||||
|
||||
PowerShell -Command "Start-Process cmd -Argument '/c START /B python .\main.py' -WindowStyle hidden"
|
Loading…
Reference in a new issue