Index: Lib/shutil.py =================================================================== --- Lib/shutil.py (revision 86482) +++ Lib/shutil.py (working copy) @@ -353,7 +353,8 @@ archive_dir = os.path.dirname(archive_name) if not os.path.exists(archive_dir): - logger.info("creating %s" % archive_dir) + if logger is not None: + logger.info("creating %s" % archive_dir) if not dry_run: os.makedirs(archive_dir) Index: Lib/test/test_shutil.py =================================================================== --- Lib/test/test_shutil.py (revision 86482) +++ Lib/test/test_shutil.py (working copy) @@ -340,6 +340,33 @@ shutil.rmtree(TESTFN2, ignore_errors=True) @unittest.skipUnless(zlib, "requires zlib") + def test_make_tarball_new_directory(self): + # creating something to tar + tmpdir = self.mkdtemp() + self.write_file([tmpdir, 'file1'], 'xxx') + self.write_file([tmpdir, 'file2'], 'xxx') + os.mkdir(os.path.join(tmpdir, 'sub')) + self.write_file([tmpdir, 'sub', 'file3'], 'xxx') + + tmpdir2 = self.mkdtemp() + unittest.skipUnless(splitdrive(tmpdir)[0] == splitdrive(tmpdir2)[0], + "source and target should be on same drive") + + base_name = os.path.join(tmpdir2, 'new', 'archive') + + # working with relative paths to avoid tar warnings + old_dir = os.getcwd() + os.chdir(tmpdir) + try: + _make_tarball(splitdrive(base_name)[1], '.') + finally: + os.chdir(old_dir) + + # check if the compressed tarball was created + tarball = base_name + '.tar.gz' + self.assertTrue(os.path.exists(tarball)) + + @unittest.skipUnless(zlib, "requires zlib") def test_make_tarball(self): # creating something to tar tmpdir = self.mkdtemp()