# HG changeset patch # User Peter Sanchez # Date 1355189677 28800 # Mon Dec 10 17:34:37 2012 -0800 # Node ID dd841bd1e6b4c689ab56bdfec83c38b78e4e863d # Parent 8753a0ad446324acd93a06e83c49eda9703e09d1 Updates to be compatible with newer versions of pip diff --git a/djeploy/deploy.py b/djeploy/deploy.py --- a/djeploy/deploy.py +++ b/djeploy/deploy.py @@ -137,7 +137,8 @@ @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 @@ 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 @@ 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 @@ 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 diff --git a/djeploy/django.py b/djeploy/django.py --- a/djeploy/django.py +++ b/djeploy/django.py @@ -7,11 +7,22 @@ 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