1. Bill Evans
  2. django-fab-deploy

Commits

Mikhail Korobov  committed c39ed84

PIP_REQUIREMENTS_ACTIVE option

  • Participants
  • Parent commits fdba630
  • Branches default

Comments (0)

Files changed (4)

File docs/custom_layouts.rst

View file
 * :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 = '',
     )
 

File docs/fabfile.rst

View file
     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

File fab_deploy/utils.py

View file
 
         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,

File fab_deploy/virtualenv.py

View file
     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()