diff --git a/project_dependency.drupal.inc b/project_dependency.drupal.inc
index 0404ec2..ef25b69 100644
--- a/project_dependency.drupal.inc
+++ b/project_dependency.drupal.inc
@@ -439,12 +439,32 @@ function project_dependency_get_external_component_dependencies($release_nid, $d
     // in.
     foreach ($external_dependencies as $component_info) {
       $dependency_component = $component_info['dependency'];
+      $parsed_component =
+        project_dependency_parse_dependency($dependency_component, $api_term->name);
+      $dependency_component = $parsed_component['name'];
 
       // Find the releases that component was shipped in.
       // We could hope that it would only be in one package/rid,
       // but there are probably cases (refactoring) where that is not
       // the case.
-      $possible_dependent_releases = project_dependency_info_releases_for_component_get($dependency_component, $api_term->tid);
+      $possibilities = project_dependency_info_releases_for_component_get($dependency_component, $api_term->tid);
+
+      $possible_dependent_releases = array();
+      foreach ($possibilities as $dependent_release) {
+        // Remove the api-term from the front of the version if necessary.
+        // The complex regex is for the case that we have a 7.x-7.x branch
+        // specified specified as just (7.x). We don't want it removed in that
+        // case.
+        $version_to_check = preg_replace("/^{$api_term->name}-([0-9]+\.[0-9x]+.*$)/", '$1', $dependent_release['version']);
+        // Remove -dev from the end of a dependency like (1.x-dev)
+        $version_to_check = preg_replace('/\.x-dev$/', '.x', $version_to_check);
+        $check = project_dependency_check_incompatibility($parsed_component, $version_to_check);
+        if (is_null($check)) {
+          $possible_dependent_releases[$dependent_release['release_nid']] =
+            $dependent_release;
+        }
+      }
+
       // We choose to use the project of the most recently created release
       // node. This is not guaranteed, but is a heuristic. Is there another?
       $first_dependent_release = reset($possible_dependent_releases);
diff --git a/project_dependency.module b/project_dependency.module
index c6e9773..4fb0408 100644
--- a/project_dependency.module
+++ b/project_dependency.module
@@ -179,3 +179,100 @@ function project_dependency_get_external_release_dependencies($depending_release
   }
   return $release_dependencies;
 }
+
+/**
+ * Parses a dependency for comparison.
+ *
+ * @param $dependency
+ *   A dependency string, for example 'foo (foo (>=7.x-4.5-beta5, 3.x)'.
+ * @param $core_version
+ *   Need to pass in the core version since projects from other core versions
+ *   can exist.
+ *
+ * @return
+ *   An associative array with three keys:
+ *   - 'name' includes the name of the thing to depend on (e.g. 'foo').
+ *   - 'original_version' contains the original version string (which can be
+ *     used in the UI for reporting incompatibilities).
+ *   - 'versions' is a list of the associative arrays, each containing the keys
+ *     'op' and 'version'.  'op' can be one of: '=', '==', '!=', '<>', '<',
+ *     '<=', '>', or '>='.  'version' is one piece like '4.5-beta3'.
+ *   Callers should pass this structure to
+ *   project_dependency_check_incompatibility().
+ *
+ *   This function is a backport of D7 drupal_parse_dependency.
+ *
+ * @see project_dependency_check_incompatibility()
+ */
+function project_dependency_parse_dependency($dependency,
+  $core_version=DRUPAL_CORE_COMPATIBILITY) {
+
+  // We use named subpatterns and support every op that version_compare
+  // supports. Also, op is optional and defaults to equals.
+  $p_op = '(?P<operation>!=|==|=|<|<=|>|>=|<>)?';
+  // Core version is always optional: 7.x-2.x and 2.x is treated the same.
+  $p_core = '(?:' . preg_quote($core_version) . '-)?';
+  $p_major = '(?P<major>\d+)';
+  // By setting the minor version to x, branches can be matched.
+  $p_minor = '(?P<minor>(?:\d+|x)(?:-[A-Za-z]+\d+)?)';
+  $value = array();
+  $parts = explode('(', $dependency, 2);
+  $value['name'] = trim($parts[0]);
+  if (isset($parts[1])) {
+    $value['original_version'] = ' (' . $parts[1];
+    foreach (explode(',', $parts[1]) as $version) {
+      if (preg_match("/^\s*$p_op\s*$p_core$p_major\.$p_minor/", $version, $matches)) {
+        $op = !empty($matches['operation']) ? $matches['operation'] : '=';
+        if ($matches['minor'] == 'x') {
+          // Drupal considers "2.x" to mean any version that begins with
+          // "2" (e.g. 2.0, 2.9 are all "2.x"). PHP's version_compare(),
+          // on the other hand, treats "x" as a string; so to
+          // version_compare(), "2.x" is considered less than 2.0. This
+          // means that >=2.x and <2.x are handled by version_compare()
+          // as we need, but > and <= are not.
+          if ($op == '>' || $op == '<=') {
+            $matches['major']++;
+          }
+          // Equivalence can be checked by adding two restrictions.
+          if ($op == '=' || $op == '==') {
+            $value['versions'][] = array('op' => '<',
+              'version' => ($matches['major'] + 1) . '.x');
+            $op = '>=';
+          }
+        }
+        $value['versions'][] = array('op' => $op,
+          'version' => $matches['major'] . '.' . $matches['minor']);
+      }
+    }
+  }
+  return $value;
+}
+
+/**
+ * Checks whether a version is compatible with a given dependency.
+ *
+ * @param $v
+ *   The parsed dependency structure from project_dependency_parse_dependency().
+ * @param $current_version
+ *   The version to check against (like 4.2).
+ *
+ * @return
+ *   NULL if compatible, otherwise the original dependency version string that
+ *   caused the incompatibility.
+ *
+ *   This function is a backport of D7 drupal_check_incompatibility.
+ *
+ * @see project_dependency_parse_dependency()
+ */
+function project_dependency_check_incompatibility($v, $current_version) {
+  if (!empty($v['versions'])) {
+    foreach ($v['versions'] as $required_version) {
+      if ((isset($required_version['op']) &&
+        !version_compare($current_version, $required_version['version'],
+        $required_version['op']))) {
+
+        return $v['original_version'];
+      }
+    }
+  }
+}
