Skip to content
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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ package-dir = { "" = "src" }
test-extras = ["tests"]
test-command = "pytest {project}/tests"
before-build = "python build_native_taglib.py"
skip = "cp36-* cp37-* cp38-*"
skip = "cp38-*"
enable = ["pypy"]
29 changes: 16 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,29 @@
def extension_kwargs():
here = Path(__file__).resolve().parent
default_taglib_path = here / "lib" / "taglib-cpp"
taglib_install_dir = Path(os.environ.get("TAGLIB_HOME", str(default_taglib_path)))

taglib_dir = Path(os.environ.get("TAGLIB_HOME", str(default_taglib_path)))
result = {
"include_dirs": [str(taglib_install_dir / "include"), str(src)],
"include_dirs": [str(taglib_dir / "include"), str(src)],
"libraries": [],
"library_dirs": [],
}
if sys.platform.startswith("win"):
# on Windows, we compile static taglib build into the python module
taglib_lib = taglib_install_dir / "lib" / "tag.lib"
if not taglib_lib.exists():
raise FileNotFoundError(f"{taglib_lib} not found")
build_static = taglib_dir.exists()
if build_static:
lib_dir = taglib_dir / "lib"
result["define_macros"] = [("TAGLIB_STATIC", None)]
result["extra_objects"] = [str(taglib_lib)]
if sys.platform.startswith("win"):
result["libraries"].append("tag")
result["library_dirs"].append(str(lib_dir))
else:
result["extra_objects"] = [str(lib_dir / "libtag.a")]
else:
# On unix systems, use the dynamic library. Still, add the (default) TAGLIB_HOME
# to allow overriding system taglib with custom build.
# fall back to dynamic linking at standard locations
result["libraries"] = ["tag"]
result["library_dirs"] = [
str(taglib_install_dir / "lib"),
str(taglib_install_dir / "lib64"),
str(taglib_dir / "lib"),
str(taglib_dir / "lib64"),
]
if sys.platform.startswith("darwin"):
result["extra_compile_args"] = ["-std=c++17"]
result["extra_link_args"] = ["-std=c++17"]
return result
Expand Down
Loading