def install_git(self, package): from poetry.packages import Package from poetry.utils._compat import Path from poetry.utils.helpers import temporary_directory from poetry.vcs import Git with temporary_directory() as tmp_dir: tmp_dir = Path(tmp_dir) git = Git() git.clone(package.source_url, tmp_dir) git.checkout(package.source_reference, tmp_dir) # Now we just need to install from the temporary directory pkg = Package(package.name, package.version) pkg.source_type = "directory" pkg.source_url = str(tmp_dir) pkg.develop = False self.install_directory(pkg)
def install_git(self, package): from poetry.packages import Package from poetry.vcs import Git src_dir = self._env.path / "src" / package.name if src_dir.exists(): safe_rmtree(str(src_dir)) src_dir.parent.mkdir(exist_ok=True) git = Git() git.clone(package.source_url, src_dir) git.checkout(package.source_reference, src_dir) # Now we just need to install from the source directory pkg = Package(package.name, package.version) pkg.source_type = "directory" pkg.source_url = str(src_dir) pkg.develop = package.develop self.install_directory(pkg)