Improve support for installing pip etc. on python3
namely this is for the sake of newer Ubuntu which doesn't include python2 by default, and this affects some other package names
This commit is contained in:
		
							parent
							
								
									84c345ce39
								
							
						
					
					
						commit
						3d5b7c1d6e
					
				
					 1 changed files with 12 additions and 5 deletions
				
			
		|  | @ -35,22 +35,24 @@ deploy = make_deploy(__file__) | ||||||
| def bootstrap_python(c, pip_from_apt=True, pip_eager=True, | def bootstrap_python(c, pip_from_apt=True, pip_eager=True, | ||||||
|                      virtualenvwrapper_from_apt=False, |                      virtualenvwrapper_from_apt=False, | ||||||
|                      upgrade_virtualenvwrapper=True, |                      upgrade_virtualenvwrapper=True, | ||||||
|                      workon_home='/srv/envs', user='rattail'): |                      workon_home='/srv/envs', user='rattail', | ||||||
|  |                      python3=False): | ||||||
|     """ |     """ | ||||||
|     Bootstrap a "complete" Python install. |     Bootstrap a "complete" Python install. | ||||||
|     """ |     """ | ||||||
|     # build dependencies |     # build dependencies | ||||||
|     apt.install( |     apt.install( | ||||||
|         c, |         c, | ||||||
|         'python-dev', |  | ||||||
|         'python3-dev', |         'python3-dev', | ||||||
|         'libffi-dev', |         'libffi-dev', | ||||||
|         'libjpeg-dev', |         'libjpeg-dev', | ||||||
|         'libssl-dev', |         'libssl-dev', | ||||||
|     ) |     ) | ||||||
|  |     if not python3: | ||||||
|  |         apt.install(c, 'python-dev') | ||||||
| 
 | 
 | ||||||
|     # pip |     # pip | ||||||
|     install_pip(c, use_apt=pip_from_apt, eager=pip_eager) |     install_pip(c, use_apt=pip_from_apt, python3=python3, eager=pip_eager) | ||||||
| 
 | 
 | ||||||
|     # virtualenvwrapper |     # virtualenvwrapper | ||||||
|     workon_home = workon_home.rstrip('/') |     workon_home = workon_home.rstrip('/') | ||||||
|  | @ -102,11 +104,14 @@ def install_python(c, version, globally=False, verbose=False): | ||||||
|             version, short_version)) |             version, short_version)) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def install_pip(c, use_apt=False, eager=True): | def install_pip(c, use_apt=False, python3=False, eager=True): | ||||||
|     """ |     """ | ||||||
|     Install/upgrade the Pip installer for Python. |     Install/upgrade the Pip installer for Python. | ||||||
|     """ |     """ | ||||||
|     if use_apt: |     if use_apt: | ||||||
|  |         if python3: | ||||||
|  |             apt.install(c, 'python3-pip') | ||||||
|  |         else: | ||||||
|             apt.install(c, 'python-pip') |             apt.install(c, 'python-pip') | ||||||
|     else: |     else: | ||||||
|         apt.install(c, 'build-essential', 'python-dev', 'libssl-dev', 'libffi-dev') |         apt.install(c, 'build-essential', 'python-dev', 'libssl-dev', 'libffi-dev') | ||||||
|  | @ -157,6 +162,8 @@ def install_virtualenvwrapper(c, workon_home='/srv/envs', user='root', | ||||||
|     mkdir(c, workon_home, owner=user, use_sudo=True) |     mkdir(c, workon_home, owner=user, use_sudo=True) | ||||||
|     if use_apt: |     if use_apt: | ||||||
|         apt.install(c, 'virtualenvwrapper') |         apt.install(c, 'virtualenvwrapper') | ||||||
|  |         configure_virtualenvwrapper(c, user, workon_home, | ||||||
|  |                                     wrapper='/usr/share/virtualenvwrapper/virtualenvwrapper.sh') | ||||||
|     else: |     else: | ||||||
|         pip(c, 'virtualenvwrapper', upgrade=upgrade) |         pip(c, 'virtualenvwrapper', upgrade=upgrade) | ||||||
|         configure_virtualenvwrapper(c, user, workon_home) |         configure_virtualenvwrapper(c, user, workon_home) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lance Edgar
						Lance Edgar