opts.add_option('-u', help='URL to download') opts.add_option('-v', help='expected content SHA-1') opts.add_option('-x', action='append', help='file to delete from ZIP') opts.add_option('--exclude_java_sources', action='store_true') opts.add_option('--unsign', action='store_true') args, _ = opts.parse_args() root_dir = args.o while root_dir and root_dir != "/": root_dir, n = path.split(root_dir) if n == 'buck-out': break redirects = download_properties(root_dir) cache_ent = cache_entry(args) src_url = resolve_url(args.u, redirects) if not path.exists(cache_ent): try: safe_mkdirs(path.dirname(cache_ent)) except OSError as err: print('error creating directory %s: %s' % (path.dirname(cache_ent), err), file=stderr) exit(1) print('Download %s' % src_url, file=stderr) try: check_call(['curl', '--proxy-anyauth', '-ksfo', cache_ent, src_url]) except OSError as err: print('could not invoke curl: %s\nis curl installed?' % err,
def testCustomRedirect(self): url = resolve_url( 'MAVEN_EXAMPLE:foo.jar', {'MAVEN_EXAMPLE': 'http://maven.example.com/release'}) self.assertEqual(url, 'http://maven.example.com/release/foo.jar')
opts.add_option('-u', help='URL to download') opts.add_option('-v', help='expected content SHA-1') opts.add_option('-x', action='append', help='file to delete from ZIP') opts.add_option('--exclude_java_sources', action='store_true') opts.add_option('--unsign', action='store_true') args, _ = opts.parse_args() root_dir = args.o while root_dir: root_dir, n = path.split(root_dir) if n == 'buck-out': break redirects = download_properties(root_dir) cache_ent = cache_entry(args) src_url = resolve_url(args.u, redirects) if not path.exists(cache_ent): try: safe_mkdirs(path.dirname(cache_ent)) except OSError as err: print('error creating directory %s: %s' % (path.dirname(cache_ent), err), file=stderr) exit(1) print('Download %s' % src_url, file=stderr) try: check_call(['curl', '--proxy-anyauth', '-ksfo', cache_ent, src_url]) except OSError as err: print('could not invoke curl: %s\nis curl installed?' % err, file=stderr) exit(1)
def testKnownRedirect(self): url = resolve_url('MAVEN_CENTRAL:foo.jar', {'MAVEN_CENTRAL': 'http://my.company.mirror/maven2'}) self.assertEqual(url, 'http://my.company.mirror/maven2/foo.jar')
def testCustom(self): url = resolve_url('http://maven.example.com/release/foo.jar', {}) self.assertEqual(url, 'http://maven.example.com/release/foo.jar')
def testKnown(self): url = resolve_url('GERRIT:foo.jar', {}) self.assertEqual(url, 'http://gerrit-maven.storage.googleapis.com/foo.jar')
def testCustomRedirect(self): url = resolve_url('MAVEN_EXAMPLE:foo.jar', {'MAVEN_EXAMPLE': 'http://maven.example.com/release'}) self.assertEqual(url, 'http://maven.example.com/release/foo.jar')