<commit_before>#! /usr/bin/env python
#
# Script to make a compressed tar archive of the directory 
# the script is living in, excluding CVS directories and the 
# script itself.
#
# $Id: mktarball.py,v 1.6 1999-12-18 23:56:14 just Exp $
#


import os, sys

script = os.path.join(os.getcwd(), sys.argv[0])
srcdir, scriptname = os.path.split(script)
wdir, src = os.path.split(srcdir)
os.chdir(wdir)

tar = src + ".tar"
gz = tar + ".gz"
tgz = src + ".tgz"

print "source:", src
print "dest:", tgz

os.system('tar --exclude=CVS --exclude=%s -cf %s %s' % (scriptname, tar, src))
os.system('gzip -9v %s' % tar)
os.rename(gz, tgz)<commit_msg>some improvements; can optionally specify dest dir<commit_after>#! /usr/bin/env python
#
# Script to make a compressed tar archive of the directory 
# the script is living in, excluding CVS directories and the 
# script itself.
#
# $Id: mktarball.py,v 1.7 2000-02-13 17:36:44 just Exp $
#


import os, sys

program = os.path.normpath(sys.argv[0])
script = os.path.join(os.getcwd(), program)
srcdir, scriptname = os.path.split(script)
wdir, src = os.path.split(srcdir)

destdir = None
if sys.argv[1:]:
	destdir = os.path.normpath(os.path.join(os.getcwd(), sys.argv[1]))
	assert os.path.isdir(destdir), "destination is not an existing directory"

os.chdir(wdir)

tar = src + ".tar"
gz = tar + ".gz"

print "source:", src
print "dest:", gz

os.system('tar --exclude=CVS --exclude=%s -cf %s %s' % (scriptname, tar, src))
os.system('gzip -9v %s' % tar)

if destdir:
	print "destination directory:", destdir
	os.system('mv %s %s' % (gz, destdir))

{'fraction_non_alphanumeric': 0.16613823715916295, 'fraction_numerical': 0.024096385542168676, 'mean_word_length': 4.090322580645161, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5469501', 'n_tokens_mistral': 639, 'n_tokens_neox': 605, 'n_words': 178}