File: cleanup_tmpdirs.patch

package info (click to toggle)
python-virtualenv 1.7.1.2-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 2,880 kB
  • sloc: sh: 4,940; python: 2,992; makefile: 20; csh: 18
file content (43 lines) | stat: -rw-r--r-- 1,169 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Description: Cleanup temporary directory created with mkdtemp()
Author: Stefano Rivera <stefanor@debian.org>
Forwarded: https://github.com/pypa/virtualenv/pull/231
Bug-Debian: http://bugs.debian.org/661272
Date:   Sat Feb 25 22:07:41 2012 +0200

--- a/virtualenv.py
+++ b/virtualenv.py
@@ -568,6 +568,8 @@
     finally:
         logger.indent -= 2
         logger.end_progress()
+        if cwd is not None:
+            shutil.rmtree(cwd)
         if os.getcwd() != old_chdir:
             os.chdir(old_chdir)
         if is_jython and os._name == 'nt':
--- a/virtualenv_embedded/distribute_setup.py
+++ b/virtualenv_embedded/distribute_setup.py
@@ -14,6 +14,7 @@
 This file can also be run as a script to install or upgrade setuptools.
 """
 import os
+import shutil
 import sys
 import time
 import fnmatch
@@ -86,6 +87,7 @@
             log.warn('See the error message above.')
     finally:
         os.chdir(old_wd)
+        shutil.rmtree(tmpdir)
 
 
 def _build_egg(egg, tarball, to_dir):
@@ -110,6 +112,7 @@
 
     finally:
         os.chdir(old_wd)
+        shutil.rmtree(tmpdir)
     # returning the result
     log.warn(egg)
     if not os.path.exists(egg):