make_tarball.py
25 lines
| 749 B
| text/x-python
|
PythonLexer
/ tools / make_tarball.py
Fernando Perez
|
r1206 | #!/usr/bin/env python | ||
Fernando Perez
|
r3135 | """Simple script to create a tarball with proper git info. | ||
Fernando Perez
|
r1206 | """ | ||
ville
|
r988 | |||
Fernando Perez
|
r3135 | import commands | ||
Fernando Perez
|
r2118 | import os | ||
import sys | ||||
import shutil | ||||
Ville M. Vainio
|
r1197 | |||
Fernando Perez
|
r2118 | from toollib import * | ||
ville
|
r988 | |||
Fernando Perez
|
r3199 | tag = commands.getoutput('git describe --tags') | ||
Fernando Perez
|
r3135 | base_name = 'ipython-%s' % tag | ||
tar_name = '%s.tgz' % base_name | ||||
ville
|
r988 | |||
Fernando Perez
|
r3135 | # git archive is weird: Even if I give it a specific path, it still won't | ||
# archive the whole tree. It seems the only way to get the whole tree is to cd | ||||
# to the top of the tree. There are long threads (since 2007) on the git list | ||||
# about this and it still doesn't work in a sensible way... | ||||
Ville M. Vainio
|
r1068 | |||
Jörgen Stenarson
|
r4208 | start_dir = os.getcwdu() | ||
Fernando Perez
|
r3135 | cd('..') | ||
git_tpl = 'git archive --format=tar --prefix={0}/ HEAD | gzip > {1}' | ||||
Fernando Perez
|
r3197 | sh(git_tpl.format(base_name, tar_name)) | ||
sh('mv {0} tools/'.format(tar_name)) | ||||