Skip to content

Commit

Permalink
download: use full git clone
Browse files Browse the repository at this point in the history
  • Loading branch information
efiop committed Oct 22, 2021
1 parent feb75ef commit faa4127
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
with:
python-version: 3.8
- name: Install deps
run: pip install wget
run: pip install git
- name: Download
run: python download.py
- name: Build and sign
Expand Down
20 changes: 6 additions & 14 deletions download.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import git
import os
import pathlib
import posixpath
import shutil
import tarfile

import wget

VERSION = "2.8.2"
URL = f"https://github.com/iterative/dvc/archive/{VERSION}.tar.gz"
URL = "https://github.com/iterative/dvc"

path = pathlib.Path(__file__).parent.absolute()
dvc = path / "dvc"
Expand All @@ -17,16 +16,9 @@
except FileNotFoundError:
pass

tar = path / posixpath.basename(URL)
# NOTE: need full git clone for version detection
# by setuptools-scm
repo = git.Repo.clone_from(URL, dvc)
repo.git.checkout(VERSION)

try:
tar.unlink()
except FileNotFoundError:
pass

wget.download(URL, out=os.fspath(tar))

with tarfile.open(tar) as tobj:
tobj.extractall()

os.rename(tar.with_name(f"dvc-{VERSION}"), dvc)

5 comments on commit faa4127

@skshetry
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use setuptools_scm_git_archive for this, which will use version info from git archive, instead of cloning a Repo.

@efiop
Copy link
Contributor Author

@efiop efiop commented on faa4127 Oct 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, didn't know that. It is complimentary to the setuptools-scm? So we need to start in dvc first?

@skshetry
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a plugin for setuptools_scm.

It may soon be available in setuptools_scm itself, there's a WIP PR in pypa/setuptools-scm#580.

We do need to start using that plugin for the time being in DVC first.

@skshetry
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though, the question is how much do we need this? Maybe we can wait for the feature to be in setuptools_scm itself?

@efiop
Copy link
Contributor Author

@efiop efiop commented on faa4127 Oct 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@skshetry Yeah, totally can wait. Full clones are an easy workaround, no need to rush it with setuptools plugin. Other. than that hickup, everything else is working out really nice. Great job with setuptools_scm! πŸ™

Please sign in to comment.