summarylogtreecommitdiffstats
path: root/import_catkin_packages.py
diff options
context:
space:
mode:
Diffstat (limited to 'import_catkin_packages.py')
-rwxr-xr-ximport_catkin_packages.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/import_catkin_packages.py b/import_catkin_packages.py
index be6d892a3c33..00d56555035c 100755
--- a/import_catkin_packages.py
+++ b/import_catkin_packages.py
@@ -1,6 +1,5 @@
#!/usr/bin/env python2
-
from __future__ import print_function
import catkin_pkg.package
@@ -137,15 +136,18 @@ class PackageBase(object):
"""
Checks whether a currently installed PKGBUILD contains the same version.
"""
- f = open(pkgbuild_file, "r")
- content = f.read()
- pattern_pkgver = re.compile(r"pkgver='([0-9\.]*)'")
- pattern_pkgver_patch = re.compile(r"_pkgver_patch=([0-9]*)")
- match_pkgver = re.search(pattern_pkgver, content)
- match_pkgver_patch = re.search(pattern_pkgver_patch, content)
- if match_pkgver and match_pkgver_patch:
- return (match_pkgver.group(1) == self.version
- and match_pkgver_patch.group(1) == self.version_patch)
+ if os.path.isfile(pkgbuild_file):
+ f = open(pkgbuild_file, "r")
+ content = f.read()
+ pattern_pkgver = re.compile(r"pkgver='([0-9\.]*)'")
+ pattern_pkgver_patch = re.compile(r"_pkgver_patch=([0-9]*)")
+ match_pkgver = re.search(pattern_pkgver, content)
+ match_pkgver_patch = re.search(pattern_pkgver_patch, content)
+ if match_pkgver and match_pkgver_patch:
+ return (match_pkgver.group(1) == self.version
+ and match_pkgver_patch.group(1) == self.version_patch)
+ else:
+ return False
else:
return False