Skip to content

Commit

Permalink
Update gui_setup.sh: Can install and use Python 3.12.7 locally now
Browse files Browse the repository at this point in the history
  • Loading branch information
niklases committed Oct 19, 2024
1 parent fdf99cb commit 7a04298
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 25 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ dist/
*.egg
workflow/.ipynb_checkpoints/
.idea/
Python3127/*
python-3.12.7-amd64.exe
run_pypef_gui.bat

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
11 changes: 7 additions & 4 deletions gui/qt_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@
# https://stackoverflow.com/questions/67297494/redirect-console-output-to-pyqt5-gui-in-real-time
# sudo apt-get install -y libxcb-cursor-dev
pypef_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
with open(os.path.join(pypef_root, 'pypef', '__init__.py')) as fh:
for line in fh:
if line.startswith('__version__'):
version = re.findall(r"[-+]?(?:\d*\.*\d.*\d+)", line)[0]
#os.environ["PATH"] += os.pathsep + pypef_root
try:
with open(os.path.join(pypef_root, 'pypef', '__init__.py')) as fh:
for line in fh:
if line.startswith('__version__'):
version = re.findall(r"[-+]?(?:\d*\.*\d.*\d+)", line)[0]
except FileNotFoundError:
version = "Unknown"


class MainWindow(QtWidgets.QWidget):
Expand Down
34 changes: 30 additions & 4 deletions gui_setup.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
@echo off
echo Installing PyPEF...

set "python_exe=python"

set /P AREYOUSURE=Install and use local Python version (Y/[N]) (downloads Python installer and installs Python locally in the current working directory)?
if /I "%AREYOUSURE%" NEQ "Y" if /I "%AREYOUSURE%" NEQ "y" goto NO_PYTHON

echo Installing Python...
powershell -Command "$ProgressPreference = 'SilentlyContinue';Invoke-WebRequest https://www.python.org/ftp/python/3.12.7/python-3.12.7-amd64.exe -OutFile python-3.12.7-amd64.exe"

.\python-3.12.7-amd64.exe /quiet TargetDir="%~dp0Python3127" Include_pip=1 Include_test=0 AssociateFiles=1 PrependPath=0 CompileAll=1 InstallAllUsers=0

REM Not removing Python installer EXE as it can be used for easy uninstall/repair
REM del /Q python-3.12.7-amd64.exe

set "python_exe=.\Python3127\python.exe"


:NO_PYTHON

(
echo:
Expand All @@ -13,10 +33,16 @@
echo run_main^(^)
) > run.py

powershell -Command "python -m pip install -U pypef pyside6"
powershell -Command "%python_exe% -m pip install -U pypef pyside6"

echo powershell -Command ^"python gui/qt_window.py^" > run_pypef_gui.bat
echo start /min cmd /c powershell -Command ^"%python_exe% gui/qt_window.py^" > run_pypef_gui.bat

echo Created file run_pypef_gui.bat for future GUI starting.
echo Finished installation...
echo +++ Created file +++
echo +++ run_pypef_gui.bat +++
echo +++ for future GUI starting +++
echo You can close this window now.

.\run_pypef_gui
REM call .\run_pypef_gui.bat
start cmd /c ".\run_pypef_gui.bat"
cmd /k
2 changes: 1 addition & 1 deletion gui_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ python gui/qt_window.py
printf "Created file run_pypef_gui.sh for future GUI starting."

chmod a+x ./run_pypef_gui.sh
./run_pypef_gui.sh
./run_pypef_gui.sh && exit
16 changes: 0 additions & 16 deletions requirements_dev.txt

This file was deleted.

2 changes: 2 additions & 0 deletions run_pypef_gui.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
python gui/qt_window.py

0 comments on commit 7a04298

Please sign in to comment.