blob: 9432973843bf47881153706af2e76058dba93a6d [file] [log] [blame]
Justab5753c1999-12-18 23:05:58 +00001#! /usr/bin/env python
Justf898c411999-12-18 23:28:54 +00002#
3# Script to make a compressed tar archive of the directory
4# the script is living in, excluding CVS directories and the
5# script itself.
6#
jvr3b18bda2001-08-10 16:49:17 +00007# $Id: mktarball.py,v 1.8 2001-08-10 16:49:17 jvr Exp $
Justf898c411999-12-18 23:28:54 +00008#
9
Justab5753c1999-12-18 23:05:58 +000010
Just39ee0f51999-12-18 23:09:30 +000011import os, sys
Justab5753c1999-12-18 23:05:58 +000012
jvr3b18bda2001-08-10 16:49:17 +000013
just0b99c892000-02-13 17:36:44 +000014program = os.path.normpath(sys.argv[0])
15script = os.path.join(os.getcwd(), program)
justb14adec1999-12-18 23:56:14 +000016srcdir, scriptname = os.path.split(script)
17wdir, src = os.path.split(srcdir)
just0b99c892000-02-13 17:36:44 +000018
jvr3b18bda2001-08-10 16:49:17 +000019try:
20 execfile(os.path.join(srcdir, "Lib", "fontTools", "__init__.py"))
21 version # make sure we now have a variable named "version"
22except (IOError, NameError):
23 version = None
24
25
just0b99c892000-02-13 17:36:44 +000026destdir = None
27if sys.argv[1:]:
28 destdir = os.path.normpath(os.path.join(os.getcwd(), sys.argv[1]))
29 assert os.path.isdir(destdir), "destination is not an existing directory"
30
justb14adec1999-12-18 23:56:14 +000031os.chdir(wdir)
32
jvr3b18bda2001-08-10 16:49:17 +000033if version:
34 tar = src + "-%s.tar" % version
35else:
36 tar = src + ".tar"
Justab5753c1999-12-18 23:05:58 +000037gz = tar + ".gz"
Justab5753c1999-12-18 23:05:58 +000038
justc3d34ae1999-12-18 23:25:16 +000039print "source:", src
just0b99c892000-02-13 17:36:44 +000040print "dest:", gz
justc3d34ae1999-12-18 23:25:16 +000041
justb14adec1999-12-18 23:56:14 +000042os.system('tar --exclude=CVS --exclude=%s -cf %s %s' % (scriptname, tar, src))
Just7dd75ab1999-12-18 23:10:58 +000043os.system('gzip -9v %s' % tar)
just0b99c892000-02-13 17:36:44 +000044
45if destdir:
46 print "destination directory:", destdir
47 os.system('mv %s %s' % (gz, destdir))
48