Commits

Mikhail Korobov committed c39ed84

PIP_REQUIREMENTS_ACTIVE option

Comments (0)

Files changed (4)

docs/custom_layouts.rst

 * :attr:`env.conf.CONFIG_TEMPLATES_PATHS`
 * :attr:`env.conf.PIP_REQUIREMENTS_PATH`
 * :attr:`env.conf.PIP_REQUIREMENTS`
+* :attr:`env.conf.PIP_REQUIREMENTS_ACTIVE`
 
 Example
 -------
         PROJECT_PATH = 'src',
         LOCAL_CONFIG = 'local_settings.py',
         PIP_REQUIREMENTS = 'requirements.txt',
+        PIP_REQUIREMENTS_ACTIVE = 'requirements.txt',
         PIP_REQUIREMENTS_PATH = '',
     )
 
     The name of main requirements file. Requirements from it are installed
     during deployment. Default is 'all.txt'.
 
+.. attribute:: env.conf.PIP_REQUIREMENTS_ACTIVE
+
+    The name of pip requirements file with commonly updated requirements.
+    Requirements from this file are updated by
+    :func:`fab_deploy.virtualenv.pip_install` and
+    :func:`fab_deploy.virtualenv.pip_update` commands when they are executed
+    without arguments.
+
+    ``fab push:pip_update`` command also updates only requirements listed here.
+
+    Default is 'all.txt'.
+
 .. attribute:: env.conf.APACHE_PORT
 
     The port used by apache backend. It is managed automatically

fab_deploy/utils.py

 
         PIP_REQUIREMENTS_PATH='reqs',
         PIP_REQUIREMENTS='all.txt',
+        PIP_REQUIREMENTS_ACTIVE = 'active.txt',
 
         # these options shouldn't be set by user
         HOME_DIR=HOME_DIR,

fab_deploy/virtualenv.py

     run('pip ' + commands)
 
 @utils.inside_src
-def pip_install(what='active', options='', restart=True):
-    """ Installs pip requirements listed in ``reqs/<file>.txt`` file. """
-    what = utils._pip_req_path(what)
+def pip_install(what=None, options='', restart=True):
+    """ Installs pip requirements listed in ``<PIP_REQUIREMENTS_PATH>/<file>.txt`` file. """
+    what = utils._pip_req_path(what or env.conf.PIP_REQUIREMENTS_ACTIVE)
     run('pip install %s -r %s' % (options, what))
     if restart:
         apache.touch()
 
 @utils.inside_src
-def pip_update(what='active', options='', restart=True):
-    """ Updates pip requirements listed in ``reqs/<file>.txt`` file. """
-    what = utils._pip_req_path(what)
+def pip_update(what=None, options='', restart=True):
+    """ Updates pip requirements listed in ``<PIP_REQUIREMENTS_PATH>/<file>.txt`` file. """
+    what = utils._pip_req_path(what or env.conf.PIP_REQUIREMENTS_ACTIVE)
     run('pip install %s -U -r %s' % (options, what))
     if restart:
         apache.touch()