Skip to content

Commit 6f70bf5

Browse files
committed
Revert "feat: Write CACHEDIR.TAG file (#2803)"
This reverts commit be19526.
1 parent f5d7cb4 commit 6f70bf5

File tree

4 files changed

+0
-89
lines changed

4 files changed

+0
-89
lines changed

docs/changelog/2803.feature.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/virtualenv/create/creator.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import logging
55
import os
66
import sys
7-
import textwrap
87
from abc import ABC, abstractmethod
98
from argparse import ArgumentTypeError
109
from ast import literal_eval
@@ -158,31 +157,10 @@ def run(self):
158157
LOGGER.debug("delete %s", self.dest)
159158
safe_delete(self.dest)
160159
self.create()
161-
self.add_cachedir_tag()
162160
self.set_pyenv_cfg()
163161
if not self.no_vcs_ignore:
164162
self.setup_ignore_vcs()
165163

166-
def add_cachedir_tag(self):
167-
"""
168-
Add a Cache Directory Tag file "CACHEDIR.TAG".
169-
170-
The CACHEDIR.TAG file is used by various tools to mark
171-
a directory as cache, so that it can be handled differently.
172-
Some backup tools look for this file to exclude the directory.
173-
174-
See https://bford.info/cachedir/ for more details.
175-
"""
176-
cachedir_tag_file = self.dest / "CACHEDIR.TAG"
177-
if not cachedir_tag_file.exists():
178-
cachedir_tag_text = textwrap.dedent("""
179-
Signature: 8a477f597d28d172789f06886806bc55
180-
# This file is a cache directory tag created by Python virtualenv.
181-
# For information about cache directory tags, see:
182-
# http://www.brynosaurus.com/cachedir/
183-
""").strip()
184-
cachedir_tag_file.write_text(cachedir_tag_text, encoding="utf-8")
185-
186164
def set_pyenv_cfg(self):
187165
self.pyenv_cfg.content = OrderedDict()
188166
self.pyenv_cfg["home"] = os.path.dirname(os.path.abspath(self.interpreter.system_executable))

tests/integration/test_cachedir_tag.py

Lines changed: 0 additions & 37 deletions
This file was deleted.

tests/unit/create/test_creator.py

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import stat
1212
import subprocess
1313
import sys
14-
import textwrap
1514
import zipfile
1615
from collections import OrderedDict
1716
from itertools import product
@@ -224,34 +223,6 @@ def list_to_str(iterable):
224223
assert git_ignore.splitlines() == [comment, "*"]
225224

226225

227-
def test_create_cachedir_tag(tmp_path):
228-
cachedir_tag_file = tmp_path / "CACHEDIR.TAG"
229-
cli_run([str(tmp_path), "--without-pip", "--activators", ""])
230-
assert (
231-
cachedir_tag_file.read_text(encoding="utf-8")
232-
== textwrap.dedent("""
233-
Signature: 8a477f597d28d172789f06886806bc55
234-
# This file is a cache directory tag created by Python virtualenv.
235-
# For information about cache directory tags, see:
236-
# http://www.brynosaurus.com/cachedir/
237-
""").strip()
238-
)
239-
240-
241-
def test_create_cachedir_tag_exists(tmp_path):
242-
cachedir_tag_file = tmp_path / "CACHEDIR.TAG"
243-
cachedir_tag_file.write_text("magic", encoding="utf-8")
244-
cli_run([str(tmp_path), "--without-pip", "--activators", ""])
245-
assert cachedir_tag_file.read_text(encoding="utf-8") == "magic"
246-
247-
248-
def test_create_cachedir_tag_exists_override(tmp_path):
249-
cachedir_tag_file = tmp_path / "CACHEDIR.TAG"
250-
cachedir_tag_file.write_text("magic", encoding="utf-8")
251-
cli_run([str(tmp_path), "--without-pip", "--activators", ""])
252-
assert cachedir_tag_file.read_text(encoding="utf-8") == "magic"
253-
254-
255226
def test_create_vcs_ignore_exists(tmp_path):
256227
git_ignore = tmp_path / ".gitignore"
257228
git_ignore.write_text("magic", encoding="utf-8")

0 commit comments

Comments
 (0)