Debian Codegraph @

tools/make_tarball.py

raw
1 #!/usr/bin/env python
2 """Simple script to create a tarball with proper git info.
3 """
4
5 import subprocess
6
7 from toollib import cd, sh
8
9 tag = subprocess.check_output('git describe --tags', shell=True).decode('utf8', 'replace').strip()
10 base_name = 'ipython-%s' % tag
11 tar_name = '%s.tgz' % base_name
12
13 # git archive is weird: Even if I give it a specific path, it still won't
14 # archive the whole tree. It seems the only way to get the whole tree is to cd
15 # to the top of the tree. There are long threads (since 2007) on the git list
16 # about this and it still doesn't work in a sensible way...
17
18 cd('..')
19 git_tpl = 'git archive --format=tar --prefix={0}/ HEAD | gzip > {1}'
20 sh(git_tpl.format(base_name, tar_name))
21 sh('mv {0} tools/'.format(tar_name))