forked from spotDL/spotify-downloader
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.py
More file actions
36 lines (31 loc) · 997 Bytes
/
build.py
File metadata and controls
36 lines (31 loc) · 997 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import os
import sys
from pathlib import Path
from importlib.metadata import metadata
import PyInstaller.__main__ # type: ignore
import pykakasi
import yt_dlp
import ytmusicapi
from spotdl._version import __version__
LOCALES_PATH = str((Path(ytmusicapi.__file__).parent / "locales"))
PYKAKASI_PATH = str((Path(pykakasi.__file__).parent / "data"))
YTDLP_PATH = str(Path(yt_dlp.__file__).parent / "__pyinstaller")
# Read modules from pyproject.toml
modules = set(
module.split(" ")[0] for module in metadata("spotdl").get_all("Requires-Dist", [])
)
PyInstaller.__main__.run(
[
"spotdl/__main__.py",
"--onefile",
"--add-data",
f"{LOCALES_PATH}{os.pathsep}ytmusicapi/locales",
"--add-data",
f"{PYKAKASI_PATH}{os.pathsep}pykakasi/data",
f"--additional-hooks-dir={YTDLP_PATH}",
"--name",
f"spotdl-{__version__}-{sys.platform}",
"--console",
*(f"--collect-all={module}" for module in modules),
]
)