Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
cmeyer committed Jan 11, 2025
2 parents 5f25f64 + b44cd40 commit 5ac32e8
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 16 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
matrix:
os: [ubuntu-20.04]
python-version: ["3.11", "3.12", "3.13"]
qt-version: ["6.8.0"]
qt-version: ["6.8.1"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -47,7 +47,7 @@ jobs:
python -m pip install packaging build cibuildwheel
pushd launcher
PYTHON=`python -c "import sys; print(sys.executable, end='')"`
cmake CMakeLists.txt -DPython3_EXECUTABLE="$PYTHON"
cmake CMakeLists.txt -DGIT_REPO=${{ github.repository }} -DGIT_REF=${{ github.ref }} -DGIT_SHA=${{ github.sha }}
cmake --build . --config Release
mkdir -p linux
mv build linux/x64
Expand Down Expand Up @@ -105,16 +105,16 @@ jobs:
os: [macos-13]
python-version: ["3.11", "3.12", "3.13"]
architecture: [x86_64]
qt-version: ["6.8.0"]
qt-version: ["6.8.1"]
include:
- os: macos-14
python-version: "3.12"
architecture: arm64
qt-version: "6.8.0"
qt-version: "6.8.1"
- os: macos-14
python-version: "3.13"
architecture: arm64
qt-version: "6.8.0"
qt-version: "6.8.1"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand Down Expand Up @@ -146,7 +146,7 @@ jobs:
python -m pip install packaging build cibuildwheel
pushd launcher
PYTHON=`python -c "import sys; print(sys.executable, end='')"`
cmake CMakeLists.txt -DPython3_EXECUTABLE="$PYTHON"
cmake CMakeLists.txt -DGIT_REPO=${{ github.repository }} -DGIT_REF=${{ github.ref }} -DGIT_SHA=${{ github.sha }}
cmake --build . --config Release
pushd build
echo -n "$MACOS_CERTIFICATE" | base64 -d > certificate.p12
Expand Down Expand Up @@ -219,7 +219,7 @@ jobs:
matrix:
os: [windows-2019]
python-version: ["3.11", "3.12", "3.13"]
qt-version: ["6.8.0"]
qt-version: ["6.8.1"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -246,7 +246,7 @@ jobs:
python -m pip install packaging build cibuildwheel
pushd launcher
$PYTHON_EXEC = python -c "import sys; print(sys.executable, end='')"
cmake CMakeLists.txt -DPython3_EXECUTABLE="$PYTHON_EXEC"
cmake CMakeLists.txt -DGIT_REPO=${{ github.repository }} -DGIT_REF=${{ github.ref }} -DGIT_SHA=${{ github.sha }}
cmake --build . --config Release
Get-ChildItem -Include *.pdb -Recurse | foreach { $_.Delete() }
Get-ChildItem build\Release\imageformats -Include *d.dll -Recurse | foreach { $_.Delete() }
Expand Down Expand Up @@ -439,16 +439,16 @@ jobs:
os: [macos-13]
python-version: ["3.11", "3.12", "3.13"]
architecture: [x86_64]
qt-version: ["6.8.0"]
qt-version: ["6.8.1"]
include:
- os: macos-14
python-version: "3.12"
architecture: arm64
qt-version: "6.8.0"
qt-version: "6.8.1"
- os: macos-14
python-version: "3.13"
architecture: arm64
qt-version: "6.8.0"
qt-version: "6.8.1"
steps:
- uses: actions/checkout@v4
- name: Download Wheel
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{% set win_exe = "NionSwift" %}
{% set summary = "A native launcher for Nion Swift." %}

{% set version = "5.0.1" %}
{% set version = "5.1.0" %}

{% set name_u = name|replace('-', '_') %}

Expand Down
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog (nionswift-tool)
==========================

5.1.0 (2025-01-10)
------------------
- Add support for querying build version.

5.0.1 (2024-11-14)
------------------
- Fix possible crash when closing canvas items.
Expand Down
33 changes: 33 additions & 0 deletions launcher/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1597,6 +1597,38 @@ static PyObject *Core_getQtVersion(PyObject * /*self*/, PyObject *args)
return PythonSupport::instance()->build()("s", qVersion());
}

#define Q0(x) x
#define Q(x) Q0(x)

static PyObject *Core_getBuildVersion(PyObject * /*self*/, PyObject *args)
{
Q_UNUSED(args)

QVariantMap buildVersion;

// note: these defines are expected to be quoted

#if defined(GIT_REPO)
QString repo = QString(Q(GIT_REPO));
if (!repo.isEmpty())
buildVersion["repo"] = QString(repo);
#endif

#if defined(GIT_REF)
QString ref = QString(Q(GIT_REF));
if (!ref.isEmpty())
buildVersion["reference"] = QString(ref);
#endif

#if defined(GIT_SHA)
QString sha = QString(Q(GIT_SHA));
if (!sha.isEmpty())
buildVersion["sha"] = QString(sha);
#endif

return QVariantToPyObject(buildVersion);
}

static PyObject *Core_getLocation(PyObject * /*self*/, PyObject *args)
{
char *location_c = NULL;
Expand Down Expand Up @@ -6479,6 +6511,7 @@ static PyMethodDef Methods[] = {
{"Core_getFontMetrics", Core_getFontMetrics, METH_VARARGS, "Core_getFontMetrics."},
{"Core_getLocation", Core_getLocation, METH_VARARGS, "Core_getLocation."},
{"Core_getQtVersion", Core_getQtVersion, METH_VARARGS, "Core_getQtVersion."},
{"Core_getBuildVersion", Core_getBuildVersion, METH_VARARGS, "Core_getBuildVersion."},
{"Core_out", Core_out, METH_VARARGS, "Core_out."},
{"Core_pathToURL", Core_pathToURL, METH_VARARGS, "Core_pathToURL."},
{"Core_setApplicationInfo", Core_setApplicationInfo, METH_VARARGS, "Core_setApplicationInfo."},
Expand Down
7 changes: 4 additions & 3 deletions launcher/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# NOTE: requires Python 3.7 build environment so that _Py_DECREF is inlined.

# https://doc.qt.io/qt-5/cmake-get-started.html#build-a-gui-executable
# https://gitlab.kitware.com/cmake/cmake/issues/19820
# https://cmake.org/cmake/help/latest/prop_tgt/MACOSX_BUNDLE_INFO_PLIST.html
Expand All @@ -19,7 +17,7 @@ option(USE_CONSOLE "Enable console" ON)
set(APP_NAME "NionSwiftLauncher")

# app version
set(APP_VERSION "5.0.1")
set(APP_VERSION "5.1.0")

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/build)

Expand All @@ -36,6 +34,9 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Qt6 COMPONENTS Core Gui Widgets REQUIRED)
qt_standard_project_setup()
add_compile_definitions(QT_NO_KEYWORDS)
add_compile_definitions(GIT_REPO="${GIT_REPO}")
add_compile_definitions(GIT_REF="${GIT_REF}")
add_compile_definitions(GIT_SHA="${GIT_SHA}")

# set up Python
find_package (Python3 COMPONENTS Development)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
tool_id = "nionswift"
launcher = "NionSwiftLauncher"

version = "5.0.1"
version = "5.1.0"


def package_files(directory: str, prefix: str, prefix_drop: int) -> list[typing.Tuple[str, list[str]]]:
Expand Down

0 comments on commit 5ac32e8

Please sign in to comment.