libheif-binary 1.19.8.1__py3-none-macosx_11_0_universal2.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ 1.19.8
@@ -0,0 +1,67 @@
1
+ import os
2
+ import sys
3
+ from pathlib import Path
4
+
5
+
6
+ def load_library():
7
+ """Preload bundled libheif before importing a linked extension."""
8
+ import ctypes
9
+
10
+ package = Path(__file__).resolve().parent
11
+ if sys.platform == "darwin":
12
+ version = (package / "LIBVERSION").read_text().strip()
13
+ path = package / "lib" / f"libheif.{version}.dylib"
14
+ else:
15
+ path = package / "lib" / "libheif-loader.so"
16
+ return ctypes.CDLL(str(path), mode=ctypes.RTLD_GLOBAL)
17
+
18
+
19
+ def _run(name):
20
+ executable = str(Path(__file__).parent / "bin" / name)
21
+ os.execv(executable, [executable, *sys.argv[1:]])
22
+
23
+
24
+ def heif_enc():
25
+ _run("heif-enc")
26
+
27
+
28
+ def heif_dec():
29
+ _run("heif-dec")
30
+
31
+
32
+ def heif_info():
33
+ _run("heif-info")
34
+
35
+
36
+ def link_cli():
37
+ import sysconfig
38
+ import tempfile
39
+
40
+ action = "resolve the package and environment paths"
41
+ try:
42
+ scripts = Path(sysconfig.get_path("scripts")).resolve()
43
+ binaries = Path(__file__).resolve().parent / "bin"
44
+ names = ("heif-enc", "heif-dec", "heif-info")
45
+ for name in names:
46
+ executable = binaries / name
47
+ action = f"check binary {executable}"
48
+ if not executable.is_file():
49
+ sys.exit(f"Cannot link CLI: binary missing or not a regular file: {executable}")
50
+ action = f"create temporary links in {scripts}"
51
+ with tempfile.TemporaryDirectory(dir=scripts) as directory:
52
+ for name in names:
53
+ executable = binaries / name
54
+ link = Path(directory) / name
55
+ action = f"create symlink for {name}"
56
+ link.symlink_to(os.path.relpath(executable, scripts))
57
+ action = f"replace {scripts / name} with a symlink"
58
+ link.replace(scripts / name)
59
+ action = f"remove temporary links from {scripts}"
60
+ except PermissionError as error:
61
+ sys.exit(
62
+ f"Cannot {action}: permission denied ({error.filename}). "
63
+ "Check directory permissions and ownership."
64
+ )
65
+ except OSError as error:
66
+ sys.exit(f"Cannot {action}: {error.strerror or error}.")
67
+ print(f"Linked HEIF commands in {scripts}")
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,27 @@
1
+ Copyright (c) 2016, Alliance for Open Media. All rights reserved.
2
+
3
+ Redistribution and use in source and binary forms, with or without
4
+ modification, are permitted provided that the following conditions
5
+ are met:
6
+
7
+ 1. Redistributions of source code must retain the above copyright
8
+ notice, this list of conditions and the following disclaimer.
9
+
10
+ 2. Redistributions in binary form must reproduce the above copyright
11
+ notice, this list of conditions and the following disclaimer in
12
+ the documentation and/or other materials provided with the
13
+ distribution.
14
+
15
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18
+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19
+ COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21
+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
25
+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26
+ POSSIBILITY OF SUCH DAMAGE.
27
+
@@ -0,0 +1,108 @@
1
+ Alliance for Open Media Patent License 1.0
2
+
3
+ 1. License Terms.
4
+
5
+ 1.1. Patent License. Subject to the terms and conditions of this License, each
6
+ Licensor, on behalf of itself and successors in interest and assigns,
7
+ grants Licensee a non-sublicensable, perpetual, worldwide, non-exclusive,
8
+ no-charge, royalty-free, irrevocable (except as expressly stated in this
9
+ License) patent license to its Necessary Claims to make, use, sell, offer
10
+ for sale, import or distribute any Implementation.
11
+
12
+ 1.2. Conditions.
13
+
14
+ 1.2.1. Availability. As a condition to the grant of rights to Licensee to make,
15
+ sell, offer for sale, import or distribute an Implementation under
16
+ Section 1.1, Licensee must make its Necessary Claims available under
17
+ this License, and must reproduce this License with any Implementation
18
+ as follows:
19
+
20
+ a. For distribution in source code, by including this License in the
21
+ root directory of the source code with its Implementation.
22
+
23
+ b. For distribution in any other form (including binary, object form,
24
+ and/or hardware description code (e.g., HDL, RTL, Gate Level Netlist,
25
+ GDSII, etc.)), by including this License in the documentation, legal
26
+ notices, and/or other written materials provided with the
27
+ Implementation.
28
+
29
+ 1.2.2. Additional Conditions. This license is directly from Licensor to
30
+ Licensee. Licensee acknowledges as a condition of benefiting from it
31
+ that no rights from Licensor are received from suppliers, distributors,
32
+ or otherwise in connection with this License.
33
+
34
+ 1.3. Defensive Termination. If any Licensee, its Affiliates, or its agents
35
+ initiates patent litigation or files, maintains, or voluntarily
36
+ participates in a lawsuit against another entity or any person asserting
37
+ that any Implementation infringes Necessary Claims, any patent licenses
38
+ granted under this License directly to the Licensee are immediately
39
+ terminated as of the date of the initiation of action unless 1) that suit
40
+ was in response to a corresponding suit regarding an Implementation first
41
+ brought against an initiating entity, or 2) that suit was brought to
42
+ enforce the terms of this License (including intervention in a third-party
43
+ action by a Licensee).
44
+
45
+ 1.4. Disclaimers. The Reference Implementation and Specification are provided
46
+ "AS IS" and without warranty. The entire risk as to implementing or
47
+ otherwise using the Reference Implementation or Specification is assumed
48
+ by the implementer and user. Licensor expressly disclaims any warranties
49
+ (express, implied, or otherwise), including implied warranties of
50
+ merchantability, non-infringement, fitness for a particular purpose, or
51
+ title, related to the material. IN NO EVENT WILL LICENSOR BE LIABLE TO
52
+ ANY OTHER PARTY FOR LOST PROFITS OR ANY FORM OF INDIRECT, SPECIAL,
53
+ INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER FROM ANY CAUSES OF
54
+ ACTION OF ANY KIND WITH RESPECT TO THIS LICENSE, WHETHER BASED ON BREACH
55
+ OF CONTRACT, TORT (INCLUDING NEGLIGENCE), OR OTHERWISE, AND WHETHER OR
56
+ NOT THE OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
57
+
58
+ 2. Definitions.
59
+
60
+ 2.1. Affiliate. "Affiliate" means an entity that directly or indirectly
61
+ Controls, is Controlled by, or is under common Control of that party.
62
+
63
+ 2.2. Control. "Control" means direct or indirect control of more than 50% of
64
+ the voting power to elect directors of that corporation, or for any other
65
+ entity, the power to direct management of such entity.
66
+
67
+ 2.3. Decoder. "Decoder" means any decoder that conforms fully with all
68
+ non-optional portions of the Specification.
69
+
70
+ 2.4. Encoder. "Encoder" means any encoder that produces a bitstream that can
71
+ be decoded by a Decoder only to the extent it produces such a bitstream.
72
+
73
+ 2.5. Final Deliverable. "Final Deliverable" means the final version of a
74
+ deliverable approved by the Alliance for Open Media as a Final
75
+ Deliverable.
76
+
77
+ 2.6. Implementation. "Implementation" means any implementation, including the
78
+ Reference Implementation, that is an Encoder and/or a Decoder. An
79
+ Implementation also includes components of an Implementation only to the
80
+ extent they are used as part of an Implementation.
81
+
82
+ 2.7. License. "License" means this license.
83
+
84
+ 2.8. Licensee. "Licensee" means any person or entity who exercises patent
85
+ rights granted under this License.
86
+
87
+ 2.9. Licensor. "Licensor" means (i) any Licensee that makes, sells, offers
88
+ for sale, imports or distributes any Implementation, or (ii) a person
89
+ or entity that has a licensing obligation to the Implementation as a
90
+ result of its membership and/or participation in the Alliance for Open
91
+ Media working group that developed the Specification.
92
+
93
+ 2.10. Necessary Claims. "Necessary Claims" means all claims of patents or
94
+ patent applications, (a) that currently or at any time in the future,
95
+ are owned or controlled by the Licensor, and (b) (i) would be an
96
+ Essential Claim as defined by the W3C Policy as of February 5, 2004
97
+ (https://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential)
98
+ as if the Specification was a W3C Recommendation; or (ii) are infringed
99
+ by the Reference Implementation.
100
+
101
+ 2.11. Reference Implementation. "Reference Implementation" means an Encoder
102
+ and/or Decoder released by the Alliance for Open Media as a Final
103
+ Deliverable.
104
+
105
+ 2.12. Specification. "Specification" means the specification designated by
106
+ the Alliance for Open Media as a Final Deliverable for which this
107
+ License was issued.
108
+