https://github.com/python-versioneer/python-versioneer/pull/394 --- versioneer-0.29/test/git/test_invocations.py.orig +++ versioneer-0.29/test/git/test_invocations.py @@ -110,7 +110,7 @@ def make_demolib_sdist(self): # create an sdist of demolib-1.0 . for the *lib*, we only use the # tarball, never the repo. - demolib_sdist = self.subpath("cache", "demolib-1.0.tar") + demolib_sdist = self.subpath("cache", "demolib-1.0.tar.gz") if os.path.exists(demolib_sdist): return demolib_sdist libdir = self.subpath("build-demolib") @@ -121,8 +121,8 @@ self.git("add", "--all", workdir=libdir) self.git("commit", "-m", "comment", workdir=libdir) self.git("tag", "demolib-1.0", workdir=libdir) - self.python("setup.py", "sdist", "--format=tar", workdir=libdir) - created = os.path.join(libdir, "dist", "demolib-1.0.tar") + self.python("setup.py", "sdist", "--format=gztar", workdir=libdir) + created = os.path.join(libdir, "dist", "demolib-1.0.tar.gz") self.assertTrue(os.path.exists(created)) shutil.copyfile(created, demolib_sdist) return demolib_sdist @@ -164,7 +164,7 @@ if os.path.exists(unpack_into): shutil.rmtree(unpack_into) os.mkdir(unpack_into) - with tarfile.TarFile(sdist) as t: + with tarfile.open(sdist, "r:gz") as t: t.extractall(path=unpack_into) unpacked = os.path.join(unpack_into, "demoappext-2.0") self.assertTrue(os.path.exists(unpacked)) @@ -173,12 +173,12 @@ def make_setuptools_extension_sdist(self): # create an sdist tarball of demoappext-setuptools at 2.0 demoappext_setuptools_sdist = self.subpath("cache", "setuptools", - "demoappext-2.0.tar") + "demoappext-2.0.tar.gz") if os.path.exists(demoappext_setuptools_sdist): return demoappext_setuptools_sdist repodir = self.make_setuptools_extension_repo() - self.python("setup.py", "sdist", "--format=tar", workdir=repodir) - created = os.path.join(repodir, "dist", "demoappext-2.0.tar") + self.python("setup.py", "sdist", "--format=gztar", workdir=repodir) + created = os.path.join(repodir, "dist", "demoappext-2.0.tar.gz") self.assertTrue(os.path.exists(created), created) shutil.copyfile(created, demoappext_setuptools_sdist) return demoappext_setuptools_sdist @@ -216,24 +216,24 @@ def make_setuptools_sdist(self): # create an sdist tarball of demoapp2-setuptools at 2.0 demoapp2_setuptools_sdist = self.subpath("cache", "setuptools", - "demoapp2-2.0.tar") + "demoapp2-2.0.tar.gz") if os.path.exists(demoapp2_setuptools_sdist): return demoapp2_setuptools_sdist repodir = self.make_setuptools_repo() - self.python("setup.py", "sdist", "--format=tar", workdir=repodir) - created = os.path.join(repodir, "dist", "demoapp2-2.0.tar") + self.python("setup.py", "sdist", "--format=gztar", workdir=repodir) + created = os.path.join(repodir, "dist", "demoapp2-2.0.tar.gz") self.assertTrue(os.path.exists(created), created) shutil.copyfile(created, demoapp2_setuptools_sdist) return demoapp2_setuptools_sdist def make_setuptools_sdist_subproject(self): demoapp2_setuptools_sdist = self.subpath("cache", "setuptools", - "demoapp2-subproject-2.0.tar") + "demoapp2-subproject-2.0.tar.gz") if os.path.exists(demoapp2_setuptools_sdist): return demoapp2_setuptools_sdist projectdir = self.make_setuptools_repo_subproject() - self.python("setup.py", "sdist", "--format=tar", workdir=projectdir) - created = os.path.join(projectdir, "dist", "demoapp2-2.0.tar") + self.python("setup.py", "sdist", "--format=gztar", workdir=projectdir) + created = os.path.join(projectdir, "dist", "demoapp2-2.0.tar.gz") self.assertTrue(os.path.exists(created), created) shutil.copyfile(created, demoapp2_setuptools_sdist) return demoapp2_setuptools_sdist @@ -244,7 +244,7 @@ if os.path.exists(unpack_into): shutil.rmtree(unpack_into) os.mkdir(unpack_into) - with tarfile.TarFile(sdist) as t: + with tarfile.open(sdist, "r:gz") as t: t.extractall(path=unpack_into) unpacked = os.path.join(unpack_into, "demoapp2-2.0") self.assertTrue(os.path.exists(unpacked)) @@ -256,7 +256,7 @@ if os.path.exists(unpack_into): shutil.rmtree(unpack_into) os.mkdir(unpack_into) - with tarfile.TarFile(sdist) as t: + with tarfile.open(sdist, "r:gz") as t: t.extractall(path=unpack_into) unpacked = os.path.join(unpack_into, "demoapp2-2.0") self.assertTrue(os.path.exists(unpacked)) @@ -380,13 +380,13 @@ def test_sdist(self): sdist = self.make_setuptools_sdist() # asserts version as a side-effect # make sure we used setuptools/sdist, not distutils/sdist - with tarfile.TarFile(sdist) as t: + with tarfile.open(sdist, "r:gz") as t: self.assertIn("demoapp2-2.0/src/demoapp2.egg-info/PKG-INFO", t.getnames()) def test_sdist_subproject(self): sdist = self.make_setuptools_sdist_subproject() # make sure we used setuptools/sdist, not distutils/sdist - with tarfile.TarFile(sdist) as t: + with tarfile.open(sdist, "r:gz") as t: self.assertIn("demoapp2-2.0/src/demoapp2.egg-info/PKG-INFO", t.getnames()) def test_pip_install(self):