[arvados] updated: 2.6.0-547-g1fb91dca65
git repository hosting
git at public.arvados.org
Sun Aug 27 02:52:51 UTC 2023
Summary of changes:
sdk/python/arvados/api.py | 12 +++++++-----
sdk/python/arvados/commands/get.py | 3 ++-
2 files changed, 9 insertions(+), 6 deletions(-)
via 1fb91dca65538e49386fabf046f6163bd56c137c (commit)
from 70114a9cc3d2f62abd8aa9cae9024438e5829183 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 1fb91dca65538e49386fabf046f6163bd56c137c
Author: Brett Smith <brett.smith at curii.com>
Date: Sat Aug 26 22:52:13 2023 -0400
20839: Replace arvados.util.mkdir_dash_p calls throughout
In preparation to deprecate the function.
Arvados-DCO-1.1-Signed-off-by: Brett Smith <brett.smith at curii.com>
diff --git a/sdk/python/arvados/api.py b/sdk/python/arvados/api.py
index a7f3837599..c51be82b20 100644
--- a/sdk/python/arvados/api.py
+++ b/sdk/python/arvados/api.py
@@ -19,6 +19,7 @@ import httplib2
import json
import logging
import os
+import pathlib
import re
import socket
import ssl
@@ -173,15 +174,16 @@ def _new_http_error(cls, *args, **kwargs):
apiclient_errors.HttpError.__new__ = staticmethod(_new_http_error)
def http_cache(data_type):
- homedir = os.environ.get('HOME')
- if not homedir or len(homedir) == 0:
+ try:
+ homedir = pathlib.Path.home()
+ except RuntimeError:
return None
- path = homedir + '/.cache/arvados/' + data_type
+ path = pathlib.Path(homedir, '.cache', 'arvados', data_type)
try:
- util.mkdir_dash_p(path)
+ path.mkdir(parents=True, exist_ok=True)
except OSError:
return None
- return cache.SafeHTTPCache(path, max_age=60*60*24*2)
+ return cache.SafeHTTPCache(str(path), max_age=60*60*24*2)
def api_client(
version,
diff --git a/sdk/python/arvados/commands/get.py b/sdk/python/arvados/commands/get.py
index c4db072cc2..b37a8477ac 100755
--- a/sdk/python/arvados/commands/get.py
+++ b/sdk/python/arvados/commands/get.py
@@ -6,6 +6,7 @@
import argparse
import hashlib
import os
+import pathlib
import re
import string
import sys
@@ -261,7 +262,7 @@ def main(arguments=None, stdout=sys.stdout, stderr=sys.stderr):
logger.error('Local file %s already exists.' % (outfilename,))
return 1
if args.r:
- arvados.util.mkdir_dash_p(os.path.dirname(outfilename))
+ pathlib.Path(outfilename).parent.mkdir(parents=True, exist_ok=True)
try:
outfile = open(outfilename, 'wb')
except Exception as error:
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list