added code to strip -py2 from the identified version

Former-commit-id: 4e8f8f21a3ac21099b6ea4524f5299da95973943
This commit is contained in:
Jeremy Long
2015-05-10 07:16:22 -04:00
parent 4068da33c8
commit 3ed5e85646
2 changed files with 9 additions and 4 deletions

View File

@@ -35,8 +35,8 @@ public final class DependencyVersionUtil {
*/
private static final Pattern RX_VERSION = Pattern.compile("\\d+(\\.\\d{1,6})+(\\.?([_-](release|beta|alpha|\\d+)|[a-zA-Z_-]{1,3}\\d{0,8}))?");
/**
* Regular expression to extract a single version number without periods. This is a last ditch effort just to check
* in case we are missing a version number using the previous regex.
* Regular expression to extract a single version number without periods. This is a last ditch effort just to check in case we
* are missing a version number using the previous regex.
*/
private static final Pattern RX_SINGLE_VERSION = Pattern.compile("\\d+(\\.?([_-](release|beta|alpha)|[a-zA-Z_-]{1,3}\\d{1,8}))?");
@@ -89,6 +89,9 @@ public final class DependencyVersionUtil {
return null;
}
}
if (version != null && version.endsWith("-py2") && version.length() > 4) {
version = version.substring(0, version.length() - 4);
}
return new DependencyVersion(version);
}
}