Skip to content

Commit 3d16d49

Browse files
authored
Development Upgrades (#1)
* Add updateDataType * Update Nodz to latest, which have support for PySide6 * Update Readme and requirements, with some comments on .spec * Add logger * Setup github workflow for build on windows and linux
1 parent 2f97f1c commit 3d16d49

File tree

7 files changed

+338
-55
lines changed

7 files changed

+338
-55
lines changed

.github/workflows/build-template.yml

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
name: Build Template (Windows + Linux) (PyInstaller Packages)
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
is_release:
7+
required: false
8+
type: boolean
9+
default: false
10+
release_tag:
11+
required: false
12+
type: string
13+
default: ""
14+
15+
jobs:
16+
build-windows:
17+
name: Build on Windows (PyInstaller EXE)
18+
runs-on: windows-latest # Use GitHub-hosted Windows runner
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
with:
23+
submodules: recursive
24+
fetch-depth: 0 # Needed for git history, versioning, and submodules
25+
26+
- name: Download latest Graphviz Windows ZIP from GitLab
27+
run: |
28+
$release = (Invoke-RestMethod -Uri "https://gitlab.com/api/v4/projects/4207231/releases")[0]
29+
$version = $release.tag_name
30+
Write-Host "Latest version: $version"
31+
$url = "https://gitlab.com/api/v4/projects/4207231/packages/generic/graphviz-releases/$version/windows_10_cmake_Release_Graphviz-$version-win64.zip"
32+
Write-Host "Downloading from: $url"
33+
Invoke-WebRequest $url -OutFile graphviz.zip
34+
Expand-Archive graphviz.zip -DestinationPath "$env:GITHUB_WORKSPACE\graphviz"
35+
Get-ChildItem "$env:GITHUB_WORKSPACE\graphviz" -Recurse -Directory
36+
echo "GRAPHVIZ_ROOT=$env:GITHUB_WORKSPACE\graphviz\Graphviz-$version-win64" >> $env:GITHUB_ENV
37+
echo "$env:GITHUB_WORKSPACE\graphviz\Graphviz-$version-win64\bin" >> $env:GITHUB_PATH
38+
Write-Host $GRAPHVIZ_ROOT
39+
Write-Host $env:GRAPHVIZ_ROOT
40+
shell: powershell
41+
42+
- name: Setup Python
43+
uses: actions/setup-python@v4
44+
with:
45+
python-version: '3.11'
46+
47+
- name: Install PyGraphviz
48+
run: |
49+
Get-ChildItem "$env:GRAPHVIZ_ROOT" -Recurse -Directory
50+
51+
$includePath="$env:GRAPHVIZ_ROOT\include"
52+
$libPath="$env:GRAPHVIZ_ROOT\lib"
53+
54+
Write-Host "Using Graphviz include: $includePath"
55+
Write-Host "Using Graphviz lib: $libPath"
56+
57+
$env:INCLUDE=$includePath
58+
$env:LIB=$libPath
59+
60+
Write-Host "Using INCLUDE: $env:INCLUDE"
61+
Write-Host "Using LIB: $env:LIB"
62+
63+
python -m pip install --upgrade pip
64+
pip install pygraphviz
65+
shell: powershell
66+
67+
- name: Install dependencies
68+
run: |
69+
python -m pip install --upgrade pip
70+
pip install -r requirements.txt
71+
pip install pyinstaller pyinstaller-versionfile
72+
shell: powershell
73+
74+
- name: Set dynamic version
75+
run: |
76+
$branch = "${env:GITHUB_HEAD_REF}"
77+
if (-not $branch) { $branch = "${env:GITHUB_REF}" -replace 'refs/heads/', '' }
78+
$commit = (git rev-parse --short HEAD).Trim()
79+
$version = "$branch-$commit"
80+
echo $version > $env:GITHUB_WORKSPACE\VERSION
81+
shell: powershell
82+
83+
- name: Build EXE with PyInstaller
84+
run: |
85+
pyinstaller $env:GITHUB_WORKSPACE\.spec --noconfirm
86+
shell: powershell
87+
88+
- name: Rename artifact if release
89+
if: inputs.is_release
90+
run: |
91+
Rename-Item -Path dist/PlumberManager.exe -NewName "PlumberManager-${{ inputs.release_tag }}-windows.exe"
92+
93+
- name: Upload artifact
94+
uses: actions/upload-artifact@v4
95+
with:
96+
name: PlumberManager-Windows
97+
path: dist/PlumberManager*.exe
98+
99+
build-linux:
100+
name: Build on Linux (PyInstaller AppImage)
101+
runs-on: ubuntu-latest # Ubuntu runner, will use Rocky Linux container
102+
container:
103+
image: rockylinux:8 # Use Rocky Linux 8 for broad compatibility
104+
steps:
105+
106+
- name: Install build tools
107+
run: |
108+
dnf install -y dnf-plugins-core
109+
dnf install -y epel-release
110+
dnf config-manager --set-enabled devel
111+
dnf install -y git file
112+
dnf install -y python3.11 python3.11-pip python3.11-devel
113+
dnf install -y graphviz graphviz-devel
114+
dnf install -y gcc gcc-c++
115+
dnf install -y libxkbcommon libxkbcommon-x11 xcb-util-wm libglvnd-egl
116+
dnf install -y xcb-util-keysyms xcb-util-renderutil vulkan-loader
117+
dnf install -y xcb-util-cursor libglvnd libglvnd-glx xcb-util-image
118+
dnf install -y mesa-libGL gtk3 cairo-gobject gdk-pixbuf2 libatomic
119+
120+
- name: Checkout code
121+
uses: actions/checkout@v4
122+
with:
123+
submodules: recursive
124+
fetch-depth: 0 # Needed for git history, versioning, and submodules
125+
126+
- name: Install Python dependencies
127+
run: |
128+
python3.11 -m pip install --upgrade pip
129+
python3.11 -m pip install -r requirements.txt
130+
python3.11 -m pip install pyinstaller pyinstaller-versionfile
131+
shell: bash
132+
133+
- name: Set dynamic version
134+
run: |
135+
branch="${GITHUB_HEAD_REF:-${GITHUB_REF##*/}}"
136+
commit="${GITHUB_SHA:0:7}"
137+
version="$branch-$commit"
138+
echo "$version" > $GITHUB_WORKSPACE/VERSION
139+
shell: bash
140+
141+
- name: Build Linux binary with PyInstaller
142+
run: |
143+
cd $GITHUB_WORKSPACE
144+
python3.11 -m PyInstaller $GITHUB_WORKSPACE/.spec --noconfirm
145+
echo "Current dir: $(pwd)"
146+
ls -R
147+
shell: bash
148+
149+
- name: Rename binaries for release
150+
if: inputs.is_release
151+
run: |
152+
mv dist/PlumberManager PlumberManager-${{ inputs.release_tag }}-rocky8
153+
154+
- uses: actions/upload-artifact@v4
155+
with:
156+
name: Upload Linux artifact PlumberManager-Linux-ELF
157+
path: dist/PlumberManager*
158+
159+
- name: Package as AppImage
160+
run: |
161+
dnf install -y file
162+
cd $GITHUB_WORKSPACE
163+
curl -Lo appimagetool https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
164+
chmod +x appimagetool
165+
mkdir -p AppDir/usr/bin
166+
cp -r dist/PlumberManager* AppDir/usr/bin/
167+
chmod -R +x AppDir/usr/bin
168+
ln -s usr/bin/PlumberManager AppDir/AppRun
169+
cp "$GITHUB_WORKSPACE/resources/icon_256.png" AppDir/plumbermanager.png
170+
cat > AppDir/plumbermanager.desktop <<EOF
171+
[Desktop Entry]
172+
Type=Application
173+
Name=PlumberManager
174+
Exec=PlumberManager
175+
Icon=plumbermanager
176+
Categories=Utility
177+
EOF
178+
./appimagetool --appimage-extract-and-run AppDir PlumberManager-x86_64.AppImage
179+
echo "Current dir: $(pwd)"
180+
ls -R
181+
shell: bash
182+
183+
- name: Rename binaries for release
184+
if: inputs.is_release
185+
run: |
186+
mv PlumberManager-x86_64.AppImage PlumberManager-${{ inputs.release_tag }}-linux.AppImage
187+
188+
- uses: actions/upload-artifact@v4
189+
with:
190+
name: Upload Linux artifact PlumberManager-Linux-AppImage
191+
path: PlumberManager*.AppImage

.github/workflows/build.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: CI Build and Release
2+
3+
on:
4+
pull_request:
5+
branches: [ master ]
6+
push:
7+
branches: [ master ]
8+
release:
9+
types: [created]
10+
11+
jobs:
12+
build:
13+
uses: ./.github/workflows/build-template.yml
14+
with:
15+
is_release: ${{ github.event_name == 'release' }}
16+
release_tag: ${{ github.event.release.tag_name }}

.spec

Lines changed: 49 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,53 +3,84 @@
33
block_cipher = None
44

55
import os
6+
import re
7+
import sys
8+
import Qt
69
import inspect
10+
import requests
11+
import datetime
12+
import packaging
13+
import reportlab
14+
import qdarkstyle
715
import pyinstaller_versionfile
816
from PyInstaller.utils.hooks import collect_submodules
917

10-
import Nodz
11-
import PySide2
12-
import shiboken2
13-
14-
# To collect all Nodz files we need to collect them manually
15-
Nodz_location = os.path.dirname(Nodz.__file__)
16-
1718
PROJECT_DIR = os.path.dirname(os.path.abspath(
1819
inspect.getfile(inspect.currentframe()))
1920
)
2021
with open(os.path.join(PROJECT_DIR, 'VERSION'), 'r') as file:
2122
VERSION = file.read()
2223

24+
if not re.match(r"^\d+\.\d+\.\d+\.\d+$", VERSION):
25+
VERSION = "0.0.0.0"
26+
2327
pyinstaller_versionfile.create_versionfile(
2428
output_file="versionfile.txt",
2529
version=VERSION,
2630
company_name="HasielHassan",
2731
file_description="Plumber Manager",
2832
internal_name="Plumber Manager",
29-
legal_copyright="© Hasiel Alvarez 2023",
33+
legal_copyright="© Hasiel Alvarez {}".format(datetime.datetime.now().year),
3034
original_filename="PlumberManager.exe",
3135
product_name="Plumber Manager",
3236
)
37+
all_hidden_imports = []
38+
39+
all_hidden_imports += collect_submodules('PySide6.QtSvg')
40+
41+
# To collect all files from certain packages we need to collect them manually
42+
requests_location = os.path.dirname(requests.__file__)
43+
reportlab_location = os.path.dirname(reportlab.__file__)
44+
packaging_location = os.path.dirname(packaging.__file__)
45+
qdarkstyle_location = os.path.dirname(qdarkstyle.__file__)
46+
Qt_location = Qt.__file__
47+
48+
all_hidden_imports += collect_submodules('pygraphviz')
49+
all_hidden_imports += collect_submodules('qtsass')
3350

34-
hiddenimports_QtSvg = collect_submodules('PySide2.QtSvg')
35-
all_hidden_imports = hiddenimports_QtSvg
51+
binaries = []
52+
if sys.platform == "win32":
53+
graphviz_root = os.environ.get(
54+
"GRAPHVIZ_ROOT", "C:\\Program Files\\Graphviz"
55+
)
56+
binaries.extend(
57+
[
58+
(os.path.join(graphviz_root, "bin", "gvc.dll"), "."),
59+
(os.path.join(graphviz_root, "bin", "cgraph.dll"), "."),
60+
(os.path.join(graphviz_root, "bin", "cdt.dll"), "."),
61+
(os.path.join(graphviz_root, "bin", "pathplan.dll"), "."),
62+
(os.path.join(graphviz_root, "bin", "gvplugin_core.dll"), "."),
63+
(os.path.join(graphviz_root, "bin", "gvplugin_dot_layout.dll"), "."),
64+
]
65+
)
3666

3767
a = Analysis(
3868
['run.py'],
39-
pathex=[],
40-
binaries=[],
69+
pathex=[PROJECT_DIR] + sys.path,
70+
binaries=binaries,
4171
datas=[
4272
("config", "config"),
4373
("modules", "modules"),
4474
("resources", "resources"),
4575
("samples", "samples"),
4676
("VERSION", "."),
47-
(Nodz_location, "Nodz"),
77+
(requests_location, "requests"),
78+
(reportlab_location, "reportlab"),
79+
(packaging_location, "packaging"),
80+
(qdarkstyle_location, "qdarkstyle"),
81+
(Qt_location, "."),
4882
],
4983
hiddenimports=all_hidden_imports,
50-
hookspath=[],
51-
runtime_hooks=[],
52-
excludes=["PySide6", "shiboken6"],
5384
win_no_prefer_redirects=False,
5485
win_private_assemblies=False,
5586
cipher=block_cipher,
@@ -75,8 +106,8 @@ exe = EXE(
75106
strip=False,
76107
upx=True,
77108
console=False,
78-
icon='resources/icon_32.ico',
79-
version='versionfile.txt',
109+
icon='resources/icon_32.ico', # Windows icon
110+
version='versionfile.txt', # Windows version info
80111
)
81112

82113
#coll = COLLECT(

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<img alt="License" src="https://img.shields.io/github/license/hasielhassan/PlumberManager" />
1212
<img alt="GitHub release (latest by date)" src="https://img.shields.io/github/v/release/hasielhassan/PlumberManager" />
1313
<img alt="GitHub release downloads" src="https://img.shields.io/github/downloads/hasielhassan/PlumberManager/total" />
14+
<img alt="Compatible Python Versions" src="https://img.shields.io/badge/Python Versions- 3.9 / 3.11-blue" />
1415
</p>
1516

1617
A helper tool to design CG Pipeline interactive diagramas and data flow documentation
@@ -50,13 +51,13 @@ All that is what Plumber Manager its aming to offer.
5051
- [ ] Improve connections ordering functionality
5152
- [X] Allow for process text descriptions
5253
- [ ] Process description with support for markdown
53-
- [ ] Add export documentation functionality, that expots a pdf document with all processes and its inputs and outputs
54+
- [X] Add export documentation functionality, that expots a pdf document with all processes and its inputs and outputs
5455

5556
And if you have an idea for something else, create a feature request in the form of an issue !
5657
# Development
5758
## Requirements:
58-
- Python 2 or 3
59-
- PyQt5 or PySide2
59+
- Python 3.9+
60+
- PyQt6 or PySide6
6061
- [qdarkstyle](https://github.com/ColinDuquesnoy/QDarkStyleSheet)
6162
- [Qt.py](https://github.com/mottosso/Qt.py)
6263
- [pygraphviz](https://github.com/pygraphviz/pygraphviz)

0 commit comments

Comments
 (0)