Taras KulaPard avatar Taras KulaPard committed 20915e9

ADD: custom requirements file setting

Comments (0)

Files changed (1)

 
         self.app_name = app_name
         self.run_deps = run_deps or []
-        self.pkg_name = (self.prefix + '-' + app_name).lower()
+        self.pkg_name = ('{0.prefix}-{0.app_name}'.format(self)).lower()
         self.base_path = '/tmp/{0.pkg_name}-{0.version}'.format(self)
         self.app_path = os.path.join(self.base_path, self.prefix, app_name)
         self.venv_path = os.path.join(self.app_path, 'venv')
         self.static_path = os.path.join(self.app_path, 'static')
 
     @with_settings(user='buildbot')
-    def prepare_app(self, hg_repository, branch, python_path='/usr/bin/python', static_dir='static'):
+    def prepare_app(self,
+                    hg_repository,
+                    branch,
+                    python_path='/usr/bin/python',
+                    static_dir='static',
+                    requirements='requirements.txt'
+    ):
         """
         Create default directories, create a virtualenv, check out src.
 
         `hg_repository` - source code hg_repository (URL or path)
         `branch` - hg_repository branch name
         `python_path` - path to python
-        `static_dir` - path to static in source code hg_repository
+        `static_dir` - path to static in source code hg_repository (./static by default)
+        `requirements` - path to requirements file in source code hg_repository (./requirements.txt by default)
         """
         run('rm -rf {0.base_path}'.format(self))
         self.hg_repository = hg_repository
         self.create_virtualenv(python_path)
         run('{} install -r {}'.format(
             os.path.join(self.venv_path, 'bin/pip'),
-            os.path.join(self.src_path, 'conf', 'requirements.txt'))
+            os.path.join(self.src_path, requirements))
         )
         # If app need to be installed into virtualenv lets do it
 
         run_fpm = run(
             'fpm -s dir -t rpm -n {1} -v {0.version} --iteration {0.release} '
             '-a native {2} {3} '
-            '--description "Build by Alexis ({6}). '
+            '--description "Build by Alexis ({6}).\n'
             'Branch: {0.hg_branch} Commit: {0.hg_commit}" '
             '{4} {5}'
             .format(self, pkg_name, exclude_string, hooks_str, deps_str, dir_to_pack, __version__)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.