# HG changeset patch # User Jeff Hammel # Date 1310347074 25200 # Node ID bb19d3dac4c571d485d1599df869f64bbcca8a73 # Parent 987086aad2348e21a6d02c35057a1cd4f556026e fix tests diff -r 987086aad234 -r bb19d3dac4c5 README.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README.txt Sun Jul 10 18:17:54 2011 -0700 @@ -0,0 +1,1 @@ +See the docstring of carton.py for documentation diff -r 987086aad234 -r bb19d3dac4c5 carton.py --- a/carton.py Fri Jul 08 18:25:31 2011 -0700 +++ b/carton.py Sun Jul 10 18:17:54 2011 -0700 @@ -186,12 +186,16 @@ # package up the source if applicable if options.package and os.path.exists(os.path.join(source, 'setup.py')): - call([sys.executable, 'setup.py', 'sdist'], cwd=source) + + # create a .tar.gz package + call([sys.executable, 'setup.py', 'sdist'], cwd=source, stdout=subprocess.PIPE) dist_dir = os.path.join(source, 'dist') assert os.path.isdir(dist_dir), "dist directory not created in %s" % source tarfiles = [i for i in os.listdir(dist_dir) if i.endswith('.tar.gz')] assert tarfiles, "no .tar.gz files found in %s" % dist_dir + + # use the last modified tarball def last_modified(filename): return os.path.getmtime(os.path.join(dist_dir, filename)) tarfiles.sort(key=last_modified) @@ -201,6 +205,7 @@ # check for a tarball buffer = file(source).read() else: + # add other sources (files and directories) to the archive source_buffer = StringIO() source_tar = tarfile.open(mode="w:gz", fileobj=source_buffer) source_tar.add(source, arcname=os.path.basename(source)) diff -r 987086aad234 -r bb19d3dac4c5 tests/doctest.txt --- a/tests/doctest.txt Fri Jul 08 18:25:31 2011 -0700 +++ b/tests/doctest.txt Sun Jul 10 18:17:54 2011 -0700 @@ -33,8 +33,9 @@ Find a console script. This shows installation went well:: - >>> bin = [os.path.join('foo', i) for i in ('bin', 'Scripts) if os.path.exists(os.path.join('foo', i))][0] - >>> os.path.exists(bin) # just to make sure + >>> bin = [os.path.join('foo', i) for i in ('bin', 'Scripts') if os.path.exists(os.path.join('foo', i))][0] + >>> os.path.isdir(bin) + True >>> os.path.exists(os.path.join(bin, 'packageA')) or os.path.exists(os.path.join(bin, 'packageA.exe')) True @@ -55,7 +56,7 @@ True >>> srcdir = os.path.join('fleem', 'src') >>> packageA = os.path.join(srcdir, [i for i in os.listdir(srcdir) if i.startswith('packageA')][0]) - >>> os.path.exists(os.path.join(packageA 'foo.txt')) + >>> os.path.exists(os.path.join(packageA, 'foo.txt')) False Clean up:: diff -r 987086aad234 -r bb19d3dac4c5 tests/packageA/README.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/packageA/README.txt Sun Jul 10 18:17:54 2011 -0700 @@ -0,0 +1,1 @@ +packageA diff -r 987086aad234 -r bb19d3dac4c5 tests/packageB/README.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/packageB/README.txt Sun Jul 10 18:17:54 2011 -0700 @@ -0,0 +1,1 @@ +packageB