aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo/package_commands.py
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2023-05-20 18:22:07 +0200
committerMartin Robinson <mrobinson@igalia.com>2023-05-20 18:23:46 +0200
commit3875debfbfd5b335285a70780aa1aa3a775bb02a (patch)
tree1ace5e07a4a7e13744b92a061f07aa445fd2f477 /python/servo/package_commands.py
parent4998c65c423f995149f4b314d8ff68024c24cc72 (diff)
downloadservo-3875debfbfd5b335285a70780aa1aa3a775bb02a.tar.gz
servo-3875debfbfd5b335285a70780aa1aa3a775bb02a.zip
Remove some unused python code
This change removes: - The custom `--dry-run` support for `cargo-update`. The real cargo command now has `--dry-run` support and this code was broken for Python 3. - The Python 2 version of TemporaryDirectory. This is no longer needed as we require Python 3.
Diffstat (limited to 'python/servo/package_commands.py')
-rw-r--r--python/servo/package_commands.py20
1 files changed, 1 insertions, 19 deletions
diff --git a/python/servo/package_commands.py b/python/servo/package_commands.py
index 1f4e87f9830..1488eadbd3e 100644
--- a/python/servo/package_commands.py
+++ b/python/servo/package_commands.py
@@ -82,24 +82,6 @@ PACKAGES = {
}
-TemporaryDirectory = None
-if sys.version_info >= (3, 2):
- TemporaryDirectory = tempfile.TemporaryDirectory
-else:
- import contextlib
-
- # Not quite as robust as tempfile.TemporaryDirectory,
- # but good enough for most purposes
- @contextlib.contextmanager
- def TemporaryDirectory(**kwargs):
- dir_name = tempfile.mkdtemp(**kwargs)
- try:
- yield dir_name
- except Exception as e:
- shutil.rmtree(dir_name)
- raise e
-
-
def listfiles(directory):
return [f for f in os.listdir(directory)
if path.isfile(path.join(directory, f))]
@@ -683,7 +665,7 @@ class PackageCommands(CommandBase):
brew_version = timestamp.strftime('%Y.%m.%d')
- with TemporaryDirectory(prefix='homebrew-servo') as tmp_dir:
+ with tempfile.TemporaryDirectory(prefix='homebrew-servo') as tmp_dir:
def call_git(cmd, **kwargs):
subprocess.check_call(
['git', '-C', tmp_dir] + cmd,