Skip to content

Commit

Permalink
Merge pull request #291 from lamikr/develop
Browse files Browse the repository at this point in the history
mageia multiarch fix for python virtualenv to fix #284
  • Loading branch information
carljm committed Jun 29, 2012
2 parents e015392 + e42067a commit f27092d
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion virtualenv.py
Expand Up @@ -19,6 +19,7 @@
import zlib
import errno
import distutils.sysconfig
import subprocess
from distutils.util import strtobool
import struct

Expand Down Expand Up @@ -1052,6 +1053,9 @@ def create_environment(home_dir, site_packages=False, clear=False,

install_activate(home_dir, bin_dir, prompt)

def is_executable_file(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)

def path_locations(home_dir):
"""Return the path locations for the environment (where libraries are,
where scripts go, etc)"""
Expand Down Expand Up @@ -1084,7 +1088,17 @@ def path_locations(home_dir):
bin_dir = join(home_dir, 'bin')
elif sys.platform != 'win32':
lib_dir = join(home_dir, 'lib', py_version)
inc_dir = join(home_dir, 'include', py_version + abiflags)
multiarch_exec = '/usr/bin/multiarch-platform'
if is_executable_file(multiarch_exec):
# In Mageia (2) and Mandriva distros the include dir must be like:
# virtualenv/include/multiarch-x86_64-linux/python2.7
# instead of being virtualenv/include/python2.7
p = subprocess.Popen(multiarch_exec, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = p.communicate()
# stdout.strip is needed to remove newline character
inc_dir = join(home_dir, 'include', stdout.strip(), py_version + abiflags)
else:
inc_dir = join(home_dir, 'include', py_version + abiflags)
bin_dir = join(home_dir, 'bin')
return home_dir, lib_dir, inc_dir, bin_dir

Expand Down

0 comments on commit f27092d

Please sign in to comment.