Skip to content
Merged

Meson #1616

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build_pip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
strategy:
matrix:
os: [windows-latest, macos-latest] #, ubuntu-latest]
python: ['3.9',] # '3.10', '3.11', '3.12', '3.13']
python: ['3.9', '3.10', '3.11', '3.12', '3.13']
arch: [x86_64, arm64]
exclude:
- os: windows-latest
Expand Down
14 changes: 14 additions & 0 deletions PYME/Acquire/acquire_app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""PYME Acquire application entry point script."""

from PYME.util.uilaunch import ensure_macos_framework_build

def main():
# make sure we have a framework build on macOS so that ui elements work properly
# run this before importing any ui elements (or anything that might take time to import)
ensure_macos_framework_build()

from PYME.Acquire import PYMEAcquire
PYMEAcquire.main()

if __name__ == '__main__':
main()
18 changes: 18 additions & 0 deletions PYME/DSView/PYMEImage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""
Entry point for PYMEImage application

Minimal stub to ensure that on macOS we have a framework build of python
"""

from PYME.util.uilaunch import ensure_macos_framework_build

def main():
# make sure we have a framework build on macOS so that ui elements work properly
# run this before importing any ui elements (or anything that might take time to import)
ensure_macos_framework_build()

from PYME.DSView import dsviewer
dsviewer.main()

if __name__ == '__main__':
main()
16 changes: 16 additions & 0 deletions PYME/LMVis/PYMEVisualise.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
Entry point module for PYMEVisualise application
"""

from PYME.util.uilaunch import ensure_macos_framework_build

def main():
# make sure we have a framework build on macOS so that ui elements work properly
# run this before importing any ui elements (or anything that might take time to import)
ensure_macos_framework_build()

from PYME.LMVis import VisGUI
VisGUI.main()

if __name__ == '__main__':
main()
4 changes: 4 additions & 0 deletions PYME/cluster/cluster_of_one.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import os
import webbrowser

from PYME.util.uilaunch import ensure_macos_framework_build

import logging
logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -121,6 +123,8 @@ def run(self):


def main():
ensure_macos_framework_build()

logging.basicConfig(level=logging.DEBUG)
import wx
import PYME.resources
Expand Down
16 changes: 16 additions & 0 deletions PYME/recipes/bakeshop_app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
entrypoint for bakeshop
"""

from PYME.util.uilaunch import ensure_macos_framework_build

def main():
# make sure we have a framework build on macOS so that ui elements work properly
# run this before importing any ui elements (or anything that might take time to import)
ensure_macos_framework_build()

from PYME.recipes.bakeshop import bakeshop_app
bakeshop_app.main()

if __name__ == '__main__':
main()
2 changes: 1 addition & 1 deletion PYME/update_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def update_version():
s = f.read()

s = re.sub(r'version\s*=\s*".*?"', 'version = "%s"' % new_version, s)
print('Updating version in %s to %s' % (fn, new_version))
#print('Updating version in %s to %s' % (fn, new_version))
with open(fn, 'w') as f:
f.write(s)

Expand Down
39 changes: 39 additions & 0 deletions PYME/util/uilaunch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import sys
import os
import shutil

def ensure_macos_framework_build():
"""
Ensures the script is running with a Framework build of Python (python.app)
on macOS. If not, it attempts to find one and relaunches the process.
"""
if sys.platform != "darwin":
return

# If we are already running inside a .app bundle (standard Framework build)
# or the specific python.app executable, we are good.
if ".app/Contents/MacOS/python" in sys.executable:
return

current_exe = sys.executable
env_base = sys.prefix # The root of the current environment (venv or conda env)


# 1. Look for Conda's specific python.app (The most common need for this)
# Structure: <env>/python.app/Contents/MacOS/python
conda_app = os.path.join(env_base, "python.app", "Contents", "MacOS", "python")

if os.path.exists(conda_app) and os.access(conda_app, os.X_OK):
target_python = conda_app
else:
target_python = None
print("Warning: Could not find a python.app executable in the current conda environment.")
return


# 4. The Relaunch
# Only relaunch if we found a better python AND we aren't already running it.
if target_python and os.path.abspath(current_exe) != os.path.abspath(target_python):
# We use execv to replace the current process (keeping PID same-ish)
# We pass the new executable as argv[0] and all original args
os.execv(target_python, [target_python] + sys.argv)
25 changes: 24 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,28 @@ dependencies = [

]

[project.scripts]
dh5view = "PYME.DSView.PYMEImage:main"
PYMEImage = "PYME.DSView.PYMEImage:main"
PYMEAcquire = "PYME.Acquire.PYMEAcquire:main"
VisGUI = "PYME.LMVis.PYMEVisualise:main"
PYMEVis = "PYME.LMVis.PYMEVisualise:main"
PYMEVisualize = "PYME.LMVis.PYMEVisualise:main"
PYMEVisualise = "PYME.LMVis.PYMEVisualise:main"
PYMEBatch = "PYME.recipes.batchProcess:main"
bakeshop = "PYME.recipes.bakeshop_app:main"
PYMEDataServer = "PYME.cluster.HTTPDataServer:main"
PYMEClusterDup = "PYME.io.clusterDuplication:main"
PYMERuleServer = "PYME.cluster.PYMERuleServer:main"
PYMENodeServer = "PYME.cluster.PYMENodeServer:main"
PYMERuleNodeServer = "PYME.cluster.PYMERuleNodeServer:main"
PYMEClusterOfOne = "PYME.cluster.cluster_of_one:main"
#PYMEWebDav = "PYME.cluster.webdav:main"
PYMEscmosmapgen = "PYME.Analysis.gen_sCMOS_maps:main"
#fitMonP = "PYME.ParallelTasks.fitMonP:main"
#taskWorkerZC = "PYME.ParallelTasks.taskWorkerZC:main"
#taskServerZC = "PYME.ParallelTasks.taskServerZC:main"
#slaunchWorkers = "PYME.ParallelTasks.launchWorkers:main"

[project.urls]
"Homepage" = "https://github.com/python-microscopy/pymecompress"
"Homepage" = "https://www.python-microscopy.org"
Loading