Commits

Taras KulaPard committed 6f83bd6

ADD: split_pkg

Comments (0)

Files changed (2)

alexis/__init__.py

 https://bitbucket.org/KulaPard/alexis
 """
 __author__ = 'KulaPard <kulapard@gmail.com>'
-__version__ = '0.1.0.dev11'
+__version__ = '0.1.1.dev1'
     @with_settings(user='buildbot')
     def build_rpm(
             self,
+            split_pkg=False,
             before_remove=None,
             after_remove=None,
             before_install=None,
                 if file_path and os.path.exists(file_path):
                     put(file_path, os.path.join(self.base_path, 'rhel/'))
 
-            app_dir = os.path.join(self.prefix, self.app_name, 'app')
-            venv_dir = os.path.join(self.prefix, self.app_name, 'venv')
-            static_dir = os.path.join(self.prefix, self.app_name, 'static')
+            main_dir = os.path.join(self.prefix, self.app_name)
+            app_dir = os.path.join(main_dir, 'app')
+            venv_dir = os.path.join(main_dir, 'venv')
+            static_dir = os.path.join(main_dir, 'static')
 
             hooks_str = ' '.join(
                 '{} {}'.format(opt, os.path.join('rhel', os.path.basename(file_path)))
                 self)
             venv_deps_str = deps_str
 
-            pack_app = self.do_pack(app_dir, hooks_str=hooks_str, deps_str=app_deps_str)
-            static_app = self.do_pack(static_dir, suffix='static')
-            venv_app = self.do_pack(venv_dir, suffix='venv', deps_str=venv_deps_str)
+            if split_pkg:
+                pack_app = self.do_pack(app_dir, hooks_str=hooks_str, deps_str=app_deps_str)
+                static_app = self.do_pack(static_dir, suffix='static')
+                venv_app = self.do_pack(venv_dir, suffix='venv', deps_str=venv_deps_str)
 
-            # Get filename form run result string:
-            #     Created rpm package {"path":"prefix-app_name-1.0.0-1.noarch.rpm"}
-            # and download it to the local machine
-            get(pack_app.split('"')[-2], 'packages/rhel/%(basename)s')
-            get(static_app.split('"')[-2], 'packages/rhel/%(basename)s')
-            get(venv_app.split('"')[-2], 'packages/rhel/%(basename)s')
+                # Get filename form run result string:
+                # ``Created rpm package {"path":"prefix-app_name-1.0.0-1.noarch.rpm"}``
+                # and download it to the local machine
+                get(pack_app.split('"')[-2], 'packages/rhel/%(basename)s')
+                get(static_app.split('"')[-2], 'packages/rhel/%(basename)s')
+                get(venv_app.split('"')[-2], 'packages/rhel/%(basename)s')
+            else:
+                pack_all = self.do_pack(main_dir, hooks_str=hooks_str, deps_str=deps_str)
+                get(pack_all.split('"')[-2], 'packages/rhel/%(basename)s')
 
     def do_pack(self, dir_to_pack, without_dirs=None, suffix=None, hooks_str='', deps_str=''):
         exclude_string = '-x "*.bak" -x "*.orig"'