comparison mxtool/mx.py @ 7787:2865133eeef2

mx: When doanload fails using Java, try using python mx: Update jdt compiler preferences if it is outdates
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 13 Feb 2013 16:21:35 +0100
parents 6b540bb82312
children 0df252296c8d 9bff64f43299
comparison
equal deleted inserted replaced
7786:8bbbde9d0a52 7787:2865133eeef2
1166 if not path.endswith(os.sep): 1166 if not path.endswith(os.sep):
1167 javaSource = join(myDir, 'URLConnectionDownload.java') 1167 javaSource = join(myDir, 'URLConnectionDownload.java')
1168 javaClass = join(myDir, 'URLConnectionDownload.class') 1168 javaClass = join(myDir, 'URLConnectionDownload.class')
1169 if not exists(javaClass) or getmtime(javaClass) < getmtime(javaSource): 1169 if not exists(javaClass) or getmtime(javaClass) < getmtime(javaSource):
1170 subprocess.check_call([java().javac, '-d', myDir, javaSource]) 1170 subprocess.check_call([java().javac, '-d', myDir, javaSource])
1171 if run([java().java, '-cp', myDir, 'URLConnectionDownload', path] + urls) == 0: 1171 if run([java().java, '-cp', myDir, 'URLConnectionDownload', path] + urls, nonZeroIsFatal=False) == 0:
1172 return 1172 return
1173 1173
1174 def url_open(url): 1174 def url_open(url):
1175 userAgent = 'Mozilla/5.0 (compatible)' 1175 userAgent = 'Mozilla/5.0 (compatible)'
1176 headers = { 'User-Agent' : userAgent } 1176 headers = { 'User-Agent' : userAgent }
1434 jdtArgs = [java().java, '-Xmx1g', '-jar', jdtJar, 1434 jdtArgs = [java().java, '-Xmx1g', '-jar', jdtJar,
1435 '-' + args.compliance, 1435 '-' + args.compliance,
1436 '-cp', cp, '-g', '-enableJavadoc', 1436 '-cp', cp, '-g', '-enableJavadoc',
1437 '-d', outputDir] + javacArgs 1437 '-d', outputDir] + javacArgs
1438 jdtProperties = join(p.dir, '.settings', 'org.eclipse.jdt.core.prefs') 1438 jdtProperties = join(p.dir, '.settings', 'org.eclipse.jdt.core.prefs')
1439 if not exists(jdtProperties): 1439 rootJdtProperties = join(p.suite.dir, 'mx', 'eclipse-settings', 'org.eclipse.jdt.core.prefs')
1440 if not exists(jdtProperties) or os.path.getmtime(jdtProperties) < os.path.getmtime(rootJdtProperties):
1440 # Try to fix a missing properties file by running eclipseinit 1441 # Try to fix a missing properties file by running eclipseinit
1441 eclipseinit([], buildProcessorJars=False) 1442 eclipseinit([], buildProcessorJars=False)
1442 if not exists(jdtProperties): 1443 if not exists(jdtProperties):
1443 log('JDT properties file {0} not found'.format(jdtProperties)) 1444 log('JDT properties file {0} not found'.format(jdtProperties))
1444 else: 1445 else: