Gaphor na Windowsu¶
Gaphor can be installed as with our installer. Check out the Gaphor download page for details.
Older releases are available from GitHub.
CI builds are also available.
Development Environment¶
Choco¶
Preporučujemo korištenje Chocolately kao upravlajača paketima u Windowsu.
Za instaliranje otvori PowerShell kao administrator, a zatim izvrši:
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
Za pokretanje lokalnih skripta u sljedećim koracima, također izvrši
Set-ExecutionPolicy RemoteSigned
To omogućuje pokretanje lokalnih PowerShell skripta bez potpisivanja, ali još uvijek zahtijeva potpisivanje za udaljena skripta.
Git¶
To set up a development environment in Windows first install Git by executing as an administrator:
choco install git
MSYS2¶
Razvojno okruženje u sljedećem koraku mora imati instaliran MSYS2 za pružanje nekih Linuxovih alata naredbenog retka u sustavu Windows.
Ostavi PowerShell otvorenim kao administrator i instaliraj MSYS2:
choco install msys2
GTK i Python s gvsbuild¶
gvsbuild provides a Python script helps you build the GTK library stack for Windows using Visual Studio. By compiling GTK with Visual Studio, we can then use a standard Python development environment in Windows.
First we will install the gvsbuild dependencies:
Visual C++ build tools workload for Visual Studio 2022 Build Tools
Python
Instaliraj Visual Studio 2022¶
S tojim administratorskim PowerShell terminalom:
choco install visualstudio2022-workload-vctools
Instaliraj najnoviju Python verziju¶
In Windows, The full installer contains all the Python components and is the best option for developers using Python for any kind of project.
For more information on how to use the official installer, please see the full installer instructions. The default installation options should be fine for use with Gaphor.
Install the latest Python version using the official installer.
Open a PowerShell terminal as a normal user and check the python version:
py -3.11 --version
Instaliraj Graphviz¶
Graphviz is used by Gaphor for automatic diagram formatting.
Install from Chocolately with administrator PowerShell:
choco install graphviz
Restart your PowerShell terminal as a normal user and check that the dot command is available:
dot -?
Instaliraj pipx¶
Iz običnog korisničkog PowerShell terminala izvrši:
py -3.11 -m pip install --user pipx
py -3.11 -m pipx ensurepath
Instaliraj gvsbuild¶
Iz običnog korisničkog PowerShell terminala izvrši:
pipx install gvsbuild
Izgradi GTK¶
U istom PowerShell terminalu izvrši:
gvsbuild build --enable-gi --py-wheel gobject-introspection gtk4 libadwaita gtksourceview5 pygobject pycairo adwaita-icon-theme hicolor-icon-theme
Popij kavu, izgradnja će trajati nekoliko minuta.
Postavi Gaphor¶
U istom PowerShell terminalu kopiraj repozitorij:
cd (to the location you want to put Gaphor)
git clone https://github.com/gaphor/gaphor.git
cd gaphor
Instaliraj Poetry
pipx install poetry
Dodaj GTK svojim varijablama okruženja:
$env:Path = $env:Path + ";C:\gtk-build\gtk\x64\release\bin"
$env:LIB = "C:\gtk-build\gtk\x64\release\lib"
$env:INCLUDE = "C:\gtk-build\gtk\x64\release\include;C:\gtk-build\gtk\x64\release\include\cairo;C:\gtk-build\gtk\x64\release\include\glib-2.0;C:\gtk-build\gtk\x64\release\include\gobject-introspection-1.0;C:\gtk-build\gtk\x64\release\lib\glib-2.0\include;"
$env:XDG_DATA_HOME = "$HOME\.local\share"
Također možeš urediti varijable okruženja svog računa kako bi postojale tijekom PowerShell sesija.
Instaliraj Gaphor ovisnosti
poetry install
Install the git hook scripts
poetry run pre-commit install
Ponovo instaliraj PyGObject i pycairo pomoću gvsbuild kotačića
poetry run pip install --force-reinstall (Resolve-Path C:\gtk-build\build\x64\release\pygobject\dist\PyGObject*.whl)
poetry run pip install --force-reinstall (Resolve-Path C:\gtk-build\build\x64\release\pycairo\dist\pycairo*.whl)
Pokreni Gaphor!
poetry run gaphor
Debugging using Visual Studio Code¶
Start a new PowerShell terminal, and set current directory to the project folder:
cd (to the location you put gaphor)
Ensure that path environment variable is set:
$env:Path = "C:\gtk-build\gtk\x64\release\bin;" + $env:Path
Start Visual Studio Code:
code .
To start the debugger, execute the following steps:
Open
__main__.py
file fromgaphor
folderAdd a breakpoint on line
main(sys.argv)
In the menu, select Run → Start debugging
Choose Select module from the list
Enter
gaphor
as module name
Visual Studio Code will start the application in debug mode, and will stop at main.
Paketiranje za Windows¶
In order to create an exe installation package for Windows, we utilize PyInstaller which analyzes Gaphor to find all the dependencies and bundle them in to a single folder. We then use a custom bash script that creates a Windows installer using NSIS and a portable installer using 7-Zip. To install them, open PowerShell as an administrator, then execute:
choco install nsis 7zip
Then build your installer using:
poetry install --only main,packaging,automation
poetry build
poetry run poe package
poetry run poe win-installer