Skip to content

Commit 63b07f8

Browse files
committed
hide extensions in tmp
1 parent 4c4b37d commit 63b07f8

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

igor.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def remove_extension(core, *args):
6565
tracer.*.pyd
6666
""".split()
6767

68-
if 1: # "--from-install" in args:
68+
if "--from-install" in args:
6969
# Get the install location using a subprocess to avoid
7070
# locking the file we are about to delete
7171
root = os.path.dirname(
@@ -88,16 +88,20 @@ def remove_extension(core, *args):
8888
".tox/*/[Ll]ib/site-packages/coverage",
8989
]
9090

91+
os.makedirs("tmp", exist_ok=True)
9192
for root, pattern in itertools.product(roots, so_patterns):
9293
pattern = os.path.join(root, pattern)
9394
if VERBOSITY > 1:
9495
print(f"Searching for {pattern} from {os.getcwd()}")
9596
for filename in glob.glob(pattern):
9697
if os.path.exists(filename):
9798
if VERBOSITY > 1:
98-
print(f"Removing {os.path.abspath(filename)}")
99+
print(f"Hiding {os.path.abspath(filename)} in tmp")
99100
try:
100-
os.remove(filename)
101+
hidden = f"tmp/{os.path.basename(filename)}"
102+
if os.path.exists(hidden):
103+
os.remove(hidden)
104+
os.rename(filename, hidden)
101105
except OSError as exc:
102106
if VERBOSITY > 1:
103107
print(f"Couldn't remove {os.path.abspath(filename)}: {exc}")

0 commit comments

Comments
 (0)