diff --git a/dvc/__pyinstaller/__init__.py b/dvc/__pyinstaller/__init__.py new file mode 100644 index 000000000..1c52aadf4 --- /dev/null +++ b/dvc/__pyinstaller/__init__.py @@ -0,0 +1,5 @@ +import os + + +def get_hook_dirs(): + return [os.path.dirname(__file__)] diff --git a/scripts/pyinstaller/hooks/hook-asyncssh.py b/dvc/__pyinstaller/hook-asyncssh.py similarity index 64% rename from scripts/pyinstaller/hooks/hook-asyncssh.py rename to dvc/__pyinstaller/hook-asyncssh.py index daee85e09..c608e11b2 100644 --- a/scripts/pyinstaller/hooks/hook-asyncssh.py +++ b/dvc/__pyinstaller/hook-asyncssh.py @@ -1 +1,2 @@ +# ruff: noqa: N999 hiddenimports = ["win32timezone"] diff --git a/scripts/pyinstaller/hooks/hook-celery.py b/dvc/__pyinstaller/hook-celery.py similarity index 96% rename from scripts/pyinstaller/hooks/hook-celery.py rename to dvc/__pyinstaller/hook-celery.py index 4b96c9a70..6e106be0c 100644 --- a/scripts/pyinstaller/hooks/hook-celery.py +++ b/dvc/__pyinstaller/hook-celery.py @@ -1,3 +1,4 @@ +# ruff: noqa: N999 # pylint: disable=import-error from PyInstaller.utils.hooks import collect_submodules, is_module_or_submodule diff --git a/scripts/pyinstaller/hooks/hook-dvc.py b/dvc/__pyinstaller/hook-dvc.py similarity index 97% rename from scripts/pyinstaller/hooks/hook-dvc.py rename to dvc/__pyinstaller/hook-dvc.py index 3c84707b8..c2d12ff34 100644 --- a/scripts/pyinstaller/hooks/hook-dvc.py +++ b/dvc/__pyinstaller/hook-dvc.py @@ -1,3 +1,4 @@ +# ruff: noqa: N999 from PyInstaller.utils.hooks import copy_metadata # pylint:disable=import-error # needed for `dvc doctor` to show dep versions diff --git a/scripts/pyinstaller/hooks/hook-dvc.system.py b/dvc/__pyinstaller/hook-dvc.system.py similarity index 77% rename from scripts/pyinstaller/hooks/hook-dvc.system.py rename to dvc/__pyinstaller/hook-dvc.system.py index 41afd5bf6..1b35a072b 100644 --- a/scripts/pyinstaller/hooks/hook-dvc.system.py +++ b/dvc/__pyinstaller/hook-dvc.system.py @@ -1,3 +1,4 @@ +# ruff: noqa: N999 import os if os.name == "nt": diff --git a/scripts/pyinstaller/hooks/hook-dvc.tree.gs.py b/dvc/__pyinstaller/hook-dvc.tree.gs.py similarity index 94% rename from scripts/pyinstaller/hooks/hook-dvc.tree.gs.py rename to dvc/__pyinstaller/hook-dvc.tree.gs.py index 8c36c8471..cd101983b 100644 --- a/scripts/pyinstaller/hooks/hook-dvc.tree.gs.py +++ b/dvc/__pyinstaller/hook-dvc.tree.gs.py @@ -1,3 +1,4 @@ +# ruff: noqa: N999 from PyInstaller.utils.hooks import copy_metadata # pylint:disable=import-error datas = copy_metadata("google-cloud-storage") diff --git a/scripts/pyinstaller/hooks/hook-dvc.utils.flatten.py b/dvc/__pyinstaller/hook-dvc.utils.flatten.py similarity index 86% rename from scripts/pyinstaller/hooks/hook-dvc.utils.flatten.py rename to dvc/__pyinstaller/hook-dvc.utils.flatten.py index bc23f359f..8d5cea5a1 100644 --- a/scripts/pyinstaller/hooks/hook-dvc.utils.flatten.py +++ b/dvc/__pyinstaller/hook-dvc.utils.flatten.py @@ -1,3 +1,4 @@ +# ruff: noqa: N999 from PyInstaller.utils.hooks import copy_metadata # pylint:disable=import-error datas = copy_metadata("flatten-dict") diff --git a/scripts/pyinstaller/hooks/hook-dvc_task.py b/dvc/__pyinstaller/hook-dvc_task.py similarity index 87% rename from scripts/pyinstaller/hooks/hook-dvc_task.py rename to dvc/__pyinstaller/hook-dvc_task.py index 6a46c85dd..6f6972b88 100644 --- a/scripts/pyinstaller/hooks/hook-dvc_task.py +++ b/dvc/__pyinstaller/hook-dvc_task.py @@ -1,3 +1,4 @@ +# ruff: noqa: N999 # pylint: disable=import-error from PyInstaller.utils.hooks import collect_submodules diff --git a/scripts/pyinstaller/hooks/hook-fsspec.py b/dvc/__pyinstaller/hook-fsspec.py similarity index 72% rename from scripts/pyinstaller/hooks/hook-fsspec.py rename to dvc/__pyinstaller/hook-fsspec.py index 4ffcf6f74..9e0b58294 100644 --- a/scripts/pyinstaller/hooks/hook-fsspec.py +++ b/dvc/__pyinstaller/hook-fsspec.py @@ -1 +1,2 @@ +# ruff: noqa: N999 hiddenimports = ["fsspec.implementations.memory"] diff --git a/scripts/pyinstaller/hooks/hook-google_compute_engine.logger.py b/dvc/__pyinstaller/hook-google_compute_engine.logger.py similarity index 89% rename from scripts/pyinstaller/hooks/hook-google_compute_engine.logger.py rename to dvc/__pyinstaller/hook-google_compute_engine.logger.py index 9cc2aec62..d7c29559c 100644 --- a/scripts/pyinstaller/hooks/hook-google_compute_engine.logger.py +++ b/dvc/__pyinstaller/hook-google_compute_engine.logger.py @@ -1,3 +1,4 @@ +# ruff: noqa: N999 from PyInstaller.utils.hooks import copy_metadata # pylint:disable=import-error datas = copy_metadata("google-compute-engine") diff --git a/scripts/pyinstaller/hooks/hook-pydrive2.py b/dvc/__pyinstaller/hook-pydrive2.py similarity index 85% rename from scripts/pyinstaller/hooks/hook-pydrive2.py rename to dvc/__pyinstaller/hook-pydrive2.py index 6315db70b..55f5d5fcc 100644 --- a/scripts/pyinstaller/hooks/hook-pydrive2.py +++ b/dvc/__pyinstaller/hook-pydrive2.py @@ -1,3 +1,4 @@ +# ruff: noqa: N999 from PyInstaller.utils.hooks import copy_metadata # pylint:disable=import-error datas = copy_metadata("pydrive2") diff --git a/pyproject.toml b/pyproject.toml index b2a8b43dc..9c94eb835 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -82,6 +82,7 @@ lint = [ "types-tabulate", "types-toml", "types-tqdm", + "types-pyinstaller", ] oss = ["dvc-oss==2.19"] s3 = ["dvc-s3==2.23.0"] @@ -128,6 +129,10 @@ dvc = "dvc.api:DVCFileSystem" [project.entry-points."pytest11"] dvc-testing = "dvc.testing.plugin" +[project.entry-points."pyinstaller40"] +hook-dirs = "dvc.__pyinstaller:get_hook_dirs" +tests = "dvc.__pyinstaller:get_PyInstaller_tests" + [tool.setuptools] license-files = ["LICENSE"] diff --git a/scripts/build-requirements.txt b/scripts/build-requirements.txt deleted file mode 100644 index a5bb9206b..000000000 --- a/scripts/build-requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -# NOTE: using strict version due to -# https://github.com/iterative/dvc/issues/7949 -PyInstaller==5.9.0 diff --git a/scripts/pyinstaller/.gitignore b/scripts/pyinstaller/.gitignore deleted file mode 100644 index 1f1748b55..000000000 --- a/scripts/pyinstaller/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/build -/dist -/dvc.spec -/dvc diff --git a/scripts/pyinstaller/build.py b/scripts/pyinstaller/build.py deleted file mode 100644 index cdfd63e6a..000000000 --- a/scripts/pyinstaller/build.py +++ /dev/null @@ -1,47 +0,0 @@ -import os -import pathlib -from subprocess import STDOUT, check_call, check_output - -path = pathlib.Path(__file__).parent.absolute() -hooks = path / "hooks" -dvc = path.parent.parent / "dvc" -entry = dvc / "__main__.py" - -check_call( - [ - "pyinstaller", - "--additional-hooks-dir", - os.fspath(hooks), - "--name", - "dvc", - "-y", - os.fspath(entry), - ], - cwd=path, - stderr=STDOUT, -) - -out = check_output( - [ - path / "dist" / "dvc" / "dvc", - "doctor", - ], - stderr=STDOUT, -).decode() - -remotes = [ - "s3", - "oss", - "gdrive", - "gs", - "hdfs", - "http", - "webhdfs", - "azure", - "ssh", - "webdav", -] - -print(out) -for remote in remotes: - assert f"\t{remote}" in out, f"Missing support for {remote}"