From 2c1e19f4eb1012bbc10c83d135a34462eb001772 Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Wed, 15 Aug 2018 18:47:05 +0200 Subject: [PATCH] main: create intermediate directories for cachedir Fixes: https://pagure.io/fedora-rust/rust2rpm/issue/50 Merges: https://pagure.io/fedora-rust/rust2rpm/pull-request/56 --- rust2rpm/__main__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py index 264ce61..99acc6f 100644 --- a/rust2rpm/__main__.py +++ b/rust2rpm/__main__.py @@ -101,8 +101,7 @@ def download(crate, version): versions = req.json()["versions"] version = next(version["num"] for version in versions if not version["yanked"]) - if not os.path.isdir(CACHEDIR): - os.mkdir(CACHEDIR) + os.makedirs(CACHEDIR, exist_ok=True) cratef_base = "{}-{}.crate".format(crate, version) cratef = os.path.join(CACHEDIR, cratef_base) if not os.path.isfile(cratef):