Update resource generation for ARM64 platforms (e.g. Apple M2)

This commit is contained in:
Raoul Snyman 2023-05-31 20:21:14 -07:00
parent 3e509ec001
commit d330201b2b
4 changed files with 87 additions and 8 deletions

3
.gitignore vendored
View File

@ -42,8 +42,7 @@ openlp.cfg
openlp.pro
openlp/core/resources.py
openlp/core/resources.py.old
openlp/plugins/presentations/lib/vendor/Pyro4
openlp/plugins/presentations/lib/vendor/serpent.py
openlp/plugins/presentations/lib/vendor/*
output
package-lock.json
tags

View File

@ -51,10 +51,25 @@ test-arch:
- sh scripts/generate_resources.sh
- xvfb-run -s '-screen 0 1024x768x24' pytest --color=no --disable-warnings
test-macos:
test-macos-intel:
stage: test
tags:
- macos
- apple-amd64
script:
- export PATH=/opt/local/bin:$PATH
- sh scripts/generate_resources.sh
- python3 -m pytest --color=no --disable-warnings --cov openlp
- mv .coverage macos.coverage
artifacts:
paths:
- macos.coverage
only:
- master@openlp/openlp
test-macos-arm:
stage: test
tags:
- apple-arm
script:
- export PATH=/opt/local/bin:$PATH
- sh scripts/generate_resources.sh

View File

@ -35,19 +35,30 @@
###############################################################################
# Backup the existing resources
if [ -f "openlp/core/resources.py" ]; then
echo "Backup old resources file"
mv openlp/core/resources.py openlp/core/resources.py.old
fi
# Create the new data from the updated qrc
echo "Generate new resources file"
pyrcc5 -o openlp/core/resources.py.new resources/images/openlp-2.qrc
# Remove patch breaking lines
echo "Remove 'Created by' line"
cat openlp/core/resources.py.new | sed '/# Created by: /d' > openlp/core/resources.py
# Patch resources.py to OpenLP coding style
patch --posix -s openlp/core/resources.py scripts/resources.patch
ARCH=`uname -m`
echo "Architecture is: $ARCH"
if [ "$ARCH" == "arm64" ]; then
echo "Running ARM64 patch"
patch --posix -s openlp/core/resources.py scripts/resources.arm64.patch
else
echo "Running x86 patch"
patch --posix -s openlp/core/resources.py scripts/resources.patch
fi
# Remove temporary file
rm openlp/core/resources.py.new 2>/dev/null
rm openlp/core/resources.py.old 2>/dev/null
rm openlp/core/resources.py.orig 2>/dev/null
rm -f openlp/core/resources.py.new 2>/dev/null
rm -f openlp/core/resources.py.old 2>/dev/null
rm -f openlp/core/resources.py.orig 2>/dev/null

View File

@ -0,0 +1,54 @@
=== modified file 'openlp/core/resources.py'
--- openlp/core/resources.py
+++ openlp/core/resources.py
@@ -1,10 +1,28 @@
# -*- coding: utf-8 -*-
-
-# Resource object code
-#
-#
-# WARNING! All changes made in this file will be lost!
-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+##########################################################################
+# OpenLP - Open Source Lyrics Projection #
+# ---------------------------------------------------------------------- #
+# Copyright (c) 2008-2023 OpenLP Developers #
+# ---------------------------------------------------------------------- #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see <https://www.gnu.org/licenses/>. #
+##########################################################################
+"""
+The :mod:`resources` module provides application images and icons in a central
+store for use by OpenLP.
+"""
from PyQt5 import QtCore
qt_resource_data = b"\
@@ -61434,9 +61452,13 @@ else:
qt_resource_struct = qt_resource_struct_v2
def qInitResources():
+ """
+ Initialise OpenLP resources at application startup.
+ """
QtCore.qRegisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data)
def qCleanupResources():
+ """
+ Cleanup OpenLP resources when the application shuts down.
+ """
QtCore.qUnregisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data)
-
-qInitResources()