diff --git a/dvc/repo/pkg.py b/dvc/repo/pkg.py index 9b2ffd9e0..b58d08108 100644 --- a/dvc/repo/pkg.py +++ b/dvc/repo/pkg.py @@ -2,12 +2,11 @@ from __future__ import unicode_literals import os import shutil -from git.cmd import Git import dvc.logger as logger from dvc.exceptions import DvcException from dvc.stage import Stage -from dvc.temp_git_repo import TempGitRepo +from dvc.scm.git.temp_git_repo import TempGitRepo class PackageParams(object): @@ -60,6 +59,8 @@ class GitPackage(Package): DEF_DVC_FILE_PREFIX = "mod_" def install_or_update(self, parent_repo, pkg_params): + from git.cmd import Git + if not self.is_in_root(): raise DvcException( "This command can be run only from a repository root" diff --git a/dvc/temp_git_repo.py b/dvc/scm/git/temp_git_repo.py similarity index 99% rename from dvc/temp_git_repo.py rename to dvc/scm/git/temp_git_repo.py index 6f2c90875..7faf30868 100644 --- a/dvc/temp_git_repo.py +++ b/dvc/scm/git/temp_git_repo.py @@ -2,8 +2,6 @@ import os import shutil import tempfile -import git - from dvc import logger from dvc.exceptions import DvcException @@ -70,6 +68,8 @@ class TempGitRepo(object): return self def _clone_to_temp_dir(self): + import git + result = tempfile.mktemp( prefix=self._tmp_mod_prefix, dir=self.modules_dir )