dd841bd1e6b4 — Peter Sanchez 11 years ago
Updates to be compatible with newer versions of pip
2 files changed, 26 insertions(+), 9 deletions(-)

M djeploy/deploy.py
M djeploy/django.py
M djeploy/deploy.py +13 -7
@@ 137,7 137,8 @@ def generic_rollback(release_dir=None):
 
 
 @task
-def make_virtual_environment(extra_path=None, site_pkgs=False, python=None):
+def make_virtual_environment(extra_path=None, site_pkgs=False,
+                             python=None, env_dir='env'):
     ''' Create the virtual environment
     '''
     opts = get_env('release_path')

          
@@ 146,12 147,16 @@ def make_virtual_environment(extra_path=
     if extra_path is not None:
         release_path = os.path.join(release_path, extra_path)
 
+    if env_dir == '..':
+        # Sanity check
+        env_dir = '.'
+
     cmd = 'virtualenv '
     if not site_pkgs:
         cmd += '--no-site-packages '
     if python is not None:
         cmd += '-p %s ' % python
-    cmd += '.'
+    cmd += env_dir
 
     if not command.exists(release_path):
         command.run('mkdir -p %s' % release_path)

          
@@ 159,7 164,8 @@ def make_virtual_environment(extra_path=
     with command.cd(release_path):
         command.run(cmd)
         command.run('mkdir -p shared packages')
-    return set_env(virtual_env_path=release_path)
+
+    return set_env(virtual_env_path=release_path, virtual_env_dir=env_dir)
 
 
 @task

          
@@ 167,15 173,15 @@ def install_requirements(req_path='./req
                          cache=None, timeout=None):
     ''' Install the required packages from the requirements file using pip
     '''
-    opts = get_env('virtual_env_path')
+    opts = get_env('virtual_env_path', 'virtual_env_dir')
     virtual_env_path = opts['virtual_env_path']
-    tout_str = '--timeout=%i ' % int(timeout) if timeout is not None else ''
+    venv_dir = opts['virtual_env_dir']
 
-    cmd = 'pip'
+    cmd = './%s/bin/pip' % venv_dir
     if timeout is not None:
         cmd += ' --timeout=%i' % int(timeout)
 
-    cmd += ' install -E . -r %s' % req_path
+    cmd += ' install -r %s' % req_path
     if cache is not None:
         # If cache directory doesn't exist, pip should 
         # create it for you

          
M djeploy/django.py +13 -2
@@ 7,11 7,22 @@ from djeploy import djeploy_require, set
 def run_manage_command(cmd, *args, **kwargs):
     ''' Run manage.py syncdb
     '''
-    opts = get_env('release_path', 'virtual_env_path', 'scm_repo_name')
+    opts = get_env(
+        'release_path',
+        'virtual_env_path',
+        'virtual_env_dir',
+        'scm_repo_name',
+    )
     release_path = opts['release_path']
     virtual_env_path = opts['virtual_env_path']
+    virtual_env_dir = opts['virtual_env_dir']
     scm_repo_name = opts['scm_repo_name']
-    python_path = os.path.join(virtual_env_path, 'bin', 'python')
+    python_path = os.path.join(
+        virtual_env_path,
+        virtual_env_dir,
+        'bin',
+        'python',
+    )
     manage_path = os.path.join(release_path, scm_repo_name)
 
     # Check for extra_path