diff --git a/pydiploy/require/python/utils.py b/pydiploy/require/python/utils.py index 4e9fb37..d5ed8d6 100644 --- a/pydiploy/require/python/utils.py +++ b/pydiploy/require/python/utils.py @@ -7,7 +7,6 @@ import fabric import fabtools from fabric.api import env - from pydiploy.decorators import do_verbose from pydiploy.require.system import shell @@ -45,8 +44,6 @@ def python_pkg(update=False): 'python-dev' if env.remote_python_version < 3 else 'python%s-dev' % env.remote_python_version, - 'python3-dev', - 'python-pip', ], update=update, ) diff --git a/pydiploy/require/python/virtualenv.py b/pydiploy/require/python/virtualenv.py index 99108e5..cea5660 100644 --- a/pydiploy/require/python/virtualenv.py +++ b/pydiploy/require/python/virtualenv.py @@ -18,6 +18,7 @@ def virtualenv(clear=False): use_sudo=True, ) python_bin = '/usr/bin/python%s' % env.remote_python_version + # TODO: check if used on older python version ! # with shell("HOME=~%s %s" % (env.remote_owner, env.shell)): fabtools.require.python.virtualenv( env.remote_virtualenv_dir, diff --git a/tests/test_require_python.py b/tests/test_require_python.py index 998d1ae..59a644b 100644 --- a/tests/test_require_python.py +++ b/tests/test_require_python.py @@ -37,9 +37,20 @@ def tearDown(self): def test_python_pkg(self, dist_id, dist_rls, python_install, deb_packages): python_pkg() self.assertTrue(deb_packages.called) + self.assertEqual(deb_packages.call_args, call(['python-dev'], update=False)) + self.assertTrue(python_install.called) self.assertEqual( - deb_packages.call_args, call(['python-dev', 'python-pip'], update=False) + python_install.call_args, call('pip', upgrade=True, use_sudo=True) ) + + @patch('fabtools.require.deb.packages', return_value=Mock()) + @patch('fabtools.require.python.install', return_value=Mock()) + @patch('fabtools.system.distrib_release', return_value='18') + @patch('fabtools.system.distrib_id', return_value='Ubuntu') + def test_python_ubuntu18_pkg(self, dist_id, dist_rls, python_install, deb_packages): + python_pkg() + self.assertTrue(deb_packages.called) + self.assertEqual(deb_packages.call_args, call(['python-dev'], update=False)) self.assertTrue(python_install.called) self.assertEqual( python_install.call_args, call('pip', upgrade=True, use_sudo=True) diff --git a/tools/pydiployfabfile.sublime-snippet b/tools/pydiployfabfile.sublime-snippet index e3e7653..c2fcc7f 100644 --- a/tools/pydiployfabfile.sublime-snippet +++ b/tools/pydiployfabfile.sublime-snippet @@ -9,6 +9,7 @@ from os.path import join from fabric.api import env, execute, roles, task + from pydiploy.django import custom_manage_command as pydiploy_custom_command from pydiploy.django import deploy_backend as pydiploy_deploy_backend from pydiploy.django import deploy_frontend as pydiploy_deploy_frontend @@ -39,7 +40,9 @@ env.root_package_name = 'myapp' # name of app in webapp env.remote_home = '/home/django' # remote home root env.remote_python_version = 3.4 # python version env.remote_virtualenv_root = join(env.remote_home, '.virtualenvs') # venv root -env.remote_virtualenv_dir = join(env.remote_virtualenv_root, env.application_name) # venv for webapp dir +env.remote_virtualenv_dir = join( + env.remote_virtualenv_root, env.application_name +) # venv for webapp dir env.remote_repo_url = 'git@git.net:myapp.git' # git repository url env.local_tmp_dir = '/tmp' # tmp dir env.remote_static_root = '/var/www/static' # root of static files @@ -304,9 +307,8 @@ def custom_manage_cmd(cmd): """ Execute custom command in manage.py """ execute(pydiploy_custom_command, cmd) - ]]> Pydiploy fabfile 1.2.0 pydiployfab source.python - + \ No newline at end of file