Commit 9c8bdc08 authored by Kai Willadsen's avatar Kai Willadsen

Merge branch 'gitlab-ci-win32' into 'master'

win32: Building distribution via gitlab ci

See merge request !23
parents 46bd5f6f 333996f7
image: fedora:rawhide
stages:
- check
- build
......@@ -8,9 +7,11 @@ variables:
python3-gobject gtk3 gtksourceview3
python3-pytest intltool
before_script:
- dnf update -y
- dnf install -y $DEPENDENCIES
.linux-common: &linux-common
image: fedora:rawhide
before_script:
- dnf update -y
- dnf install -y $DEPENDENCIES
flake8:
stage: check
......@@ -18,13 +19,46 @@ flake8:
- pip3 install -r dev-requirements.txt
- flake8 bin/meld meld/
allow_failure: true
<<: *linux-common
pytest:
linux-pytest:
stage: check
script:
- py.test-3 test/
<<: *linux-common
build:
linux-build:
stage: build
script:
- python3 setup.py build
<<: *linux-common
.mingw-common: &mingw-common
stage: build
tags: # select gitlab runners with specific tag (unrelated to git repo tags)
- win32
artifacts:
name: "%CI_JOB_STAGE%-%CI_COMMIT_REF_NAME%"
paths:
- dist/
before_script:
- path C:\msys64\%MSYSTEM%\bin;C:\msys64\usr\bin;%PATH%
- pacman --noconfirm -S --refresh --sysupgrade --needed mingw-w64-%MSYS2_ARCH%-python3-cx_Freeze mingw-w64-%MSYS2_ARCH%-python3-gobject mingw-w64-%MSYS2_ARCH%-python3-pytest mingw-w64-%MSYS2_ARCH%-gtksourceview3 mingw-w64-%MSYS2_ARCH%-gsettings-desktop-schemas glib2-devel intltool
script:
- glib-compile-schemas data
- python3 setup_win32.py bdist_dumb --bdist-dir build\bdist.mingw\msi --keep-temp bdist_msi --keep-temp
# main purpose of this job is creating installers and not checking for breakage by changes in code
# so allow failures since the status of the build may depend on updates of rolling-release msys2 packages
allow_failure: true
mingw64-dist:
variables:
MSYS2_ARCH: x86_64
MSYSTEM: MINGW64
<<: *mingw-common
mingw32-dist:
variables:
MSYS2_ARCH: i686
MSYSTEM: "MINGW32"
<<: *mingw-common
version: tag-or-branch-set-dynamically.{build}
# Limit builds to release branches
branches:
only:
- master
- meld-3-18
# Only build tags automatically
# TODO: Disabled due to https://github.com/appveyor/ci/issues/1887
# skip_non_tags: true
environment:
PYTHON_PREFIX: C:\Python34
PATH: $(PYTHON_PREFIX);$(PYTHON_PREFIX)\Lib\site-packages\gnome;$(PATH)
install:
- ps: |
if ($env:APPVEYOR_REPO_TAG -eq "true") {
Update-AppveyorBuild -Version $env:APPVEYOR_REPO_TAG_NAME.$env:APPVEYOR_BUILD_NUMBER
} else {
Update-AppveyorBuild -Version $env:APPVEYOR_REPO_BRANCH-$($env:APPVEYOR_REPO_COMMIT.substring(0,7)).$env:APPVEYOR_BUILD_NUMBER
}
# Install cxFreeze
- cmd: |
python -m pip install pypiwin32==219
python -m pip install cx_Freeze==5.0.2
# Download and extract the PyGI all-in-one installer
- cmd: |
curl "https://sourceforge.net/projects/pygobjectwin32/files/pygi-aio-3.24.1_rev1-setup_049a323fe25432b10f7e9f543b74598d4be74a39.exe/download" --location --output pygi-aio-setup.exe
set SOURCEPATH=%cd%\pygi-aio-source
mkdir %SOURCEPATH%
7z.exe x -o%SOURCEPATH% pygi-aio-setup.exe
mkdir pygi-aio-setup
7z.exe x -opygi-aio-setup %SOURCEPATH%\setup.exe
set GIR=True
# %PYTHON_PREFIX% is used because it is the last supported by
# pygi-aio, GTK is installed as a dependency of GTKSourceView
- cmd: |
pygi-aio-setup\rcmd.exe /c "cd pygi-aio-setup && setup.bat %PYTHON_PREFIX% GTKSourceView >pygi-aio-setup.log"
build_script:
- cmd: |
%PYTHON_PREFIX%\Lib\site-packages\gnome\glib-compile-schemas data
%PYTHON_PREFIX%\python setup_win32.py bdist_msi
%PYTHON_PREFIX%\python setup_win32.py install --root build/install_root --prefix . bdist_dumb
artifacts:
- path: dist/*.msi
name: Meld installer
- path: dist/*.zip
name: Meld freezed binaries archive
......@@ -12,33 +12,21 @@ import meld.build_helpers
import meld.conf
def get_non_python_dependencies():
def get_non_python_libs():
"""Returns list of tuples containing extra dependencies required to run
meld on current platform.
Every pair corresponds to a single required file/folder.
Every pair corresponds to a single library file.
First tuple item correspond to path expected in meld installation
relative to meld prefix.
Second tuple item is path in local filesystem during build.
Note that for returned dynamic libraries their dependencies
Note that for returned dynamic libraries and executables dependencies
are expected to be resolved by caller, for example by cx_freeze.
"""
gtk_prefix = sys.prefix
gtk_exec_prefix = sys.prefix
sysconfig_platform = sysconfig.get_platform()
gtk_data = [
'etc/fonts',
'etc/gtk-3.0/settings.ini',
'lib/gdk-pixbuf-2.0',
'lib/girepository-1.0',
'share/fontconfig',
'share/glib-2.0',
'share/gtksourceview-3.0',
'share/icons',
]
gtk_exec_prefix = os.path.join(sys.prefix, "bin")
gtk_exec = []
if 'mingw' in sysconfig_platform:
if 'mingw' in sysconfig.get_platform():
# dll imported by dll dependencies expected to be auto-resolved later
gtk_exec = [
'libgtksourceview-3.0-1.dll',
......@@ -49,29 +37,48 @@ def get_non_python_dependencies():
gtk_exec.append('gspawn-win32-helper.exe')
else:
gtk_exec.append('gspawn-win64-helper.exe')
gtk_exec_prefix = os.path.join(gtk_exec_prefix, "bin")
elif 'win32' in sysconfig_platform or 'win-amd64' in sysconfig_platform:
# Official python on windows (non-mingw)
# The required gtk version isn't available,
# so kept mostly for temporarily keep appveyour build green.
gtk_exec = [
'libgtk-3-0.dll',
]
gtk_prefix = os.path.join(gtk_prefix, "Lib", "site-packages", "gnome")
gtk_exec_prefix = gtk_prefix
path_list = [(os.path.join(gtk_prefix, path), path) for path in gtk_data]
path_list += [
(os.path.join(gtk_exec_prefix, path), path) for path in gtk_exec
]
return path_list
return [(os.path.join(gtk_exec_prefix, path), path) for path in gtk_exec]
gtk_data_dirs = [
'etc/fonts',
'etc/gtk-3.0',
'lib/gdk-pixbuf-2.0',
'lib/girepository-1.0',
'share/fontconfig',
'share/glib-2.0',
'share/gtksourceview-3.0',
'share/icons',
]
gtk_data_files = []
for data_dir in gtk_data_dirs:
local_data_dir = os.path.join(sys.prefix, data_dir)
for local_data_subdir, dirs, files in os.walk(local_data_dir):
data_subdir = os.path.relpath(local_data_subdir, local_data_dir)
gtk_data_files.append((
os.path.join(data_dir, data_subdir),
[os.path.join(local_data_subdir, file) for file in files]
))
# add libgdk_pixbuf-2.0-0.dll manually to forbid auto-pulling of gdiplus.dll
manually_added_libs = {
"libgdk_pixbuf-2.0-0.dll": os.path.join(sys.prefix, 'bin'),
}
for lib, possible_path in manually_added_libs.items():
local_lib = os.path.join(possible_path, lib)
if os.path.isfile(local_lib):
gtk_data_files.append((os.path.dirname(lib), [local_lib]))
build_exe_options = {
"includes": ["gi"],
"excludes": ["tkinter"],
"packages": ["gi", "weakref"],
"include_files": get_non_python_dependencies(),
"include_files": get_non_python_libs(),
"bin_excludes": list(manually_added_libs.keys()),
"zip_exclude_packages": [],
"zip_include_packages": ["*"],
}
......@@ -137,6 +144,10 @@ setup(
options={
"build_exe": build_exe_options,
"bdist_msi": bdist_msi_options,
# cx_freeze + bdist_dumb fails on non-empty prefix
"install": {"prefix": "."},
# freezed binary doesn't use source files, they are only for humans
"install_lib": {"compile": False},
},
executables=[
Executable(**executable_options),
......@@ -171,7 +182,7 @@ setup(
('share/meld/ui',
glob.glob("data/ui/*.ui") + glob.glob("data/ui/*.xml")
),
],
] + gtk_data_files,
cmdclass={
"build_i18n": meld.build_helpers.build_i18n,
"build_help": meld.build_helpers.build_help,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment