D6258: packaging: coerce paths to strings

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Tue Apr 16 21:55:29 UTC 2019


durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Experimentally passing the pathlib.Path to zipfile.ZipFile fails on at
  least some Python versions. I've gotten frustrated enough I'd rather
  just force them to be strings and move on.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6258

AFFECTED FILES
  contrib/packaging/hgpackaging/util.py

CHANGE DETAILS

diff --git a/contrib/packaging/hgpackaging/util.py b/contrib/packaging/hgpackaging/util.py
--- a/contrib/packaging/hgpackaging/util.py
+++ b/contrib/packaging/hgpackaging/util.py
@@ -17,12 +17,12 @@
 
 
 def extract_tar_to_directory(source: pathlib.Path, dest: pathlib.Path):
-    with tarfile.open(source, 'r') as tf:
+    with tarfile.open(str(source), 'r') as tf:
         tf.extractall(dest)
 
 
 def extract_zip_to_directory(source: pathlib.Path, dest: pathlib.Path):
-    with zipfile.ZipFile(source, 'r') as zf:
+    with zipfile.ZipFile(str(source), 'r') as zf:
         zf.extractall(dest)
 
 



To: durin42, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list