Skip to content

Commit

Permalink
Automatically create missing package repository dir
Browse files Browse the repository at this point in the history
As choosing a destination directory is either default to users home directory, or explicitly chosen as a config option, installing to a non-existing directory shouldn't throw an error.
  • Loading branch information
Marcus Ottosson committed Apr 29, 2019
1 parent 1d3b846 commit f787c34
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/rezplugins/package_repository/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import os.path
import os
import stat
import errno
import time

from rez.package_repository import PackageRepository
Expand Down Expand Up @@ -583,9 +584,15 @@ def install_variant(self, variant_resource, dry_run=False, overrides=None):

# check repo exists on disk
path = self.location
if not os.path.exists(path):
raise PackageRepositoryError(
"Package repository path does not exist: %s" % path)

try:
os.makedirs(path)
except OSError as e:
if e.errno != errno.EEXIST:
raise PackageRepositoryError(
"Package repository did not exist "
"and could not be created."
)

# install the variant
def _create_variant():
Expand Down

0 comments on commit f787c34

Please sign in to comment.