Skip to content

Commit

Permalink
Remove cairosvg from windows build. Since kliment#1387 we use wxPytho…
Browse files Browse the repository at this point in the history
…n.svg. cairosvg, cffi and cairocffi not longer needed for projectlayer.py and became obsolete.
  • Loading branch information
DivingDuck committed Nov 21, 2023
1 parent ef96f01 commit 556fe07
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 64 deletions.
63 changes: 23 additions & 40 deletions .github/workflows/buildpackage-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,71 +14,54 @@ jobs:
strategy:
matrix:
os: [windows-latest]
# remove x86 builds for now as there are no snapshot builds of wxPython available
#architecture: [x64, x86]
# supported 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']
python-version: ['3.10']

steps:
- name: Checkout
uses: actions/checkout@v4
# Import submodule PrintrunGTK3
with:
submodules: recursive

# # Import submodule PrintrunGTK3
# with #1387 no longer needed 2023-11-20
# with:
# submodules: recursive
#
- name: Set up Python
uses: actions/setup-python@v4
with:
architecture: ${{ matrix.architecture }}
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
# remove cffi too
#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.7 to 3.10, 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.7' }}
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' }}
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 "VERSION;cairocffi" --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
- name: Make pyinstaller build
run: |
pyinstaller --clean pronterface.spec -y
Expand Down
6 changes: 4 additions & 2 deletions VERSION
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
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.
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.
Update 2023-11-13: With introducing merge #1387 https ://github.com/kliment/Printrun/pull/1387
cairosvg is no loger needed. We use wx.svg instead.

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.
Expand Down
7 changes: 4 additions & 3 deletions buildinstructions.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
setup on osx:
(install python 3.6)
(install python extension compile environment, this is automagically done if you have xcode)
(install python 3.10)
(install python extension compile environment, this is automatically done if you have xcode)
(install git)
git clone http://github.com/kliment/Printrun.git
cd Printrun
Expand Down Expand Up @@ -35,11 +35,12 @@ pyinstaller --clean pronterface.spec -y
(optional) codesign -s identityname dist/pronterface.app --deep

setup on windows:
(install python 3.6)
(install python 3.10)
(install python extension compile environment, see https://wiki.python.org/moin/WindowsCompilers )
(install git)
git clone http://github.com/kliment/Printrun.git
cd Printrun
git submodule update --init --recursive
git pull
\path\to\python3\python -m venv v3
v3\Scripts\activate
Expand Down
46 changes: 30 additions & 16 deletions release_windows.bat
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ rem **
rem ** 1. Install python 64-bit (3.10.x is actually preferred and standard version **
rem ** for Windows 10) **
rem ** https://www.python.org/downloads/release **
rem ** In case you use an other Python version, check line 91 and adjust **
rem ** In case you use an other Python version, check line 88 to 92 and adjust **
rem ** the parameter accordingly to build your virtual environment. **
rem ** 2. Install C-compiler environment **
rem ** https://wiki.python.org/moin/WindowsCompilers **
Expand Down Expand Up @@ -56,7 +56,7 @@ rem **
rem ** https://github.com/wxWidgets/Phoenix/commit/d3bdb14365ca754e83732cccd04e94a2ded5029f
rem ** **
rem ** **
rem ** Author: DivingDuck, 2023-02-02, Status: working **
rem ** Author: DivingDuck, 2023-11-13, Status: working **
rem ** **
rem ************************************************************************************
rem ************************************************************************************
Expand Down Expand Up @@ -89,6 +89,7 @@ if exist v3 (
rem py -3.8 -m venv v3
rem py -3.9 -m venv v3
py -3.10 -m venv v3
rem py -3.11 -m venv v3

echo *********************************************
echo ****** Activate virtual environment v3 ******
Expand Down Expand Up @@ -134,18 +135,19 @@ 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 echo *****************************************************************************
rem echo ****** cairosvg workaround, needs to be below 2.6.0 (isn't compatible) ******
rem 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
rem # 2023-11-13 cairosvg is no longer needed. We now use wx.svg.
rem pip uninstall cairosvg -y
rem pip install cairosvg==2.5.2


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
if exist printrun\gcoder_line.cp??-win_amd??.pyd (
Expand All @@ -165,7 +167,7 @@ rem The Projector feature of Pronterface need some external DLL binaries from th
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 for all other versions. You can't bundle x32 and x64 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. ****
Expand All @@ -175,21 +177,33 @@ rem Choose this pyi-makespec in case you don't have the GTK3 Toolkit files, or w
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 pyi-makespec -F --add-data VERSION;cairocffi --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 images/*;images --add-data *.png;. --add-data *.ico;. -c -i pronsole.ico pronsole.py
rem pyi-makespec -F --add-data VERSION;cairocffi --add-data images/*;images --add-data *.png;. --add-data *.ico;. -w -i plater.ico plater.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 pyi-makespec -F --add-binary PrintrunGTK3/GTK3Windows10-32/*.dll;. --add-data VERSION;cairocffi --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 images/*;images --add-data *.png;. --add-data *.ico;. -c -i pronsole.ico pronsole.py
rem pyi-makespec -F --add-binary PrintrunGTK3/GTK3Windows10-32/*.dll;. --add-data VERSION;cairocffi --add-data images/*;images --add-data *.png;. --add-data *.ico;. -w -i plater.ico plater.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
rem do we need GTK any longer?
rem pyi-makespec -F --add-binary PrintrunGTK3/GTK3Windows10-64/*.dll;. --add-data VERSION;cairocffi --add-data images/*;images --add-data *.png;. --add-data *.ico;. -w -i pronterface.ico pronterface.py
rem pyi-makespec -F --add-binary PrintrunGTK3/GTK3Windows10-64/*.dll;. --add-data VERSION;cairocffi --add-data images/*;images --add-data *.png;. --add-data *.ico;. -c -i pronsole.ico pronsole.py
rem pyi-makespec -F --add-binary PrintrunGTK3/GTK3Windows10-64/*.dll;. --add-data VERSION;cairocffi --add-data images/*;images --add-data *.png;. --add-data *.ico;. -w -i plater.ico plater.py
rem test w/o GTK
rem do we need cairocffi any longer?
rem pyi-makespec -F --add-data VERSION;cairocffi --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 images/*;images --add-data *.png;. --add-data *.ico;. -c -i pronsole.ico pronsole.py
rem pyi-makespec -F --add-data VERSION;cairocffi --add-data images/*;images --add-data *.png;. --add-data *.ico;. -w -i plater.ico plater.py
rem test w/o GTK and cairocffi
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
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 *****
Expand Down
7 changes: 4 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ pyserial (>= 3.0)
wxPython >= 4.2.0
numpy (>= 1.8.2)
pyglet >= 1.1, < 2.0
cffi
cairocffi
cairosvg >= 1.0.9, < 2.6.0
# remove because of #1387
#cffi
#cairocffi
#cairosvg >= 1.0.9, < 2.6.0
psutil (>= 2.1)
lxml (>= 2.9.1)
appdirs (>= 1.4.0)
Expand Down

0 comments on commit 556fe07

Please sign in to comment.