SF.net SVN: gar:[23082] csw/mgar/gar/v2/lib/python/generate_catalog_file.py
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Fri Feb 28 10:48:37 CET 2014
Revision: 23082
http://sourceforge.net/p/gar/code/23082
Author: wahwah
Date: 2014-02-28 09:48:36 +0000 (Fri, 28 Feb 2014)
Log Message:
-----------
generate_catalog_file: Update for the new APIs
Modified Paths:
--------------
csw/mgar/gar/v2/lib/python/generate_catalog_file.py
Modified: csw/mgar/gar/v2/lib/python/generate_catalog_file.py
===================================================================
--- csw/mgar/gar/v2/lib/python/generate_catalog_file.py 2014-02-28 09:48:29 UTC (rev 23081)
+++ csw/mgar/gar/v2/lib/python/generate_catalog_file.py 2014-02-28 09:48:36 UTC (rev 23082)
@@ -21,27 +21,28 @@
CATALOG_FN = "catalog"
DESC_FN = "descriptions"
-import rest
import os
import optparse
import logging
import sys
import datetime
-import representations
+from lib.python import configuration
+from lib.python import representations
+from lib.python import rest
+
class Error(Exception):
"""A general error."""
class CatalogFileGenerator(object):
- def __init__(self, catrel, arch, osrel,
- rest_client=None):
+ def __init__(self, catrel, arch, osrel, rest_client):
self.catrel = catrel
self.arch = arch
self.osrel = osrel
home_dir = os.environ['HOME']
- self.rest_client = rest_client or rest.RestClient()
+ self.rest_client = rest_client
self._catalog = None
@property
@@ -99,7 +100,15 @@
parser.add_option("--arch", dest="arch")
parser.add_option("--os-release", dest="osrel")
options, args = parser.parse_args()
- cfg = CatalogFileGenerator(options.catrel, options.arch, options.osrel)
+ username, password = rest.GetUsernameAndPassword()
+ config = configuration.GetConfig()
+ rest_client = rest.RestClient(
+ pkgdb_url=config.get('rest', 'pkgdb'),
+ releases_url=config.get('rest', 'releases'),
+ username=username,
+ password=password)
+ cfg = CatalogFileGenerator(options.catrel, options.arch, options.osrel,
+ rest_client)
cfg.GenerateCatalog(options.out_dir)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the devel
mailing list