Browse Source

Merge "Execute prebuild_hook in the plugin directory"

Jenkins 2 years ago
parent
commit
99e32daaa6
2 changed files with 8 additions and 6 deletions
  1. 3
    4
      fuel_plugin_builder/actions/build.py
  2. 5
    2
      fuel_plugin_builder/tests/test_build.py

+ 3
- 4
fuel_plugin_builder/actions/build.py View File

@@ -53,8 +53,7 @@ class BaseBuildPlugin(BaseAction):
53 53
     def __init__(self, plugin_path):
54 54
         self.plugin_path = plugin_path
55 55
 
56
-        self.pre_build_hook_path = join_path(self.plugin_path,
57
-                                             'pre_build_hook')
56
+        self.pre_build_hook_cmd = './pre_build_hook'
58 57
         self.meta = utils.parse_yaml(
59 58
             join_path(self.plugin_path, 'metadata.yaml')
60 59
         )
@@ -78,8 +77,8 @@ class BaseBuildPlugin(BaseAction):
78 77
         utils.remove_by_mask(self.result_package_mask)
79 78
 
80 79
     def run_pre_build_hook(self):
81
-        if utils.which(self.pre_build_hook_path):
82
-            utils.exec_cmd(self.pre_build_hook_path)
80
+        if utils.which(join_path(self.plugin_path, self.pre_build_hook_cmd)):
81
+            utils.exec_cmd(self.pre_build_hook_cmd, self.plugin_path)
83 82
 
84 83
     def add_checksums_file(self):
85 84
         utils.create_checksums_file(self.build_src_dir, self.checksums_path)

+ 5
- 2
fuel_plugin_builder/tests/test_build.py View File

@@ -76,8 +76,11 @@ class BaseBuild(BaseTestCase):
76 76
                 return_value=True)
77 77
     def test_run_pre_build_hook(self, exec_cmd_mock, which_mock):
78 78
         self.builder.run_pre_build_hook()
79
-        exec_cmd_mock.assert_called_once_with(self.builder.pre_build_hook_path)
80
-        which_mock.assert_called_once_with(self.builder.pre_build_hook_path)
79
+        exec_cmd_mock.assert_called_once_with(self.builder.pre_build_hook_cmd,
80
+                                              self.builder.plugin_path)
81
+        which_mock.assert_called_once_with(
82
+            join_path(self.builder.plugin_path,
83
+                      self.builder.pre_build_hook_cmd))
81 84
 
82 85
     @mock.patch('fuel_plugin_builder.actions.build.utils')
83 86
     def test_build_repos(self, utils_mock):

Loading…
Cancel
Save