Add GitHub Actions Windows CI build to commits (#1092)

* Update build script, maybe?

* Squashed commit of the following:

commit a50aff9fb73c407a78da6013a1661c9cfbbc3d6d
Author: Kim Chase <me@hi-im.kim>
Date:   Tue Dec 13 14:40:59 2022 -0500

    Add install recommends back, forgot it...

commit 8034957fbcfe07b5408e926bf0cd4c8dc2a97501
Author: Kim Chase <me@hi-im.kim>
Date:   Tue Dec 13 14:18:16 2022 -0500

    Try 64 bit builds?

commit 4b624eff44b2c76ffad7fcf5cfb36d14797d9f6e
Author: Kim Chase <me@hi-im.kim>
Date:   Tue Dec 13 13:47:33 2022 -0500

    Remove wineprefix to test.

commit 1dc8cd0ab0ae10211b267cbb9d24df88e31ea47d
Author: Kim Chase <me@hi-im.kim>
Date:   Tue Dec 13 13:37:30 2022 -0500

    Swap to staging.

commit eb750931e018f6b608a5ffe38877b1d544f8605d
Author: Kim Chase <me@hi-im.kim>
Date:   Tue Dec 13 13:28:23 2022 -0500

    printing shit to try and diagnose.

commit c45c47db53d82521a61e053b91aac3fcd4909be2
Author: Kim Chase <me@hi-im.kim>
Date:   Tue Dec 13 13:06:48 2022 -0500

    Try winebooting first.

commit 6e618ff60b881e90e0427571abb740eabf2943bb
Author: Kim Chase <me@hi-im.kim>
Date:   Tue Dec 13 12:54:46 2022 -0500

    Try running with xvfb to deal with display issues?

commit cf0b938b756c078d59bde0914a5fe8f42da47a75
Author: Kim Chase <me@hi-im.kim>
Date:   Tue Dec 13 12:34:27 2022 -0500

    Swapping back to stable I guess?

commit 8b03199a6e5d08a862b370379642dd0df13bafff
Author: Kim Chase <me@hi-im.kim>
Date:   Tue Dec 13 12:14:09 2022 -0500

    Fix broken closing bracket.

commit b4d0c7ba4951b3efa86c8276707f734008292108
Author: Kim Chase <me@hi-im.kim>
Date:   Tue Dec 13 11:53:17 2022 -0500

    Fix stupid stub call of wine --version that I put an echo on that wasn't needed...

commit 9632b39c5873f1bec1cb7f7d1f370ebdb2972589
Author: Kim Chase <me@hi-im.kim>
Date:   Tue Dec 13 11:46:43 2022 -0500

    Try WineHQ steps after fix patch.

commit af21ddbec2ee0533a8cd4a1d8536a82a85f6f5cd
Author: Kim Chase <me@hi-im.kim>
Date:   Tue Dec 13 11:43:12 2022 -0500

    Add Wine version print.

commit b500eced8c2f815d3d29c0eaff2c438480e16396
Author: Kim Chase <me@hi-im.kim>
Date:   Tue Dec 13 11:39:04 2022 -0500

    Alternate name?

commit c2d9b751422de889b3ffc6943b052024318c19c6
Author: Kim Chase <me@hi-im.kim>
Date:   Tue Dec 13 11:35:01 2022 -0500

    Swap back to devel (since it goes stable->devel->staging apparently.)

commit 8cc5977d1acd8486b535a95c5900cbe33c31e280
Author: Kim Chase <me@hi-im.kim>
Date:   Tue Dec 13 11:30:48 2022 -0500

    Try out wine staging and update python.

commit 33af296b213cfc738ec88436c28fd458b5eabd1b
Author: Kim Chase <me@hi-im.kim>
Date:   Tue Dec 13 11:30:33 2022 -0500

    Try out wine staging and pray.

commit 551227bbee6526f6c4dcbde0fdd07f5e784cc220
Author: Kim Chase <me@hi-im.kim>
Date:   Tue Dec 13 11:25:05 2022 -0500

    Undo mucked syntax.

commit f67edaf009201c93fc454cb2c9dadf10ab7962bd
Author: Kim Chase <me@hi-im.kim>
Date:   Tue Dec 13 11:24:37 2022 -0500

    Older pandoc test.

commit 728707b5a2ce54af48c32594abf2ea72d17675b2
Author: Kim Chase <me@hi-im.kim>
Date:   Tue Dec 13 11:23:48 2022 -0500

    Try older pandoc install.

commit 7dee6c0039406c1ad6531fb33ce1815c33a46243
Author: Kim Chase <me@hi-im.kim>
Date:   Tue Dec 13 11:16:07 2022 -0500

    Try to shorten build steps process.

commit f2f9a5bd1c01d2351c31815903614e36ad89d577
Author: Kim Chase <me@hi-im.kim>
Date:   Tue Dec 13 11:14:52 2022 -0500

    Remove APT cache.

commit 1cdc43ae7a289b820a24d4917992ac055c336f4f
Author: Kim Chase <me@hi-im.kim>
Date:   Tue Dec 13 11:10:10 2022 -0500

    Fix syntax error.

commit 9cc172a343632e12c624e440c5b625de42487153
Author: Kim Chase <me@hi-im.kim>
Date:   Tue Dec 13 11:08:28 2022 -0500

    Try workaround in issue.

commit 6a9f2b38c18978b32a83649b813010ed35d2e7a4
Author: Kim Chase <me@hi-im.kim>
Date:   Tue Dec 13 10:53:02 2022 -0500

    Regular wine whine.

commit b202e08fd95a6a001ce181de43d78433a6cce16e
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 17:54:47 2022 -0500

    List sources so I can remove deb.sury.org from stuff.

commit 5bc6d770de9a73c0a6db82a00343a71f905a27c1
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 17:49:53 2022 -0500

    Try the workaround.

commit 58bee4649a1f988f6ce0c0f394c908e6ad7acd4c
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 17:45:59 2022 -0500

    Try this selector?

commit c11b9b9e943c334fea9ce9ab3d6bc600958b8659
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 17:41:48 2022 -0500

    WIne32 prayer.

commit d1afae710eff839c80e942ad7cac877dca5e6cf5
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 17:38:30 2022 -0500

    Clear cache and pray.

commit 145d38117d90ba164238f75cee2ef74734282b0c
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 17:34:30 2022 -0500

    explicitly install libwine386.

commit f152a63310a856650301ea73ae04c2e834d0cdea
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 17:30:31 2022 -0500

    sudo sudo sudo

commit df17f589c2f9c40f71ec788623cba9f369f3d5b5
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 17:28:04 2022 -0500

    i386 wine32 prayers.

commit d172b98b37b51e39209795f377eeadb9c6e5fd3c
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 17:22:38 2022 -0500

    Swap wine calls to wine64.

commit b56fe9fe498f9069239f8d8cf1dd83b81585272f
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 17:18:43 2022 -0500

    Tiny tweak.

commit a9c928e0066ca5250f6087c126d11f7b3f14c84d
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 17:16:28 2022 -0500

    Simplify.

commit ef9c94d8e2ef896eb428aa6e9d24b52cffd482c1
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 17:14:54 2022 -0500

    Update to 22.04 and hoping.

commit 5039fc25c04598c29c4ef7380f0b8207085d23a8
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 17:12:05 2022 -0500

    Remove WineHQ again I guess.

commit 32f46bbbfda89b1fb31f773ba36c98e6fef5e623
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 17:08:45 2022 -0500

    Add multiverse/universe.

commit 10f80d0a4948beb47f5380ab9b62889389898481
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 17:07:33 2022 -0500

    Reordering and praying.

commit 42be65f6573b8dece1ee3c4494ba28ae21623caf
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 17:05:58 2022 -0500

    Purge.

commit ddb83a8fe411c2083a119bb2e70bd377d839822a
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 17:05:20 2022 -0500

    try me.

commit 9214a1bb3d237c66e3a7a4b288c208147bee9469
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 17:02:01 2022 -0500

    Or not...

commit af8eff93092bb7b11c883cd7eaf0d02d28f0114f
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 16:59:35 2022 -0500

    Trying to explicitly install amd64 install... we'll see I guess?

commit 5c56958e6bcc003bd0badaf5663f3dadb385552d
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 16:56:08 2022 -0500

    Typo fix.

commit 71c784e619e35f204d410477c46b56378de747cb
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 16:54:00 2022 -0500

    Trying to remove MSFT build repo.

commit 48c8506bdb85f48e674393ad41f8ba2e2bb2cc2c
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 16:48:08 2022 -0500

    Upgrading first.

commit 3e540cca38ce6fe9fd7b518033fae643a59e55bf
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 16:45:04 2022 -0500

    Wine Ubuntu specific instructions and hoping.

commit ce4b7db69aba1ceef8bb569302530a22cb998bf4
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 16:42:05 2022 -0500

    Try with install reccomends *this time*.

commit cff2ad19fee1645bfca29045e03fcb00d71f59d7
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 16:40:10 2022 -0500

    Try again with 386.

commit 25efa15ba7d0645c70a16239d02df054465077b5
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 16:37:46 2022 -0500

    Trying different instructions and hoping.

commit 50fc7d80867fc3f25af48dba4e886de8256d9a37
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 16:33:55 2022 -0500

    Install suggests and hope and pray.

commit 928a871263b0e3ac6e0ceee770bae8c3350de651
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 16:31:16 2022 -0500

    Forgot sudo again.

commit 60ab87149345d19ecf86ef8f887ad0c824b482fa
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 16:29:29 2022 -0500

    testing again.

commit 02c4ee7954473ff004733cc7d73b34ba2cf8e312
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 16:24:16 2022 -0500

    We ball.

commit 0bdf889ca5a0a5a712964a725caabc3bc0e5a1db
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 16:20:59 2022 -0500

    Trying out modified instructions.

commit 600ab4fad16de201016487f34ef3e6db980cf7a0
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 16:16:57 2022 -0500

    Try instructions from Winehq.

commit 487be119657e307dac7370cdd8849532596fc9e7
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 16:12:50 2022 -0500

    Try with just stock wine?

commit e27ec743cbe7cb591958711f330d3d64f7559ce0
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 16:07:39 2022 -0500

    Trying out winehq-develop step.

commit 2e2a0c9b058000282f7fd45966031f7d1059124f
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 16:05:14 2022 -0500

    Try rearranging purge and re-install stuff.

commit ea26769e2c213202bc85915b33243313adf95998
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 16:00:07 2022 -0500

    Remove erroneous procss call.  Embarassing.

commit 10fc0e7d568eae2b093cf34de50ad464e94e56fe
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 15:57:51 2022 -0500

    Rearrange to try and cache apt from wine too.

commit d11f5b686570e9971e028ec05689179b56feb199
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 15:52:40 2022 -0500

    Fix *all* the calls in section to run as root.... fml.

commit ae10399abb88b1ffe7aefc0d37fe8e0f041f1b33
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 15:35:42 2022 -0500

    add sudo to dpkg call.

commit 2507fcc838ce4cf41199b1fa8810c91d539d33be
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 15:30:25 2022 -0500

    Add installer step to add i386 wine.

commit 0a8a5afb376acdc69c3cd41ee69b32c9a3807ca7
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 15:25:54 2022 -0500

    Try just re-running i guess.

commit 8f41100f5eabd3f69186bc425c43c5eb0507768b
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 15:22:00 2022 -0500

    Trying to kill latent xvfb that didn't close?

commit c95bc0368ff94169e3544fd53ec72dfaa51cada8
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 15:17:15 2022 -0500

    Fix package name, hopefully it runs.

commit 8bf1f1febe52fbbdc06d2902290d8c1a6d474ae3
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 15:11:55 2022 -0500

    Add upgrade step to hopefully help.  We'll see.

commit ea2322c5a8f7987c63344a91de24a7f570147ecc
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 15:09:39 2022 -0500

    Install Wine from different place?  We'll see.

commit b2642f6d4ae5c31e1193433513fa3b48082cb37b
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 15:05:49 2022 -0500

    Run in xvfb for CI/CD.

commit 208fa49759825848036822131164f1fec645b928
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 15:00:09 2022 -0500

    Tiny tweaks to fix Wine build issues.

commit 422f589384499698bd2f91c1bc3b6ee3a43b4b9e
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 14:56:18 2022 -0500

    Try with SHA short?

commit e16a23eeb2c53a5c5f07a545128af225d8bc2536
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 14:54:03 2022 -0500

    Swap to forced 64 bit builds (it's 2022, please...)

commit cb8278f23cfc9d4627519973e49c5c0722e1a859
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 14:51:24 2022 -0500

    Runner is not root.  Continue.

commit c3d27a4191b655f83aa2057593679e4e26d4b9da
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 14:50:44 2022 -0500

    Fix silly syntax issue.

commit 8b51550034a6b82a13f28fdd7730cdec49a0b32d
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 14:49:38 2022 -0500

    Fix missing Windows Python and continue on.

commit 70a20d03fadb73d1813486ad8947347aeb4d7ae9
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 14:44:26 2022 -0500

    Add wine to apt dependencies.

commit df00da451a0d7ab7c4e4d910f06fffbcb4de3e74
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 14:41:52 2022 -0500

    Forgot to include the ENV step.

commit a6e22d84edcd1c0519bf28e4001a7240e3061212
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 14:40:03 2022 -0500

    Testing WINE builds on GH Actions.

commit 2c32e4acf78db1f5a4ab55a713f42ed05538d03e
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 14:39:42 2022 -0500

    Try running windows build script?  i suppose?

commit 9cb7bbd3fc6a5670713127dcb9928521e8545a7e
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 14:30:10 2022 -0500

    Resolve syntax error #2.  oops.

commit db02840ae21f003d3857d79ef724c98592ca8299
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 14:29:39 2022 -0500

    Resolve syntax error... oops.

commit 8f261a7cecbd35c82d9c306ab75b7eca2cea441f
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 14:29:08 2022 -0500

    Attempting to cache apt packages for faster builds.

commit f3857d9e08e8fa18615b032c031c63c950d485ca
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 14:25:12 2022 -0500

    Attempting to print commit hash inside build.

commit f06d5adcf7cb9060986e0eb58fbd91f14e5aa538
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 14:22:09 2022 -0500

    hash based git version test 1.

commit bb19490c85c40c39f757f9f51e6c60a9188a49aa
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 14:18:29 2022 -0500

    First test of a linux build in Github CI.

commit 3808c3989ebbfe77b36f1f7b4dd8c92a444c2397
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 14:07:20 2022 -0500

    Indentation on workflow confirm.

commit 194d01a1fcd7770f57c7d8fd7a59cd1832b3197f
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 14:06:38 2022 -0500

    Minor cleanup to make this workflow named properly.

commit c27485cf30d4f36e5ccd0600834072fb579beb67
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 14:02:22 2022 -0500

    Update to proper version?  Apparently.

commit 66cd7034c726d257fd1fb57154f1e5e6422519c9
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 14:00:11 2022 -0500

    Update actions steps.

commit 7c650fbb8964d4b57e3546c530c57f9d870f085c
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 13:57:38 2022 -0500

    Update to python 3.9 for build script.

commit b4111e316cfc851ce1c60b42c8d6ead72de872a9
Author: Kim Chase <me@hi-im.kim>
Date:   Mon Dec 12 13:56:12 2022 -0500

    Try removing buggy build options.

* Trim together Windows build errata.

* Revert Windows build file to what it was at the start of this adventure to not break anyone else's work.

* Explicitly try to remove the files per the priorly mentioned W7 issues.

* Add semicolons to separate in-line powershell.

* Update path of Qt5Bluetooth.dll to be removed

Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>

Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
Co-authored-by: TheJackiMonster <thejackimonster@gmail.com>
This commit is contained in:
Kim 2022-12-15 19:11:26 -05:00 committed by GitHub
parent 0a67fd793b
commit a36bc55bf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 274 additions and 97 deletions

59
.github/workflows/build_windows.yml vendored Normal file
View File

@ -0,0 +1,59 @@
# This workflow is used to run the pyinstaller spec
# and produce a Windows build directory as artifact.
# In the future it'll also need to confirm that all
# of the translations and UI files are built from
# scratch as a condition of the tests with pytest.
name: Build for Windows
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the develop branch
push:
branches: [ develop ]
pull_request:
branches: [ develop ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
windows_build:
name: Building for Windows ${{ matrix.python_version }} on ${{ matrix.os }}
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.9]
os: [windows-latest]
steps:
# We use the version from this commit and not just the current branch. This is for R&D builds too.
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# These should be moved to a pyproject.toml file down the line.
- name: Install Python build dependencies
run: |
python -m pip install --upgrade pip
pip install pyqt5==5.15.7 lxml pytest pytest-faulthandler language_tool_python symspellpy pyspellchecker pyenchant
pip install pyinstaller
- name: pyinstaller build
run: |
pyinstaller ./manuskript.spec
env:
manuskript_version: ${{ steps.vars.outputs.sha_short }}
- name: Remove W7 File Issues # https://github.com/olivierkes/manuskript/blob/develop/package/build_for_windows.sh#L85
run: |
powershell Remove-Item ./dist/manuskript/PyQt5/Qt5/bin/Qt5Bluetooth.dll;
powershell Remove-Item ./dist/manuskript/ucrtbase.dll;
powershell Remove-Item ./dist/manuskript/api-ms-win-*;
# https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: manuskript_windows
path: ./dist/manuskript/

View File

@ -1,6 +1,7 @@
# This is a basic workflow to help you get started with Actions
# This workflow is used to run pytest and confirm
# that Linux builds meet the pytest requirements for the project.
name: CI
name: Pytest Run (Linux)
# Controls when the action will run.
on:
@ -13,31 +14,28 @@ on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
test:
name: Test on node ${{ matrix.python_version }} and ${{ matrix.os }}
name: Running pytest ${{ matrix.python_version }} and ${{ matrix.os }}
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.6]
# python-version: [3.6, 3.7, 3.8, 3.9]
os: [ubuntu-16.04]
# os: [ubuntu-16.04, ubuntu-latest, windows-latest, macos-10.15]
# https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs
python-version: [3.9]
os: [ubuntu-20.04]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyqt5==5.9 lxml pytest pytest-faulthandler
pip install pyqt5==5.15.7 lxml pytest pytest-faulthandler
sudo apt-get -qq update
sudo apt-get -qq install python3-pip python3-dev build-essential qt5-default libxml2-dev libxslt1-dev mesa-utils libgl1-mesa-glx libgl1-mesa-dev libxcb-xinerama0-dev
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi

View File

@ -2,8 +2,26 @@
block_cipher = None
a = Analysis(['bin/manuskript'],
pathex=['.'],
# This is the spec file to be run with pyinstaller.
# However, it's what amounts to a python script, so
# we can do some incredibly cursed things to make
# sure it builds, and the way we want it to.
# For some reason we need to explicitly include the current directory. Unsure why.
import os
import sys
file_dir = os.path.dirname(".")
sys.path.append(file_dir)
# We're grabbing the current git SHA short to use in the version.
from util.hashed_version import writeVersionPlusHash
version = writeVersionPlusHash()
a = Analysis(
["bin/manuskript"],
pathex=["."],
binaries=None,
datas=[
("icons", "icons"),
@ -18,64 +36,64 @@ a = Analysis(['bin/manuskript'],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
cipher=block_cipher,
)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
exe = EXE(pyz,
exe = EXE(
pyz,
a.scripts,
exclude_binaries=True,
name='manuskript',
name="manuskript",
debug=False,
strip=False,
upx=True,
console=True,
icon=os.path.join(SPECPATH, 'icons/Manuskript/manuskript.ico') )
icon=os.path.join(SPECPATH, "icons/Manuskript/manuskript.ico"),
)
wexe = EXE(pyz,
wexe = EXE(
pyz,
a.scripts,
exclude_binaries=True,
name='manuskriptw',
name="manuskriptw",
debug=False,
strip=False,
upx=True,
console=False,
icon=os.path.join(SPECPATH, 'icons/Manuskript/manuskript.ico') )
icon=os.path.join(SPECPATH, "icons/Manuskript/manuskript.ico"),
)
coll = COLLECT(exe,
wexe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
name='manuskript')
coll = COLLECT(
exe, wexe, a.binaries, a.zipfiles, a.datas, strip=False, upx=True, name="manuskript"
)
version=os.environ['manuskript_version']
app = BUNDLE(coll,
name='manuskript.app',
icon=os.path.join(SPECPATH, 'icons/Manuskript/Manuskript.icns'),
bundle_identifier='ch.theologeek.manuskript',
app = BUNDLE(
coll,
name="manuskript.app",
icon=os.path.join(SPECPATH, "icons/Manuskript/Manuskript.icns"),
bundle_identifier="ch.theologeek.manuskript",
version=version,
info_plist={
'NSPrincipalClass': 'NSApplication',
'NSAppleScriptEnabled': False,
'NSHighResolutionCapable': True,
'CFBundleURLTypes': [{
'CFBundleURLName': 'MSK',
'CFBundleTypeRole': 'Editor',
'CFBundleURLSchemes': ['msk'],
}],
'CFBundleDocumentTypes': [
"NSPrincipalClass": "NSApplication",
"NSAppleScriptEnabled": False,
"NSHighResolutionCapable": True,
"CFBundleURLTypes": [
{
'CFBundleTypeName': 'MSK',
'CFBundleTypeIconFile': 'icons/Manuscript/manuskript',
'CFBundleTypeExtensions': ['msk'],
'CFBundleTypeRole': 'Editor',
'LSHandlerRank': 'Owner'
"CFBundleURLName": "MSK",
"CFBundleTypeRole": "Editor",
"CFBundleURLSchemes": ["msk"],
}
]
],
"CFBundleDocumentTypes": [
{
"CFBundleTypeName": "MSK",
"CFBundleTypeIconFile": "icons/Manuscript/manuskript",
"CFBundleTypeExtensions": ["msk"],
"CFBundleTypeRole": "Editor",
"LSHandlerRank": "Owner",
}
],
},
)

View File

@ -964,9 +964,9 @@ def addTextItems(mdl, odict, parent=None):
item = outlineFromMMD(odict[k], parent=parent)
item._lastPath = odict[k + ":lastPath"]
except KeyError:
LOGGER.error("Failed to add file " + str(k))
LOGGER.error(f"Failed to add file {k}")
else:
LOGGER.debug("Strange things in file %s".format(k))
LOGGER.debug(f"Strange things in file {k}")
def outlineFromMMD(text, parent):

0
util/__init__.py Normal file
View File

View File

@ -5,6 +5,7 @@ import sys
from lxml import etree
def main(argv) -> int:
if len(argv) < 2:
print("You need to specify a .ts file!")
@ -12,13 +13,13 @@ def main(argv) -> int:
path = argv[1]
if (len(path) < 3) or (path[-3:] != '.ts'):
if (len(path) < 3) or (path[-3:] != ".ts"):
print("Please specify a path to a .ts file!")
return 2
tree = None
with open(path, 'rb') as file:
with open(path, "rb") as file:
tree = etree.parse(file)
if tree is None:
@ -26,16 +27,16 @@ def main(argv) -> int:
return 3
root = tree.getroot()
if root.tag != 'TS':
if root.tag != "TS":
print("Wrong type of file!")
return 4
for context in root.getchildren():
if context.tag != 'context':
if context.tag != "context":
continue
for message in context.getchildren():
if message.tag != 'message':
if message.tag != "message":
continue
source = message.find("source")
@ -44,22 +45,23 @@ def main(argv) -> int:
if (source is None) or (translation is None):
continue
sourceText = etree.tostring(source, encoding='unicode').strip()
sourceText = etree.tostring(source, encoding="unicode").strip()
if '&amp;' in sourceText:
if "&amp;" in sourceText:
continue
translationText = etree.tostring(translation, encoding='unicode').strip()
translationText = re.sub(r'&amp;([a-zA-Z]+);', r'&\g<1>;', translationText)
translationText = etree.tostring(translation, encoding="unicode").strip()
translationText = re.sub(r"&amp;([a-zA-Z]+);", r"&\g<1>;", translationText)
translationNode = etree.fromstring(translationText)
translation.text = translationNode.text
with open(path, 'wb') as file:
tree.write(file, encoding='utf-8', xml_declaration=True, pretty_print=True)
with open(path, "wb") as file:
tree.write(file, encoding="utf-8", xml_declaration=True, pretty_print=True)
print("Fixing finished!")
return 0
if __name__ == '__main__':
if __name__ == "__main__":
sys.exit(main(sys.argv))

56
util/hashed_version.py Normal file
View File

@ -0,0 +1,56 @@
#!/usr/bin/env python
# --!-- coding: utf8 --!--
import subprocess
import pathlib
import importlib.util
import sys
# This is to produce an environment variable in GH Actions exclusively for use in CI/CD builds.
def writeVersionPlusHash() -> bool:
"""This function will permit us to rewrite
the inline version.py file to contain the
appropriate version-plus-hash-short to be
shown in the about screen, version diagnostics
and more. This helps us better keep track
of long-running issues in a relatively
consise manner."""
sha_short = (
subprocess.run(
"git rev-parse --short HEAD", shell=True, check=True, capture_output=True
)
.stdout.strip()
.decode("utf-8")
) # UTF8 decode as it's a UTF8 situation.
version_file = pathlib.Path("./manuskript/version.py").absolute()
spec = importlib.util.spec_from_file_location(
"manuskript.version", version_file.absolute()
)
temp = importlib.util.module_from_spec(spec)
sys.modules["module.name"] = temp
spec.loader.exec_module(temp)
# used in final output.
non_commit_version = temp.getVersion()
# Used to rewrite the situation here.
version_file_contents = open(str(version_file), 'r').readlines()
for key, f in enumerate(version_file_contents):
if ("__version__ = ") in f:
version_file_contents[key] = f"__version__ = \"{non_commit_version}-{sha_short}\"\n"
try:
with open(str(version_file), 'w') as output_stub:
output_stub.writelines(version_file_contents)
return f"{non_commit_version}-{sha_short}"
except:
return None

44
util/linguist_update.py Normal file
View File

@ -0,0 +1,44 @@
#!/bin/python
import argparse
import os
from pathlib import Path
import subprocess
parser = argparse.ArgumentParser(
description="Update all QM source translation binaries based on the source .ts files."
)
parser.add_argument(
"--binpath", type=str, help="Path to the lrelease binary.", required=True
)
parser.add_argument(
"--transpath",
type=str,
help="Path to the source translations directory. Does not recurse.",
default="./i18n/",
)
def cleanupFiles(binpath, transpath) -> None:
# Catch for if the user doesn't pass in a path but we're still passing a None.
src_files = Path(transpath) if transpath is not None else "./i18n/"
src_files = [
x for x in src_files.iterdir() if x.is_file() and str(x).endswith(".qm")
]
for file in src_files:
# lrelease.exe path_to_translation.qm
subprocess.run([lrelease_path, str(file)])
# This permits us to import these steps discretely for a bigger build tool.
if __name__ == "__main__":
arguments = parser.parse_args()
# To permit calling as a normal function too ig.
if arguments.binpath is not None:
lrelease_path = Path(arguments.binpath)
if arguments.transpath is not None:
trans_path = Path(arguments.transpath)
cleanupFiles(lrelease_path, trans_path)