diff --git a/.github/workflows/buildpackage-win.yml b/.github/workflows/buildpackage-win.yml index 616dce97c..21eb263d7 100644 --- a/.github/workflows/buildpackage-win.yml +++ b/.github/workflows/buildpackage-win.yml @@ -14,20 +14,15 @@ jobs: strategy: matrix: os: [windows-latest] - # remove x86 builds for now as there are no snapshot builds of wxPython available - #architecture: [x64, x86] - architecture: [x64] - # add python '3.10' because wxPython 4.2 is now available (2022-08-21) - # supported versions: ['3.7', '3.8', '3.9','3.10'] + # supported architecture: [x64, x86] + architecture: [x86, x64] + # supported versions: ['3.8', '3.9', '3.10', '3.11'] + # for x86 only Python 3.9 to 3.11 is supported python-version: ['3.10'] steps: - name: Checkout uses: actions/checkout@v4 - # Import submodule PrintrunGTK3 - with: - submodules: recursive - - name: Set up Python uses: actions/setup-python@v5 with: @@ -35,53 +30,36 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | - python -m pip install --upgrade pip pyinstaller setuptools wheel simplejson polygon3 cython cffi -r requirements.txt + python -m pip install --upgrade pip pyinstaller setuptools wheel simplejson polygon3 cython -r requirements.txt - # - name: Update to wxPython Version for x86 and py 3.8 - # # Latest development version for x86 and Python 3.6 is for now (2021-12-18) 4.1.2a1.dev5226+a843ed14 - # # Latest development version for x86 and Python 3.8+3.9 is for now (2022-03-17) 4.1.2a1.dev5226+a843ed14 - # # Remove Python 3.6 - # if: ${{ matrix.architecture == 'x86' && matrix.python-version == '3.8' }} - # run: | - # python -m pip install -U --pre -f https://wxpython.org/Phoenix/snapshot-builds/ wxPython==4.1.2a1.dev5226+a843ed14 - # - name: Update to wxPython Version for x86 and py 3.9 - # # Latest development version for x86 and Python 3.6 is for now (2021-12-18) 4.1.2a1.dev5226+a843ed14 - # # Latest development version for x86 and Python 3.8+3.9 is for now (2022-03-17) 4.1.2a1.dev5226+a843ed14 - # # Remove Python 3.6 - # if: ${{ matrix.architecture == 'x86' && matrix.python-version == '3.9' }} - # run: | - # python -m pip install -U --pre -f https://wxpython.org/Phoenix/snapshot-builds/ wxPython==4.1.2a1.dev5226+a843ed14 - # - # + - name: Update to wxPython latest Version for x86 + # Latest development version for x32 and Python 3.9 to 3.11, can be removed if requirements.txt is fixed + # minimum version for x86 needs to be wxPython >= 4.2.1 (2023-11-20) + if: ${{ matrix.architecture == 'x86' && matrix.python-version >= '3.9' }} + run: | + #python -m pip install -U --pre -f https://wxpython.org/Phoenix/snapshot-builds/ wxPython==4.2.2a1.dev5626+a1184286 + #python -m pip install -U --pre -f https://wxpython.org/Phoenix/snapshot-builds/ wxPython + python -m pip install -U wxPython - name: Update to wxPython latest Version for x64 - # Latest development version for x64 and Python 3.7 to 3.10, can be removed if requirements.txt is fixed - if: ${{ matrix.architecture == 'x64' && matrix.python-version >= '3.7' }} + # Latest development version for x64 and Python 3.8 to 3.11, can be removed if requirements.txt is fixed + if: ${{ matrix.architecture == 'x64' && matrix.python-version >= '3.8' }} run: | - # python -m pip install -U --pre -f https://wxpython.org/Phoenix/snapshot-builds/ wxPython + #python -m pip install -U --pre -f https://wxpython.org/Phoenix/snapshot-builds/ wxPython==4.2.2a1.dev5626+a1184286 + #python -m pip install -U --pre -f https://wxpython.org/Phoenix/snapshot-builds/ wxPython python -m pip install -U wxPython - name: Build Cython ext run: | python setup.py build_ext --inplace - # Build pyinstaller spec depending on GTK3 x32/x64 binaries or w/o GTK3 bundle - # for running Projector. The user can install the GTK3 libraries external and - # set the environment path to the installation manually if the bundle is not - # included or found (last option) via submodules - - name: Make pyinstaller spec with GTK3 x64 bundle - if: ${{ matrix.architecture == 'x64' && hashFiles('PrintrunGTK3/GTK3Windows10-64') != '' }} - run: | - pyi-makespec --hidden-import="pkg_resources.py2_warn" -F --add-binary "PrintrunGTK3/GTK3Windows10-64/*.dll;." --add-data "VERSION;cairocffi" --add-data "VERSION;cairosvg" --add-data "images/*;images" --add-data "*.png;." --add-data "*.ico;." -w -i pronterface.ico pronterface.py - - name: Make pyinstaller spec with GTK3 x32 bundle - if: ${{ matrix.architecture == 'x86' && hashFiles('PrintrunGTK3/GTK3Windows10-32') != '' }} - run: | - pyi-makespec --hidden-import="pkg_resources.py2_warn" -F --add-binary "PrintrunGTK3/GTK3Windows10-32/*.dll;." --add-data "VERSION;cairocffi" --add-data "VERSION;cairosvg" --add-data "images/*;images" --add-data "*.png;." --add-data "*.ico;." -w -i pronterface.ico pronterface.py - - name: Make pyinstaller spec without GTK3 bundle - if: ${{ hashFiles('PrintrunGTK3') == '' }} + + - name: Make pyinstaller spec run: | - pyi-makespec --hidden-import="pkg_resources.py2_warn" -F --add-data "VERSION;cairocffi" --add-data "VERSION;cairosvg" --add-data "images/*;images" --add-data "*.png;." --add-data "*.ico;." -w -i pronterface.ico pronterface.py + pyi-makespec --hidden-import="pkg_resources.py2_warn" -F --add-data "images/*;images" --add-data "*.png;." --add-data "*.ico;." -w -i pronterface.ico pronterface.py + pyi-makespec --hidden-import="pkg_resources.py2_warn" -F --add-data "images/*;images" --add-data "*.png;." --add-data "*.ico;." -c -i pronsole.ico pronsole.py - name: Make pyinstaller build run: | pyinstaller --clean pronterface.spec -y + pyinstaller --clean pronsole.spec -y - name: Configuration for releases if: ${{ github.event_name == 'release' }} @@ -102,4 +80,6 @@ jobs: uses: actions/upload-artifact@v4 with: name: ${{ env.EXE_NAME }}_windows_${{ matrix.architecture }}_py${{ matrix.python-version }} - path: dist/pronterface.exe + path: | + dist/pronterface.exe + dist/pronsole.exe diff --git a/.github/workflows/pypi-win.yml b/.github/workflows/pypi-win.yml index 597fddf73..31a4874e9 100644 --- a/.github/workflows/pypi-win.yml +++ b/.github/workflows/pypi-win.yml @@ -15,7 +15,7 @@ jobs: matrix: os: [windows-latest] architecture: [x64, x86] - python-version: ["3.7", "3.8", "3.9", "3.10"] + python-version: ["3.8", "3.9", "3.10", "3.11"] steps: - name: Checkout diff --git a/.gitmodules b/.gitmodules index 7296a6536..e69de29bb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "PrintrunGTK3"] - path = PrintrunGTK3 - url = https://github.com/DivingDuck/PrintrunGTK3 diff --git a/PrintrunGTK3 b/PrintrunGTK3 deleted file mode 160000 index e26b8dd02..000000000 --- a/PrintrunGTK3 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e26b8dd02213e8960c6662330c764cc755cce5df diff --git a/README.md b/README.md index cc25be38c..76a3a4a86 100644 --- a/README.md +++ b/README.md @@ -225,7 +225,6 @@ CMD ```cmd > git clone https://github.com/kliment/Printrun.git > cd Printrun -> git submodule update --init --recursive > release_windows.bat ``` @@ -233,15 +232,18 @@ PowerShell: ```ps > git clone https://github.com/kliment/Printrun.git > cd Printrun -> git submodule update --init --recursive > ./release_windows.bat ``` -The script above will clone this repository and the submodule PrintrunGTK3. The script 'release_windows.bat' will install a virtual environment named v3, download all needed python libraries and compile the binaries for Pronterface.exe and Pronsole.exe. -You will find the files in the new created directory 'dist'. You will find further and more detailed information in the script release_windows.bat. Further information for the linked submodul: [PrintrunGTK3](https://github.com/DivingDuck/PrintrunGTK3) +The script above will clone this repository. The script `release_windows.bat` will install a virtual environment named v3, download all needed python libraries and compile the binaries for Pronterface.exe and Pronsole.exe. +You will find the files in the new created directory `dist`. You will find further and more detailed information in the script `release_windows.bat`. Run Pronterface or Pronsole from the binary files or from source calling pronterface.py for the GUI version and pronsole.py for the commandline version. -Run 'release_windows.bat' when ever you make changes or updates. With each new run it will compile the binaries and update all involved libraries in the virtual environment if needed. Delete the virtual environment if you have problems with it. Use 'git submodule update --init --recursive' for updating the submodule +Running Pronsole works best by running it in WindowsTerminal. You can create a desktop shortcut link to the file pronsole.exe. Then edit the target for your shortcut as shown in belows example: +`%LocalAppData%\Microsoft\WindowsApps\wt.exe --title Pronsole %USERPROFILE%\Downloads\pronterface-test\pronsole.exe` +You need to adjust the path to your location of pronsole.exe. + +Run 'release_windows.bat' when ever you make changes or updates. With each new run it will compile the binaries and update all involved libraries in the virtual environment if needed. Delete the virtual environment if you have problems with it. # USING PRINTRUN diff --git a/VERSION b/VERSION deleted file mode 100644 index 3bde0d44e..000000000 --- a/VERSION +++ /dev/null @@ -1,61 +0,0 @@ -This is a dummy file for pyinstaller to compile Pronterface.Cairocffi and cairosvg won't find -the GTK3 runtime libraries needed for running Projector under Windows w / o this file. - -You can find a suitable version of GTK3 for Windows 10 here : https://github.com/DivingDuck/PrintrunGTK3. -For further information please follow the links.PrintrunGTK3 is a submodule of Printrun. - -The DLL binaries are based on https ://github.com/tschoonj/GTK-for-Windows-Runtime-Environment-Installer -for 64 Bit version and http ://www.tarnyko.net/dl/gtk.htm for 32 Bit version and are not modified. - - Please run following git commands in case you can't find the directory 'PrintrunGTK' in your repository: - git checkout master - git submodule add https ://github.com/DivingDuck/PrintrunGTK3 -git submodule update --init --recursive - -For updating an existing submodule to latest version run : -git submodule update --remote - -Compiling Pronterface manually : -Follow the instructions in release_windows.bat and activate the correct pyi - makespec version depending on your needs. - - -List of DLL's for Projector based on Windows 10 for 64bit program version: --------------------------------------------------------------------------- -https ://github.com/tschoonj/GTK-for-Windows-Runtime-Environment-Installer - https ://github.com/tschoonj/GTK-for-Windows-Runtime-Environment-Installer/releases/download/2021-01-30/gtk3-runtime-3.24.24-2021-01-30-ts-win64.exe - - libbrotlicommon.dll - libbrotlidec.dll - libbz2 - 1.dll - libcairo - 2.dll - libexpat - 1.dll - libfontconfig - 1.dll - libfreetype - 6.dll - libgcc_s_seh - 1.dll - libglib - 2.0 - 0.dll - libgraphite2.dll - libharfbuzz - 0.dll - libiconv - 2.dll - libintl - 8.dll - libpcre - 1.dll - libpixman - 1 - 0.dll - libpng16 - 16.dll - libstdc++ - 6.dll - libwinpthread - 1.dll - zlib1.dll - - - List of DLL's for Projector based on Windows 10 for 32bit program version: - -------------------------------------------------------------------------- - http ://www.tarnyko.net/dl/gtk.htm -http://www.tarnyko.net/repo/gtk3_build_system/gtk+-bundle_3.6.4-20130513_win32.zip - -File list : -libcairo - 2.dll -libexpat - 1.dll -libfontconfig - 1.dll -libfreetype - 6.dll -libpixman - 1 - 0.dll -libpng15 - 15.dll -Remark.txt -zlib1.dll \ No newline at end of file diff --git a/buildinstructions.md b/buildinstructions.md new file mode 100644 index 000000000..43c085761 --- /dev/null +++ b/buildinstructions.md @@ -0,0 +1,93 @@ +# Build instructions +In general please follow the build instructions as described in [README.md](README.md). Here you will find a brief overview about what is needed to build your own development environment without further explanations. +## Setup on OS X +### Prerequisites +* install python 3.10 +* install python extension compile environment, this is automatically done if you have xcode +* install git +### Clone the repository +``` +git clone http://github.com/kliment/Printrun.git +cd Printrun +git pull +``` +### Install and activate the virtual environment +``` +python3 -m venv v3 +. ./v3/bin/activate +``` +### Install and update all required libraries +``` +pip install --upgrade pip +pip install --upgrade setuptools +pip install -r requirements.txt +pip install cython +python setup.py build_ext --inplace +``` + +### For running +`python pronterface.py` + +### For packaging +``` +pip install pyinstaller +pyi-makespec --hidden-import="pkg_resources.py2_warn" -F --add-data images/\*:images --add-data \*.png:. --add-data \*.ico:. -w -i P-face.icns pronterface.py +rm -rf dist +sed -i '' '$ s/.$//' pronterface.spec +cat >> pronterface.spec <[!TIP] Please find further informations about building a development environment and packaging in script [release_windows.bat](release_windows.bat) where we implemented an automated build for windows. + +### Remark: +>[^1]: The library **polygon3** is free for non commercial use. You can build Pronterface without this library - but then it will run slower. +>Please find further details regarding license here: https://pypi.org/project/Polygon3/ diff --git a/buildinstructions.txt b/buildinstructions.txt deleted file mode 100644 index 79f3fba71..000000000 --- a/buildinstructions.txt +++ /dev/null @@ -1,59 +0,0 @@ -setup on osx: -(install python 3.6) -(install python extension compile environment, this is automagically done if you have xcode) -(install git) -git clone http://github.com/kliment/Printrun.git -cd Printrun -git pull -python3 -m venv v3 -. ./v3/bin/activate -pip install --upgrade pip -pip install --upgrade setuptools -pip install cffi -pip install -r requirements.txt -pip install cython -python setup.py build_ext --inplace - -for running: -python pronterface.py - -for packaging: -pip install pyinstaller -pyi-makespec --hidden-import="pkg_resources.py2_warn" -F --add-data images/\*:images --add-data \*.png:. --add-data \*.ico:. -w -i P-face.icns pronterface.py -rm -rf dist -sed -i '' '$ s/.$//' pronterface.spec -cat >> pronterface.spec <= 4.2 and with this version only - rem Python x64 versions are supported. + rem Minimum version for wxPython is >= 4.2.1. With this version + rem Python x64 (version 3.7 up to 3.11) and + rem Python x86 (version 3.9 up to 3.11) is supported. rem py -3.7 -m venv v3 rem py -3.8 -m venv v3 + rem py -3.9-32 -m venv v3 rem py -3.9 -m venv v3 + rem py -3.10-32 -m venv v3 py -3.10 -m venv v3 + rem py -3.11-32 -m venv v3 + rem py -3.11 -m venv v3 echo ********************************************* echo ****** Activate virtual environment v3 ****** @@ -120,9 +109,9 @@ echo ****** upgrade virtual environment v3 ****** echo ******************************************** pip install --upgrade virtualenv -echo **************************************************** -echo ****** check for and update outdated modules ****** -echo **************************************************** +echo ******************************************************** +echo ****** check for outdated modules and update them ****** +echo ******************************************************** for /F "skip=2 delims= " %%i in ('pip list --outdated') do py -m pip install --upgrade %%i @@ -133,21 +122,18 @@ rem # 2022-11-01 pip uninstall pyglet -y pip install pyglet==1.5.27 - -echo ***************************************************************************** -echo ****** cairosvg workaround, needs to be below 2.6.0 (isn't compatible) ****** -echo ***************************************************************************** -rem # 2023-01-30 -rem cairosvg >=2.6.0 generate a crash problem with locale in module projectlayer.py (Projector), -rem so we will stay to 2.5.2 as workaround for now -pip uninstall cairosvg -y -pip install cairosvg==2.5.2 - +echo ************************************************************************** +echo ****** pillow workaround, needs to be below 10.0 (isn't compatible) ****** +echo ************************************************************************** +rem # 2023-12-15 +rem building wxPython 4.2.1 for x86 needs pillow <10.0 +pip uninstall pillow -y +pip install pillow==9.5.0 echo ****************************************************************** -echo ****** Compile G-Code parser gcoder_line.cp??-win_amd64.pyd ****** +echo ****** Compile G-Code parser gcoder_line.cp??-win_amd??.pyd ****** echo ****************************************************************** -rem For safety reasons delete existing version first to prevent errors +rem Delete existing versions first to prevent errors and incompatibilities if exist printrun\gcoder_line.cp??-win_amd??.pyd ( del printrun\gcoder_line.cp??-win_amd??.pyd echo ******************************************************************************** @@ -160,36 +146,10 @@ echo **************************************** echo ****** Collect all data for build ****** echo **************************************** -rem **** Select which version you want to build: **** -rem The Projector feature of Pronterface need some external DLL binaries from the GTK3. -rem You can build Pronterface with or w/o these binaries. In addition you need -rem different binaries depending if you build a Windows 10 x32 or x64 version. -rem Remove 'rem' before pyi-makespec for the build of your choice and add 'rem' -rem for all other versions. You can't bundle x32 and x46 into the same Pronterface binary file. -rem Only one active version is allowed. - -rem **** Default setup: Version 3, GTK3 bundle included for Windows 10 x64 bit. **** - -rem Version 1: With external GTK3 or w/o GTK3 support: -rem Choose this pyi-makespec in case you don't have the GTK3 Toolkit files, or want them stay separately -rem or don't want to bundle these within Pronterface.exe. You can install them separately and -rem set the path location via Windows system environment variable (like Path=c:\GTK3\bin). - -rem pyi-makespec -F --add-data VERSION;cairocffi --add-data VERSION;cairosvg --add-data images/*;images --add-data *.png;. --add-data *.ico;. -w -i pronterface.ico pronterface.py -rem pyi-makespec -F --add-data VERSION;cairocffi --add-data VERSION;cairosvg --add-data images/*;images --add-data *.png;. --add-data *.ico;. -c -i pronsole.ico pronsole.py - -rem Version 2: GTK3 included in Pronterface (Windows10 x32 only) NOT Supported for now (see wxPython remark line 51): -rem Choose this pyi-makespec in case you want to include the GTK3 Toolkit files for Windows10 x32 only - -rem pyi-makespec -F --add-binary PrintrunGTK3/GTK3Windows10-32/*.dll;. --add-data VERSION;cairocffi --add-data VERSION;cairosvg --add-data images/*;images --add-data *.png;. --add-data *.ico;. -w -i pronterface.ico pronterface.py -rem pyi-makespec -F --add-binary PrintrunGTK3/GTK3Windows10-32/*.dll;. --add-data VERSION;cairocffi --add-data VERSION;cairosvg --add-data images/*;images --add-data *.png;. --add-data *.ico;. -c -i pronsole.ico pronsole.py - -rem Version 3: GTK3 included in Pronterface (Windows10 x64 only): -rem Choose this pyi-makespec in case you want to include the GTK3 Toolkit files for Windows10 x64 only - -pyi-makespec -F --add-binary PrintrunGTK3/GTK3Windows10-64/*.dll;. --add-data VERSION;cairocffi --add-data VERSION;cairosvg --add-data images/*;images --add-data *.png;. --add-data *.ico;. -w -i pronterface.ico pronterface.py -pyi-makespec -F --add-binary PrintrunGTK3/GTK3Windows10-64/*.dll;. --add-data VERSION;cairocffi --add-data VERSION;cairosvg --add-data images/*;images --add-data *.png;. --add-data *.ico;. -c -i pronsole.ico pronsole.py -pyi-makespec -F --add-binary PrintrunGTK3/GTK3Windows10-64/*.dll;. --add-data VERSION;cairocffi --add-data VERSION;cairosvg --add-data images/*;images --add-data *.png;. --add-data *.ico;. -w -i plater.ico plater.py +pyi-makespec -F --add-data images/*;images --add-data *.png;. --add-data *.ico;. -w -i pronterface.ico pronterface.py +pyi-makespec -F --add-data images/*;images --add-data *.png;. --add-data *.ico;. -c -i pronsole.ico pronsole.py +rem Plater stand alone application is experimental only (See remark). +pyi-makespec -F --add-data images/*;images --add-data *.png;. --add-data *.ico;. -w -i plater.ico plater.py echo *************************************************************** echo ****** Build Pronterface, Pronsole and Plater executables ***** @@ -202,6 +162,7 @@ echo ** Build Pronsole executable ** pyinstaller --clean pronsole.spec -y echo echo ** Build Plater executable ** +rem Plater stand alone application is experimental only (See remark). pyinstaller --clean plater.spec -y diff --git a/requirements.txt b/requirements.txt index d57e6f424..67acb3ac3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,10 +1,8 @@ pyserial (>= 3.0) +pillow < 10.0; sys_platform == 'win32' wxPython >= 4.2.0 numpy (>= 1.8.2) pyglet >= 1.1, < 2.0 -cffi -cairocffi -cairosvg >= 1.0.9, < 2.6.0 psutil (>= 2.1) lxml (>= 2.9.1) appdirs (>= 1.4.0)