Skip to content

Commit

Permalink
Merge pull request #1400 from DivingDuck/rm_cairosvg
Browse files Browse the repository at this point in the history
* Remove cairosvg and submodule PrintrunGTK3 from Windows build process
* Added pillow as a dependency for Windows systems
* Convert buildinstructions.txt into buildinstructions.md
* README: Add a hint for using pronsole.exe with windows terminal
  • Loading branch information
rockstorm101 committed Jan 10, 2024
2 parents 4f0a15d + b49b5b5 commit 69bed06
Show file tree
Hide file tree
Showing 10 changed files with 159 additions and 249 deletions.
70 changes: 25 additions & 45 deletions .github/workflows/buildpackage-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,74 +14,52 @@ 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:
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
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' }}
Expand All @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/pypi-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "PrintrunGTK3"]
path = PrintrunGTK3
url = https://github.com/DivingDuck/PrintrunGTK3
1 change: 0 additions & 1 deletion PrintrunGTK3
Submodule PrintrunGTK3 deleted from e26b8d
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,23 +225,25 @@ CMD
```cmd
> git clone https://github.com/kliment/Printrun.git
> cd Printrun
> git submodule update --init --recursive
> release_windows.bat
```

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
Expand Down
61 changes: 0 additions & 61 deletions VERSION

This file was deleted.

93 changes: 93 additions & 0 deletions buildinstructions.md
Original file line number Diff line number Diff line change
@@ -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 <<EOL
,
info_plist={
'NSPrincipalClass': 'NSApplication',
'NSAppleScriptEnabled': False,
'NSAppSleepDisabled': True,
},
)
EOL
pyinstaller --clean pronterface.spec -y
(optional) codesign -s identityname dist/pronterface.app --deep
```

## Setup on Windows
### Prerequisites
* install python 3.10
* install python extension compile environment, see https://wiki.python.org/moin/WindowsCompilers
* install git
### Clone the repository
```
git clone http://github.com/kliment/Printrun.git
cd Printrun
git pull
```
### Install and activate the virtual environment
```
\path\to\python3\python -m venv v3
v3\Scripts\activate
### Install and update all required libraries
pip install --upgrade pip
pip install --upgrade setuptools
pip install wheel
pip install cython
pip install -r requirements.txt
pip install simplejson
pip install pypiwin32
pip install polygon3
python setup.py build_ext --inplace
```

Please see remark for polygon3[^1]

### For running
`python pronterface.py`

### For packaging
```
pip install pyinstaller
pyi-makespec -F --add-data images/*;images --add-data *.png;. --add-data *.ico;. -w -i pronterface.ico pronterface.py
pyinstaller --clean pronterface.spec -y
```

>[!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/
59 changes: 0 additions & 59 deletions buildinstructions.txt

This file was deleted.

0 comments on commit 69bed06

Please sign in to comment.