aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPriit Laes <plaes@plaes.org>2010-07-01 14:57:16 +0300
committerPriit Laes <plaes@plaes.org>2010-07-01 23:50:39 +0300
commit98b85bef575a7861c7d4310c5ec5ec98692fe1ad (patch)
treec1fd402f401199be336368adeddcd4966d12adce /utils/grumpy_sync.py
parentAdded Setting class/table to data model (diff)
downloadgsoc2010-grumpy-98b85bef575a7861c7d4310c5ec5ec98692fe1ad.tar.gz
gsoc2010-grumpy-98b85bef575a7861c7d4310c5ec5ec98692fe1ad.tar.bz2
gsoc2010-grumpy-98b85bef575a7861c7d4310c5ec5ec98692fe1ad.zip
Move session and db engine code into grumpy.database
Diffstat (limited to 'utils/grumpy_sync.py')
-rwxr-xr-xutils/grumpy_sync.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/utils/grumpy_sync.py b/utils/grumpy_sync.py
index 7da95c8..20c4674 100755
--- a/utils/grumpy_sync.py
+++ b/utils/grumpy_sync.py
@@ -10,7 +10,6 @@ from pkgcore.ebuild import repository
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
-from sqlalchemy.orm.exc import NoResultFound
from snakeoil.fileutils import iter_read_bash
@@ -18,16 +17,11 @@ path = os.path.join(os.path.dirname(__file__), os.path.pardir)
sys.path.insert(0, path)
del path
-from grumpy.models import (Base, Category, Developer, Ebuild, Herd,
+from grumpy.database import session
+from grumpy.models import (Base, Category, Developer, Ebuild, Herd, \
Package, Setting)
def main(path):
- engine = create_engine('postgresql://grumpy:grumpy@localhost/grumpy')
- session = scoped_session(sessionmaker(autocommit=False,
- autoflush=False,
- bind=engine))
- Base.query = session.query_property()
-
# pkgcore part to fetch all the ebuild information
conf = load_config()
eclass_cache = conf.eclass_cache['eclass stack']