Skip to content

Commit

Permalink
Refactoring to use "is_win"
Browse files Browse the repository at this point in the history
  • Loading branch information
deniscostadsc committed Aug 3, 2012
1 parent ee9a769 commit 01fbc94
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions virtualenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ def install_pip(py_executable, search_dirs=None, never_download=False):
else:
filename = filenames[-1]
easy_install_script = 'easy_install'
if sys.platform == 'win32':
if is_win:
easy_install_script = 'easy_install-script.py'
# There's two subtle issues here when invoking easy_install.
# 1. On unix-like systems the easy_install script can *only* be executed
Expand Down Expand Up @@ -1060,7 +1060,7 @@ def path_locations(home_dir):
where scripts go, etc)"""
# XXX: We'd use distutils.sysconfig.get_python_inc/lib but its
# prefix arg is broken: http://bugs.python.org/issue3386
if sys.platform == 'win32':
if is_win:
# Windows has lots of problems with executables with spaces in
# the name; this function will remove them (using the ~1
# format):
Expand Down Expand Up @@ -1177,7 +1177,7 @@ def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear):
mkdir(lib_dir)
fix_lib64(lib_dir)
stdlib_dirs = [os.path.dirname(os.__file__)]
if sys.platform == 'win32':
if is_win:
stdlib_dirs.append(join(os.path.dirname(stdlib_dirs[0]), 'DLLs'))
elif sys.platform == 'darwin':
stdlib_dirs.append(join(stdlib_dirs[0], 'site-packages'))
Expand Down Expand Up @@ -1229,7 +1229,7 @@ def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear):

# pypy never uses exec_prefix, just ignore it
if sys.exec_prefix != prefix and not is_pypy:
if sys.platform == 'win32':
if is_win:
exec_dir = join(sys.exec_prefix, 'lib')
elif is_jython:
exec_dir = join(sys.exec_prefix, 'Lib')
Expand Down Expand Up @@ -1284,7 +1284,7 @@ def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear):
logger.info('Executable actually exists in %s' % executable)
shutil.copyfile(executable, py_executable)
make_exe(py_executable)
if sys.platform == 'win32' or sys.platform == 'cygwin':
if is_win or sys.platform == 'cygwin':
pythonw = os.path.join(os.path.dirname(sys.executable), 'pythonw.exe')
if os.path.exists(pythonw):
logger.info('Also created pythonw.exe')
Expand Down Expand Up @@ -1323,7 +1323,7 @@ def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear):
logger.info('Also created executable %s' % python_executable)
copyfile(py_executable, python_executable)

if sys.platform == 'win32':
if is_win:
for name in 'libexpat.dll', 'libpypy.dll', 'libpypy-c.dll', 'libeay32.dll', 'ssleay32.dll', 'sqlite.dll':
src = join(prefix, name)
if os.path.exists(src):
Expand Down Expand Up @@ -1406,7 +1406,7 @@ def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear):
os.unlink(pth)
os.symlink(os.path.basename(py_executable), pth)

if sys.platform == 'win32' and ' ' in py_executable:
if is_win and ' ' in py_executable:
# There's a bug with subprocess on Windows when using a first
# argument that has a space in it. Instead we have to quote
# the value:
Expand Down Expand Up @@ -1440,7 +1440,7 @@ def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear):
% (proc_stdout, norm_home_dir))
logger.fatal(
'ERROR: virtualenv is not compatible with this system or executable')
if sys.platform == 'win32':
if is_win:
logger.fatal(
'Note: some Windows users have reported this error when they '
'installed Python for "Only this user" or have multiple '
Expand All @@ -1464,7 +1464,7 @@ def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear):

def install_activate(home_dir, bin_dir, prompt=None):
home_dir = os.path.abspath(home_dir)
if sys.platform == 'win32' or is_jython and os._name == 'nt':
if is_win or is_jython and os._name == 'nt':
files = {
'activate.bat': ACTIVATE_BAT,
'deactivate.bat': DEACTIVATE_BAT,
Expand Down Expand Up @@ -1598,7 +1598,7 @@ def fixup_scripts(home_dir):
# This is what we'll put:
new_shebang = '#!/usr/bin/env python%s' % sys.version[:3]
activate = "import os; activate_this=os.path.join(os.path.dirname(os.path.realpath(__file__)), 'activate_this.py'); execfile(activate_this, dict(__file__=activate_this)); del os, activate_this"
if sys.platform == 'win32':
if is_win:
bin_suffix = 'Scripts'
else:
bin_suffix = 'bin'
Expand Down

0 comments on commit 01fbc94

Please sign in to comment.