diff options
| author | eroen | 2013-11-16 18:07:41 +0100 |
|---|---|---|
| committer | eroen | 2013-11-16 18:17:04 +0100 |
| commit | 45c68bceb89550d45f68c0b0be5f976433c8e146 (patch) | |
| tree | 3b268d92dbdbd8e766053ed621d29afe34cc80c0 | |
| parent | 62231153c3ee4de552083375617b5c98525989fb (diff) | |
| download | git-annex-wrapper-45c68bceb89550d45f68c0b0be5f976433c8e146.tar.gz git-annex-wrapper-45c68bceb89550d45f68c0b0be5f976433c8e146.tar.bz2 git-annex-wrapper-45c68bceb89550d45f68c0b0be5f976433c8e146.tar.xz | |
add url to annex
| -rw-r--r-- | ga_wrapper/wrapper.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/ga_wrapper/wrapper.py b/ga_wrapper/wrapper.py index 72676b9..e4d3ba1 100644 --- a/ga_wrapper/wrapper.py +++ b/ga_wrapper/wrapper.py @@ -17,6 +17,13 @@ def fallthrough(args): return proc.wait() +def ga_addurl(src, outfile, repo='.'): + os.chdir(repo) + proc = subprocess.Popen(['git', 'annex', 'addurl', + '--file={f}'.format(f=outfile), src]) + proc.communicate() + + def wget_wrapper(args): print('emulating wget for ', ' '.join(args)) if args[0].endswith('wget'): @@ -40,8 +47,9 @@ def wget_wrapper(args): os.chdir(repo) # portage silently deletes symlinks - proc = subprocess.Popen(['git', 'checkout', outfile]) + proc = subprocess.Popen(['git', 'checkout', '--', outfile]) proc.communicate() + ga_addurl(src, outfile) proc = subprocess.Popen(['git', 'annex', 'whereis', outfile], stdout=subprocess.PIPE) (stdoutdata, _) = proc.communicate() |
