Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build_macos.yaml #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
30 changes: 30 additions & 0 deletions .github/workflows/build_macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build macOS Package
on:
workflow_dispatch:
pull_request:
jobs:
macos_build:
name: Build a MacOS app
runs-on: macos-latest
steps:
- uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
# Version range or exact version of a Python version to use, using SemVer's version range syntax.
python-version: 3.11
# Used to specify a package manager for caching in the default directory. Supported values: pip, pipenv, poetry.
cache: pip
# The target architecture (x86, x64) of the Python interpreter.
architecture: x64

- name: Install Python dependencies
run: |
pip install -r requirements.txt
pip install -r requirements-dev.txt

- name: Build with py2app
run: python3 setup.py py2app


70 changes: 36 additions & 34 deletions DisplayCAL/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def create_app_symlinks(dist_dir, scripts):
tgt = os.path.join(toolcontents, entry, subentry)
if subentry == "main.py":
# py2app
with open(src, "rb") as main_in:
with open(src, "r") as main_in:
py = main_in.read()
py = py.replace("main()", "main(%r)" % script[len(name) + 1:])
with open(tgt, "wb") as main_out:
Expand Down Expand Up @@ -478,11 +478,11 @@ def setup():
pass
try:
import setuptools
from setuptools import setup, Extension
from setuptools import setup, Extension, find_packages

setuptools = True
print("using setuptools")
current_findall = setuptools.findall
current_findall = find_packages
except ImportError:
pass
else:
Expand Down Expand Up @@ -1624,38 +1624,40 @@ def copy_package_data(self, package, target_dir):
if dry_run or help:
return

if do_py2app:
frameworks_dir = os.path.join(
dist_dir, name + ".app", "Contents", "Frameworks"
)
lib_dynload_dir = os.path.join(
dist_dir,
name + ".app",
"Contents",
"Resources",
"lib",
"python%s.%s" % sys.version_info[:2],
"lib-dynload",
)
# Fix Pillow (PIL) dylibs not being included
pil_dylibs = os.path.join(lib_dynload_dir, "PIL", ".dylibs")
if not os.path.isdir(pil_dylibs):
import PIL
# if do_py2app:
# frameworks_dir = os.path.join(
# dist_dir, name + ".app", "Contents", "Frameworks"
# )
# lib_dynload_dir = os.path.join(
# dist_dir,
# name + ".app",
# "Contents",
# "Resources",
# "lib",
# "python%s.%s" % sys.version_info[:2],
# "lib-dynload",
# )
# # Fix Pillow (PIL) dylibs not being included
# pil_dylibs = os.path.join(lib_dynload_dir, "PIL", ".dylibs")
# if not os.path.isdir(pil_dylibs):
# import PIL

# pil_installed_dylibs = os.path.join(
# os.path.dirname(PIL.__file__), ".dylibs"
# )
# print("Copying", pil_installed_dylibs, "->", pil_dylibs)
# shutil.copytree(pil_installed_dylibs, pil_dylibs)
# for entry in os.listdir(pil_dylibs):
# print(os.path.join(pil_dylibs, entry))
# # Remove wrongly included frameworks
# dylibs_entries = os.listdir(pil_installed_dylibs)
# print("frameworks_dir", frameworks_dir)
# for entry in os.listdir(frameworks_dir):
# if entry in dylibs_entries:
# dylib = os.path.join(frameworks_dir, entry)
# print("Removing", dylib)
# os.remove(dylib)

pil_installed_dylibs = os.path.join(
os.path.dirname(PIL.__file__), ".dylibs"
)
print("Copying", pil_installed_dylibs, "->", pil_dylibs)
shutil.copytree(pil_installed_dylibs, pil_dylibs)
for entry in os.listdir(pil_dylibs):
print(os.path.join(pil_dylibs, entry))
# Remove wrongly included frameworks
dylibs_entries = os.listdir(pil_installed_dylibs)
for entry in os.listdir(frameworks_dir):
if entry in dylibs_entries:
dylib = os.path.join(frameworks_dir, entry)
print("Removing", dylib)
os.remove(dylib)
import wx

if wx.VERSION >= (4,):
Expand Down
2 changes: 2 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ pytest-xdist
snowballstemmer
twine
yappi
py2app
wheel
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[metadata]
name=DisplayCAL
version=attr: DisplayCAL.VERSION
license_file = LICENSE.txt
license_files = LICENSE.txt

[options]
packages = find:
Expand Down