Skip to content

Commit

Permalink
Merge pull request #179 from jim-easterbrook/devel
Browse files Browse the repository at this point in the history
Devel
  • Loading branch information
jim-easterbrook authored Oct 14, 2024
2 parents 0eed4ba + 89a629b commit 4bc0eee
Show file tree
Hide file tree
Showing 12 changed files with 113 additions and 90 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/build-macos-arm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: build gphoto2 macOS arm64
on: workflow_dispatch

jobs:
build:
runs-on: macos-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Download libgphoto2
run: wget -nv
https://github.com/gphoto/libgphoto2/releases/download/v2.5.31/libgphoto2-2.5.31.tar.xz
-O libgphoto2.tar.xz

- name: Extract libgphoto2
run: |
mkdir $PWD/libgphoto2
tar xf libgphoto2.tar.xz \
--directory $PWD/libgphoto2 --strip-components=1
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_ARCHS: arm64
CIBW_SKIP: pp3*
CIBW_ENVIRONMENT: >
GPHOTO2_ROOT=$PWD/libgphoto2/local_install
MACOSX_DEPLOYMENT_TARGET="14.0"
SYSTEM_VERSION_COMPAT=0
CIBW_TEST_COMMAND: >
python3 -m gphoto2 -v &&
python3 -m unittest discover {project}/tests -v
CIBW_BEFORE_ALL: >
brew install libexif libtool gd &&
pushd $PWD/libgphoto2 &&
./configure --prefix=$PWD/local_install --disable-internal-docs \
--enable-vusb \
CFLAGS="-D_DARWIN_C_SOURCE -I$(brew --prefix)/include" &&
make &&
make install &&
popd
- name: Store results
uses: actions/upload-artifact@v4
with:
name: macos-wheels
path: wheelhouse/*.whl
48 changes: 13 additions & 35 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Build MacOS binary wheels
name: build gphoto2 macOS x86_64
on: workflow_dispatch

jobs:
build:
runs-on: macos-latest
runs-on: macos-13
steps:
- name: Check out repository code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Download libgphoto2
run: wget -nv
Expand All @@ -20,13 +20,19 @@ jobs:
--directory $PWD/libgphoto2 --strip-components=1
- name: Build wheels
uses: pypa/cibuildwheel@v2.16.2
uses: pypa/cibuildwheel@v2.21.3
env:
CIBW_ARCHS: x86_64
CIBW_SKIP: pp3*
CIBW_ENVIRONMENT: GPHOTO2_ROOT=$PWD/libgphoto2/local_install
CIBW_ENVIRONMENT: >
GPHOTO2_ROOT=$PWD/libgphoto2/local_install
MACOSX_DEPLOYMENT_TARGET="13.0"
SYSTEM_VERSION_COMPAT=0
CIBW_TEST_COMMAND: >
python3 -m gphoto2 -v &&
python3 -m unittest discover {project}/tests -v
CIBW_BEFORE_ALL: >
brew install libexif jpeg-turbo libtool libusb gd gettext &&
brew install libexif &&
pushd $PWD/libgphoto2 &&
./configure --prefix=$PWD/local_install --disable-internal-docs \
--enable-vusb \
Expand All @@ -36,35 +42,7 @@ jobs:
popd
- name: Store results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: macos-wheels
path: wheelhouse/*.whl

test:
needs: build
runs-on: macos-latest
strategy:
matrix:
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- name: Check out repository code
uses: actions/checkout@v3

- name: Fetch wheel files
uses: actions/[email protected]
with:
name: macos-wheels

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: 'x64'

- name: Install wheel
run: pip3 install --disable-pip-version-check --no-index
--find-links=. gphoto2

- name: Test installation
run: python3 -m unittest discover tests -v
57 changes: 12 additions & 45 deletions .github/workflows/build-manylinux.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Build manylinux binary wheels
name: build gphoto2 linux x86_64
on: workflow_dispatch

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Download libgphoto2
run: wget -nv
Expand All @@ -20,60 +20,27 @@ jobs:
--directory $PWD/libgphoto2 --strip-components=1
- name: Build wheels
uses: pypa/cibuildwheel@v2.16.2
uses: pypa/cibuildwheel@v2.21.3
env:
CIBW_ARCHS: auto64
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_BUILD: cp*-manylinux_x86_64
CIBW_ENVIRONMENT: GPHOTO2_ROOT=$PWD/libgphoto2/local_install
CIBW_TEST_COMMAND: >
python3 -m gphoto2 -v &&
python3 -m unittest discover {project}/tests -v
CIBW_BEFORE_ALL: >
yum install -y libusbx-devel libexif-devel libjpeg-turbo-devel \
gd-devel libcurl-devel libxml2-devel libtool-ltdl-devel &&
yum install -y libusbx-devel libexif-devel libjpeg-turbo-devel
gd-devel libcurl-devel libxml2-devel libtool-ltdl-devel &&
pushd $PWD/libgphoto2 &&
./configure --prefix=$PWD/local_install --disable-internal-docs \
--enable-vusb &&
./configure --prefix=$PWD/local_install --disable-internal-docs
--enable-vusb &&
make &&
make install &&
popd
- name: Store results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: manylinux-wheels
path: wheelhouse/*.whl

test:
needs: build
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
os: [ubuntu-latest]
include:
- python-version: '3.6'
os: ubuntu-20.04
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository code
uses: actions/checkout@v3

- name: Fetch wheel files
uses: actions/[email protected]
with:
name: manylinux-wheels

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: 'x64'

- name: Install locales
run: |
sudo apt-get install locales
sudo locale-gen de
- name: Install wheel
run: pip3 install --disable-pip-version-check --no-index
--find-links=. gphoto2

- name: Test installation
run: python3 -m unittest discover tests -v
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# python-gphoto2 - Python interface to libgphoto2
# http://github.com/jim-easterbrook/python-gphoto2
# Copyright (C) 2014-23 Jim Easterbrook [email protected]
# Copyright (C) 2014-24 Jim Easterbrook [email protected]
#
# This file is part of python-gphoto2.
#
Expand Down Expand Up @@ -92,7 +92,7 @@
'gphoto2.libgphoto2.locale.' + name + '.LC_MESSAGES')
# module compile options
extra_link_args = ['-Wl,-rpath,$ORIGIN/libgphoto2']
if sys.platform =='linux':
if sys.platform == 'linux':
extra_link_args += ['-Wl,--disable-new-dtags']

cmd = ['pkg-config', '--modversion', 'libgphoto2']
Expand Down
6 changes: 5 additions & 1 deletion tests/test_abilities_list.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# python-gphoto2 - Python interface to libgphoto2
# http://github.com/jim-easterbrook/python-gphoto2
# Copyright (C) 2023 Jim Easterbrook [email protected]
# Copyright (C) 2023-24 Jim Easterbrook [email protected]
#
# This file is part of python-gphoto2.
#
Expand All @@ -19,10 +19,14 @@
# <https://www.gnu.org/licenses/>.

import os
import sys
import unittest

import gphoto2 as gp

path = os.path.dirname(os.path.dirname(__file__))
if path not in sys.path:
sys.path.insert(0, path)
from tests.vcamera import has_vcam, use_vcam


Expand Down
6 changes: 5 additions & 1 deletion tests/test_camera.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# python-gphoto2 - Python interface to libgphoto2
# http://github.com/jim-easterbrook/python-gphoto2
# Copyright (C) 2023 Jim Easterbrook [email protected]
# Copyright (C) 2023-24 Jim Easterbrook [email protected]
#
# This file is part of python-gphoto2.
#
Expand All @@ -19,11 +19,15 @@
# <https://www.gnu.org/licenses/>.

import os
import sys
import time
import unittest

import gphoto2 as gp

path = os.path.dirname(os.path.dirname(__file__))
if path not in sys.path:
sys.path.insert(0, path)
from tests.vcamera import has_vcam, use_vcam


Expand Down
6 changes: 5 additions & 1 deletion tests/test_context.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# python-gphoto2 - Python interface to libgphoto2
# http://github.com/jim-easterbrook/python-gphoto2
# Copyright (C) 2023 Jim Easterbrook [email protected]
# Copyright (C) 2023-24 Jim Easterbrook [email protected]
#
# This file is part of python-gphoto2.
#
Expand All @@ -20,10 +20,14 @@

from collections import defaultdict
import os
import sys
import unittest

import gphoto2 as gp

path = os.path.dirname(os.path.dirname(__file__))
if path not in sys.path:
sys.path.insert(0, path)
from tests.vcamera import has_vcam, use_vcam


Expand Down
6 changes: 5 additions & 1 deletion tests/test_filesys.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# python-gphoto2 - Python interface to libgphoto2
# http://github.com/jim-easterbrook/python-gphoto2
# Copyright (C) 2023 Jim Easterbrook [email protected]
# Copyright (C) 2023-24 Jim Easterbrook [email protected]
#
# This file is part of python-gphoto2.
#
Expand All @@ -19,11 +19,15 @@
# <https://www.gnu.org/licenses/>.

import os
import sys
import time
import unittest

import gphoto2 as gp

path = os.path.dirname(os.path.dirname(__file__))
if path not in sys.path:
sys.path.insert(0, path)
from tests.vcamera import has_vcam, use_vcam


Expand Down
6 changes: 5 additions & 1 deletion tests/test_port.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# python-gphoto2 - Python interface to libgphoto2
# http://github.com/jim-easterbrook/python-gphoto2
# Copyright (C) 2023 Jim Easterbrook [email protected]
# Copyright (C) 2023-24 Jim Easterbrook [email protected]
#
# This file is part of python-gphoto2.
#
Expand All @@ -19,11 +19,15 @@
# <https://www.gnu.org/licenses/>.

import logging
import os
import sys
import unittest

import gphoto2 as gp

path = os.path.dirname(os.path.dirname(__file__))
if path not in sys.path:
sys.path.insert(0, path)
from tests.vcamera import has_vcam, use_vcam


Expand Down
6 changes: 5 additions & 1 deletion tests/test_port_info_list.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# python-gphoto2 - Python interface to libgphoto2
# http://github.com/jim-easterbrook/python-gphoto2
# Copyright (C) 2023 Jim Easterbrook [email protected]
# Copyright (C) 2023-24 Jim Easterbrook [email protected]
#
# This file is part of python-gphoto2.
#
Expand All @@ -19,10 +19,14 @@
# <https://www.gnu.org/licenses/>.

import os
import sys
import unittest

import gphoto2 as gp

path = os.path.dirname(os.path.dirname(__file__))
if path not in sys.path:
sys.path.insert(0, path)
from tests.vcamera import use_vcam


Expand Down
4 changes: 3 additions & 1 deletion tests/test_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ def test_exceptions(self):
self.assertEqual(ex.string, gp.gp_result_as_string(error))

def set_lang(self, lang):
# setting LANGUAGE works on Ubuntu, setlocale works on openSUSE
# setting environ works on Ubuntu, setlocale works on openSUSE
# using both seems to be harmless
os.environ['LC_ALL'] = lang
os.environ['LANG'] = lang
os.environ['LANGUAGE'] = lang
# try default locale first
try:
Expand Down
Loading

0 comments on commit 4bc0eee

Please sign in to comment.