From f62a9d3d4e74c81a94a43ed8ddeba1e9757e2cd8 Mon Sep 17 00:00:00 2001 From: Rhet Turnbull Date: Mon, 14 Oct 2019 09:44:11 -0700 Subject: [PATCH] fixed version check for Catalina --- README.md | 3 +++ osxphotos/__init__.py | 16 +++++++++++++--- setup.py | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index af71c1a2..d283b0a4 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,9 @@ Only works on Mac OS X. Tested on Mac OS 10.12.6 / Photos 2.0, 10.13.6 / Photos This module will read Photos databases for any supported version on any supported OS version. E.g. you can read a database created with Photos 4.0 on Mac OS 10.14 on a machine running Mac OS 10.12 +NOTE: Does NOT currently support Mac OS 10.15 / Catalina and Photos 5.0. This module will run on Catalina but you will only be able to read Photos database files created with Photos 4.0 or lower. Photos 5.0 on Catalina uses an entirely new database schema and the code has not yet been udpated to work with this version. + + ## Installation instructions osxmetadata uses setuptools, thus simply run: diff --git a/osxphotos/__init__.py b/osxphotos/__init__.py index 58ac5ff7..3392944c 100644 --- a/osxphotos/__init__.py +++ b/osxphotos/__init__.py @@ -20,10 +20,9 @@ from . import _applescript # from loguru import logger +# TODO: Does not work with Photos 5.0 / Mac OS 10.15 Catalina # TODO: standardize _ and __ as leading char for private variables -# TODO: fix use of ''' and """ # TODO: fix docstrings -# TODO: fix versions tested to include 10.14.6 # which Photos library database versions have been tested # Photos 2.0 (10.12.6) == 2622 @@ -42,7 +41,18 @@ _debug = False def _get_os_version(): # returns tuple containing OS version # e.g. 10.13.6 = (10, 13, 6) - (ver, major, minor) = platform.mac_ver()[0].split(".") + version = platform.mac_ver()[0].split(".") + if len(version) == 2: + (ver, major) = version + minor = "0" + elif len(version) == 3: + (ver, major, minor) = version + else: + raise ( + ValueError( + f"Could not parse version string: {platform.mac_ver()} {version}" + ) + ) return (ver, major, minor) diff --git a/setup.py b/setup.py index d66be46e..b627f5db 100755 --- a/setup.py +++ b/setup.py @@ -38,7 +38,7 @@ with open(path.join(this_directory, "README.md"), encoding="utf-8") as f: setup( name="osxphotos", - version="0.12.4", + version="0.12.5", description="Manipulate (read-only) Apple's Photos app library on Mac OS X", long_description=long_description, long_description_content_type="text/markdown",