[Git][reproducible-builds/diffoscope][master] 3 commits: Clarify the grammar of a comment.

Chris Lamb gitlab at salsa.debian.org
Thu Jan 28 10:28:16 UTC 2021



Chris Lamb pushed to branch master at Reproducible Builds / diffoscope


Commits:
6a4b63a6 by Chris Lamb at 2021-01-28T10:21:57+00:00
Clarify the grammar of a comment.

- - - - -
ee581fd6 by Chris Lamb at 2021-01-28T10:25:41+00:00
Clarify in a comment that __del__ is not always called, so temporary directories are not neccessary removed the *moment* they go out of scope.

At least in CPython...

Ref: reproducible-builds/diffoscope#234

- - - - -
e005735d by Chris Lamb at 2021-01-28T10:26:30+00:00
Save sys.argv in our top-level temporary directory, in case it helps debug errant temporary directories.

Ref: reproducible-builds/diffoscope#234

- - - - -


1 changed file:

- diffoscope/tempfiles.py


Changes:

=====================================
diffoscope/tempfiles.py
=====================================
@@ -1,7 +1,7 @@
 #
 # diffoscope: in-depth comparison of files, archives, and directories
 #
-# Copyright © 2016-2020 Chris Lamb <lamby at debian.org>
+# Copyright © 2016-2021 Chris Lamb <lamby at debian.org>
 # Copyright © 2018 Mattia Rizzolo <mattia at debian.org>
 #
 # diffoscope is free software: you can redistribute it and/or modify
@@ -18,6 +18,7 @@
 # along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.
 
 import os
+import sys
 import logging
 import tempfile
 
@@ -47,10 +48,12 @@ def get_temporary_directory(*args, **kwargs):
     statement. Otherwise it's cleaned up when the object is garbage collected.
 
     WARNING, don't do this:
+
         tmpdir = get_temporary_directory().name
 
-    This will result to immediate removal of the directory, as there is no
-    reference pointing to the TemporaryDirectory object.
+    ... as this may result in the removal of the directory at some unexpected
+    time in the future. (Or not at all, depending on whether there are other,
+    unexpected, references to this instance.)
     """
     kwargs["dir"] = kwargs.pop("dir", _get_base_temporary_directory())
 
@@ -82,6 +85,9 @@ def _get_base_temporary_directory():
             "Created top-level temporary directory: %s", _BASEDIR.name
         )
 
+        with open(os.path.join(_BASEDIR.name, 'argv'), 'w') as f:
+            print('\n'.join(sys.argv), file=f)
+
     return _BASEDIR.name
 
 



View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/74ca80dfc9517a0ecb0b7f0442fa4493f42b3b8e...e005735d53e1f7bf45c0884cc6b4c416f9c3a247

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/74ca80dfc9517a0ecb0b7f0442fa4493f42b3b8e...e005735d53e1f7bf45c0884cc6b4c416f9c3a247
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20210128/ce29c98c/attachment.htm>


More information about the rb-commits mailing list