def test_basic(self):
     manifest = 'test-dependencies.json'
     depot_location = '/space/2013'
     temp_location1 = tempfile.mkdtemp()
     temp_location2 = tempfile.mkdtemp()
     dr = DependenyResolver(manifest, depot_location)
     ds = dr.resolve()
     #create a temp folder
     os.tmpfile()
     for d in ds:
         downloaded = dr.download(d,temp_location1)
         extracted = dr.extract(downloaded,temp_location2)
         ConsoleLogger.info(downloaded)
         ConsoleLogger.info(extracted)
Ejemplo n.º 2
0
 def test_basic(self):
     manifest = 'test-dependencies.json'
     depot_location = '/space/2013'
     temp_location1 = tempfile.mkdtemp()
     temp_location2 = tempfile.mkdtemp()
     dr = DependenyResolver(manifest, depot_location)
     ds = dr.resolve()
     #create a temp folder
     os.tmpfile()
     for d in ds:
         downloaded = dr.download(d, temp_location1)
         extracted = dr.extract(downloaded, temp_location2)
         ConsoleLogger.info(downloaded)
         ConsoleLogger.info(extracted)
parser.add_option('-i', '--install', dest='install',
                  default='/opt/couchbase',
                  help='extract the dependencies into this folder ( default = /opt/couchbase')

options, args = parser.parse_args()

if not options.manifest:
    ConsoleLogger.error('you need to specify the manifest file via -m option , e.g -m dependencies.xml')
    parser.print_help()
    give_up()

if not FileUtil.does_it_exist(options.manifest):
    ConsoleLogger.error('specified manifest : %s does not exist' % (options.manifest))
    give_up()

if not options.depot:
    ConsoleLogger.info('depot location (-d) is not specified , choosing the default')
    options.depot = 'http://...'
    give_up()

if not options.target:
    default_target =  '' # working directory/dependencies
    ConsoleLogger.info('target location is not specified , choosing the default to %s' %
         ( default_target))
    options.target = default_target

resolver = DependenyResolver(options.manifest, options.depot)
dependencyIter = resolver.resolve()
for dependency in dependencyIter:
    downloaded = resolver.download(dependency, options.target)
    resolver.extract(downloaded, options.install)
if not options.manifest:
    ConsoleLogger.error(
        'you need to specify the manifest file via -m option , e.g -m dependencies.xml'
    )
    parser.print_help()
    give_up()

if not FileUtil.does_it_exist(options.manifest):
    ConsoleLogger.error('specified manifest : %s does not exist' %
                        (options.manifest))
    give_up()

if not options.depot:
    ConsoleLogger.info(
        'depot location (-d) is not specified , choosing the default')
    options.depot = 'http://...'
    give_up()

if not options.target:
    default_target = ''  # working directory/dependencies
    ConsoleLogger.info(
        'target location is not specified , choosing the default to %s' %
        (default_target))
    options.target = default_target

resolver = DependenyResolver(options.manifest, options.depot)
dependencyIter = resolver.resolve()
for dependency in dependencyIter:
    downloaded = resolver.download(dependency, options.target)
    resolver.extract(downloaded, options.install)