diff options
| author | Ned Batchelder <ned@nedbatchelder.com> | 2010-09-09 10:39:04 -0400 |
|---|---|---|
| committer | Ned Batchelder <ned@nedbatchelder.com> | 2010-09-09 10:39:04 -0400 |
| commit | a676134708f7ac8a5f2ebaeed76a361e4d7c3f42 (patch) | |
| tree | 2a7a8321c523d93eb9fd686458c254095db31e93 /distcmd | |
| parent | 5f894db401955ee46d50af74583ec4af586dbacf (diff) | |
| download | python-coveragepy-git-a676134708f7ac8a5f2ebaeed76a361e4d7c3f42.tar.gz | |
Moved fixtar into its own project: http://bitbucket.org/ned/fixtar
Diffstat (limited to 'distcmd')
| -rw-r--r-- | distcmd/__init__.py | 1 | ||||
| -rw-r--r-- | distcmd/fixtar.py | 63 |
2 files changed, 0 insertions, 64 deletions
diff --git a/distcmd/__init__.py b/distcmd/__init__.py deleted file mode 100644 index 9444cab7..00000000 --- a/distcmd/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""New custom commands for setup.py""" diff --git a/distcmd/fixtar.py b/distcmd/fixtar.py deleted file mode 100644 index c613c9d7..00000000 --- a/distcmd/fixtar.py +++ /dev/null @@ -1,63 +0,0 @@ -"""Add a 'fixtar' command to setup.py. - -This lets us have proper permissions in tar files made on Windows. - -""" -from distutils.core import Command -import shutil, tarfile - -class fixtar(Command): - """A new setup.py command to fix tar file permissions.""" - - description = "Re-pack the tar file to have correct permissions." - - user_options = [] - - def initialize_options(self): - """Required by Command, even though I have nothing to add.""" - pass - - def finalize_options(self): - """Required by Command, even though I have nothing to add.""" - pass - - def run(self): - """The body of the command.""" - for _, _, filename in self.distribution.dist_files: - if filename.endswith(".tar.gz"): - self.repack_tar(filename, "temp.tar.gz") - shutil.move("temp.tar.gz", filename) - - def repack_tar(self, infilename, outfilename): - """Re-pack `infilename` as `outfilename`. - - Permissions and owners are set the way we like them. - Also deletes the source directory, due to unfortunate setup.py - mechanics. - - """ - itar = tarfile.open(infilename, "r:gz") - otar = tarfile.open(outfilename, "w:gz") - the_dir = None - for itarinfo in itar: - otarinfo = otar.gettarinfo(itarinfo.name) - if the_dir is None: - n = itarinfo.name.rstrip("/") - assert "/" not in n - the_dir = n - if itarinfo.isfile(): - otarinfo.mode = 0644 - else: - otarinfo.mode = 0755 - otarinfo.uid = 100 - otarinfo.gid = 100 - otarinfo.uname = "ned" - otarinfo.gname = "coverage" - otar.addfile(otarinfo, itar.extractfile(itarinfo)) - itar.close() - otar.close() - - # To make this work, sdist has to be run with the --keep-temp option. - # But the clean command doesn't clean up the temp directory. - # Delete it here. - shutil.rmtree(the_dir) |
