35
def _write_git_version():
36
""" Write the revision to a file called GIT_VERSION,
37
to grab the current version number from git when
38
generating the dist tarball."""
39
version = _get_git_version()
42
version_file = open("GIT_VERSION", "w")
43
version_file.write(version + "\n")
35
48
_read_git_version()
37
VERSION_MAJOR_MINOR = ".".join(VERSION.split(".")[0:2])
39
50
# these variables are mandatory ('/' are converted automatically)
44
"""in the dist preparation dir, delete unwanted files"""
50
for ignfile in filter(os.path.exists, DIST_GIT_IGNORE):
59
def _tarfile_append_as(tarname, filename, destname):
61
tf = tarfile.TarFile.open(tarname, "a")
63
tf.add(filename, destname)
68
"""Make the release tarball using git-archive"""
70
if not _write_git_version():
71
raise Exception("No version")
72
basename = "%s-%s" % (APPNAME, VERSION)
73
outname = basename + ".tar"
74
proc = subprocess.Popen(
75
["git", "archive", "--format=tar", "--prefix=%s/" % basename, "HEAD"],
76
stdout=subprocess.PIPE)
77
fd = os.open(outname, os.O_CREAT | os.O_EXCL | os.O_WRONLY, 0666)
78
os.write(fd, proc.communicate()[0])
80
for distfile in EXTRA_DIST:
81
_tarfile_append_as(outname, distfile, os.path.join(basename, distfile))
82
subprocess.call(["gzip", outname])
83
subprocess.call(["sha1sum", outname + ".gz"])
54
"""Make the dist tarball and print its SHA-1 """
55
def write_git_version():
56
""" Write the revision to a file called GIT_VERSION,
57
to grab the current version number from git when
58
generating the dist tarball."""
59
version = _get_git_version()
62
version_file = open("GIT_VERSION", "w")
63
version_file.write(version + "\n")
86
"The standard waf dist process"
69
89
Scripting.g_gz = "gz"
70
90
Scripting.dist(APPNAME, VERSION)
72
93
def set_options(opt):
73
94
# options for disabling pyc or pyo compilation
74
95
opt.tool_options("python")