From 6265047606613939ef47bb7ffcd736f2ce46c8fb Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Tue, 8 Feb 2011 11:57:07 -0800 Subject: [PATCH] update to allow for missing rules file --- ubuntutools/test/test_update_maintainer.py | 8 ++++++++ ubuntutools/update_maintainer.py | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ubuntutools/test/test_update_maintainer.py b/ubuntutools/test/test_update_maintainer.py index e8f2014..d79bbd5 100644 --- a/ubuntutools/test/test_update_maintainer.py +++ b/ubuntutools/test/test_update_maintainer.py @@ -243,3 +243,11 @@ class UpdateMaintainerTestCase(mox.MoxTestBase, unittest.TestCase): self._files["rules"] = StringIO.StringIO(_COMPLEX_RULES) update_maintainer(self._directory) self.assertEqual(self._files["control"].getvalue(), _ABP_CONTROL) + + def test_update_maintainer_missing_rules(self): + """Test: Skip XSBC-Original test when debian/rules is missing.""" + self._files["changelog"] = StringIO.StringIO(_LUCID_CHANGELOG) + self._files["control"] = StringIO.StringIO(_ABP_CONTROL) + self._files["rules"] = None + update_maintainer(self._directory) + self.assertEqual(self._files["control"].getvalue(), _ABP_UPDATED) diff --git a/ubuntutools/update_maintainer.py b/ubuntutools/update_maintainer.py index f3d984e..8823b9a 100644 --- a/ubuntutools/update_maintainer.py +++ b/ubuntutools/update_maintainer.py @@ -62,7 +62,9 @@ def update_maintainer(debian_directory, verbose=False): # If the rules file accounts for XSBC-Original-Maintainer, we should not # touch it in this package (e.g. the python package). - if 'XSBC-Original-' in open(os.path.join(debian_directory, "rules")).read(): + rules_file = os.path.join(debian_directory, "rules") + if os.path.isfile(rules_file) and \ + 'XSBC-Original-' in open(rules_file).read(): if verbose: print "XSBC-Original is managed by 'rules' file. Doing nothing." return(0)