diff --git a/src/pkgmgr/actions/install/installers/makefile.py b/src/pkgmgr/actions/install/installers/makefile.py index 9d173c6..1fe9109 100644 --- a/src/pkgmgr/actions/install/installers/makefile.py +++ b/src/pkgmgr/actions/install/installers/makefile.py @@ -31,9 +31,7 @@ class MakefileInstaller(BaseInstaller): except OSError: return False - if re.search(r"^install\s*:", content, flags=re.MULTILINE): - return True - return bool(re.search(r"^install-[a-zA-Z0-9_-]*\s*:", content, flags=re.MULTILINE)) + return bool(re.search(r"^install\s*:", content, flags=re.MULTILINE)) def run(self, ctx: RepoContext) -> None: makefile_path = os.path.join(ctx.repo_dir, self.MAKEFILE_NAME) diff --git a/tests/unit/pkgmgr/actions/install/installers/test_makefile_installer.py b/tests/unit/pkgmgr/actions/install/installers/test_makefile_installer.py index 055ed3f..ecab6b3 100644 --- a/tests/unit/pkgmgr/actions/install/installers/test_makefile_installer.py +++ b/tests/unit/pkgmgr/actions/install/installers/test_makefile_installer.py @@ -81,6 +81,19 @@ class TestMakefileInstaller(unittest.TestCase): ) mock_run_command.assert_not_called() + @patch("pkgmgr.actions.install.installers.makefile.run_command") + @patch( + "builtins.open", + new_callable=mock_open, + read_data="install-python:\n\tpip install -r requirements.txt\n", + ) + @patch("os.path.exists", return_value=True) + def test_run_skips_a_makefile_that_only_has_a_prefixed_target( + self, mock_exists, mock_file, mock_run_command + ): + self.installer.run(self.ctx) + mock_run_command.assert_not_called() + if __name__ == "__main__": unittest.main()