#56 main: create intermediate directories for cachedir
Merged 5 years ago by ignatenkobrain. Opened 5 years ago by lucab.
fedora-rust/ lucab/rust2rpm ups/makedirs-fix  into  master

file modified
+1 -1
@@ -102,7 +102,7 @@ 

          version = next(version["num"] for version in versions if not version["yanked"])

  

      if not os.path.isdir(CACHEDIR):

-         os.mkdir(CACHEDIR)

+         os.makedirs(CACHEDIR)

Hmm, while at it, maybe just use makedirs(exists_ok=True) ?

agree with @zbyszek. add exists_ok=True and I'm +1

      cratef_base = "{}-{}.crate".format(crate, version)

      cratef = os.path.join(CACHEDIR, cratef_base)

      if not os.path.isfile(cratef):

Hmm, while at it, maybe just use makedirs(exists_ok=True) ?

@zbyszek without the conditional on isdir? I don't like relying on implicit side-effects too much, but I can change to do that if we prefer.

agree with @zbyszek. add exists_ok=True and I'm +1

That's what I head in mind. With makedirs we are already relying on side effects for the intermediate dirs, so just doing an explicit check for the last path element doesn't seem useful.

Commit 2c1e19f fixes this pull-request

Pull-Request has been merged by ignatenkobrain

5 years ago
Metadata