Skip to content

Commit 7dda5b1

Browse files
linesightclaude
andcommitted
Track cefpython3/__init__.py; gitignore build outputs in cefpython3/
__init__.py is source; .pyd/.dll/.exe/.pak/.dat/.bin/.json/locales/ are build outputs or CEF runtime files and should not be committed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 080f567 commit 7dda5b1

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
.idea/
22
build/
33
dist/
4+
cefpython3/*.pyd
5+
cefpython3/*.dll
6+
cefpython3/*.exe
7+
cefpython3/*.pak
8+
cefpython3/*.dat
9+
cefpython3/*.bin
10+
cefpython3/*.json
11+
cefpython3/locales/
412
_cmake_test/
513
_skbuild/
614
venv/

cefpython3/__init__.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import ctypes
2+
import importlib
3+
import os
4+
import platform
5+
import sys
6+
7+
__all__ = ["cefpython"]
8+
__author__ = "The CEF Python authors"
9+
10+
try:
11+
from importlib.metadata import version as _pkg_version
12+
__version__ = _pkg_version("cefpython3")
13+
except Exception:
14+
__version__ = "unknown"
15+
16+
package_dir = os.path.dirname(os.path.abspath(__file__))
17+
18+
# Let subprocess and the C extension find CEF DLLs / .so files next to this
19+
# __init__.py regardless of the working directory.
20+
os.environ["CEFPYTHON3_PATH"] = package_dir
21+
22+
if platform.system() == "Linux":
23+
_ld = os.environ.get("LD_LIBRARY_PATH", "")
24+
os.environ["LD_LIBRARY_PATH"] = (
25+
package_dir + os.pathsep + _ld if _ld else package_dir
26+
)
27+
ctypes.CDLL(os.path.join(package_dir, "libcef.so"), ctypes.RTLD_GLOBAL)
28+
29+
_pyver = "{0}{1}".format(*sys.version_info[:2])
30+
cefpython = importlib.import_module(".cefpython_py{}".format(_pyver), package=__name__)

0 commit comments

Comments
 (0)