1.1 --- a/python.source/src/org/netbeans/modules/python/source/queries/SourceLevelQuery.java Mon Sep 19 18:52:37 2016 +0200
1.2 +++ b/python.source/src/org/netbeans/modules/python/source/queries/SourceLevelQuery.java Sun Sep 25 16:45:37 2016 +0200
1.3 @@ -72,6 +72,7 @@
1.4 private static final Logger LOGGER = Logger.getLogger(SourceLevelQuery.class.getName());
1.5
1.6 private static final Pattern SOURCE_LEVEL = Pattern.compile("Python.(\\d+\\.\\d+)\\.\\d+"); //NOI18N
1.7 + private static final Pattern SOURCE_LEVEl_SYNONYM = Pattern.compile("(\\d+\\.\\d+)"); //NOI18N
1.8 private static final Pattern SYNONYM = Pattern.compile("\\d+");//NOI18N
1.9
1.10 private static final Lookup.Result<? extends SourceLevelQueryImplementation> impls =
1.11 @@ -109,14 +110,19 @@
1.12 final String s = normalize(result.getSourceLevel());
1.13 if (s != null) {
1.14 Matcher matcher = SOURCE_LEVEL.matcher(s);
1.15 - if (!matcher.matches()) {
1.16 + Matcher synonymMatcher = SOURCE_LEVEl_SYNONYM.matcher(s); // On most source, the normalize string is just X.Y
1.17 + if (!matcher.matches() && !synonymMatcher.matches()) {
1.18 LOGGER.log(Level.WARNING, "#83994: Ignoring bogus source level {0} for {1} from {2}", new Object[] {s, javaFile, sqi}); //NOI18N
1.19 continue;
1.20 }
1.21 if (LOGGER.isLoggable(Level.FINE)) {
1.22 LOGGER.log(Level.FINE, "Found source level {0} for {1} from {2}", new Object[] {s, javaFile, sqi}); //NOI18N
1.23 }
1.24 - return matcher.group(1);
1.25 + if (matcher.matches()) {
1.26 + return matcher.group(1);
1.27 + } else {
1.28 + return synonymMatcher.group(1);
1.29 + }
1.30 }
1.31 }
1.32 }