aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Harder <radhermit@gmail.com>2016-06-19 04:38:50 -0400
committerTim Harder <radhermit@gmail.com>2016-06-19 04:58:36 -0400
commitf1cfa398682092e216f403064d7d98c22c59dcb9 (patch)
tree03744754424898e7f0e19601fa41ae72c2eb10bc
parentupdate pkgdist (diff)
downloadpkgcore-f1cfa398682092e216f403064d7d98c22c59dcb9.tar.gz
pkgcore-f1cfa398682092e216f403064d7d98c22c59dcb9.tar.bz2
pkgcore-f1cfa398682092e216f403064d7d98c22c59dcb9.zip
Revert "ebuild/repository: move repo location checks to RepoConfig"
RepoConfig objects shouldn't require existent paths as that breaks syncing newly configured repos. This reverts commit d67100340d4a8221de6c5183ccd8433c4047bc11. Fixes #210.
-rw-r--r--pkgcore/ebuild/repo_objs.py12
-rw-r--r--pkgcore/ebuild/repository.py9
2 files changed, 10 insertions, 11 deletions
diff --git a/pkgcore/ebuild/repo_objs.py b/pkgcore/ebuild/repo_objs.py
index bfe30618..9dfec635 100644
--- a/pkgcore/ebuild/repo_objs.py
+++ b/pkgcore/ebuild/repo_objs.py
@@ -11,7 +11,6 @@ __all__ = (
)
from itertools import chain
-import os
from snakeoil import compatibility, klass, mappings
from snakeoil.caching import WeakInstMeta
@@ -21,11 +20,10 @@ from snakeoil.osutils import pjoin, listdir_files, listdir
from snakeoil.sequences import namedtuple
from pkgcore.config import ConfigHint
-from pkgcore.repository import syncable, errors
+from pkgcore.repository import syncable
demandload(
'errno',
- 'stat',
'snakeoil.bash:BashParseError,iter_read_bash,read_dict',
'snakeoil.fileutils:readfile,readlines_ascii',
'snakeoil.sequences:iter_stable_unique',
@@ -360,14 +358,6 @@ class RepoConfig(syncable.tree):
})
def __init__(self, location, config_name=None, syncer=None, profiles_base='profiles'):
- try:
- if not stat.S_ISDIR(os.stat(location).st_mode):
- raise errors.InitializationError(
- "location not a dir: %s" % (location,))
- except OSError:
- compatibility.raise_from(errors.InitializationError(
- "lstat failed on location %s" % (location,)))
-
object.__setattr__(self, 'config_name', config_name)
object.__setattr__(self, 'location', location)
object.__setattr__(self, 'profiles_base', pjoin(self.location, profiles_base))
diff --git a/pkgcore/ebuild/repository.py b/pkgcore/ebuild/repository.py
index 8eab0c9f..e986b8e2 100644
--- a/pkgcore/ebuild/repository.py
+++ b/pkgcore/ebuild/repository.py
@@ -10,6 +10,7 @@ __all__ = ("tree",)
from functools import partial
from itertools import imap, ifilterfalse
import os
+import stat
from snakeoil import klass
from snakeoil.bash import iter_read_bash, read_dict
@@ -262,6 +263,14 @@ class _UnconfiguredTree(prototype.tree):
repo_config = repo_objs.RepoConfig(location)
self.config = repo_config
self.base = self.location = location
+ try:
+ if not stat.S_ISDIR(os.stat(self.base).st_mode):
+ raise errors.InitializationError(
+ "base not a dir: %s" % self.base)
+
+ except OSError:
+ raise_from(errors.InitializationError(
+ "lstat failed on base %s" % (self.base,)))
self.eclass_cache = eclass_cache
self.masters = masters