Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
system_site_packages=False,
clear=self.clear_cross,
symlinks=True,
upgrade=False,
with_pip=False)
env.create(context.cross_env_dir)
context.cross_bin_path = os.path.join(context.cross_env_dir, 'bin')
context.cross_env_exe = os.path.join(
context.cross_bin_path, context.python_exe)
context.cross_cfg_path = os.path.join(context.cross_env_dir, 'pyvenv.cfg')
context.cross_activate = os.path.join(context.cross_bin_path, 'activate')
# Remove binaries. We'll run from elsewhere
for exe in os.listdir(context.cross_bin_path):
if not exe.startswith('activate'):
utils.remove_path(os.path.join(context.cross_bin_path, exe))
# Alter pyvenv.cfg
with utils.overwrite_file(context.cross_cfg_path) as out:
with open(context.cross_cfg_path) as inp:
for line in inp:
if line.split()[0:2] == ['home', '=']:
line = 'home = %s\n' % self.host_project_base
out.write(line)
# make a script that sets the environment variables and calls Python.
# Don't do this in bin/activate, because it's a pain to set/unset
# properly (and for csh, fish as well).
# Note that env_exe hasn't actually been created yet.
sysconfig_name = os.path.basename(self.host_sysconfigdata_file)
"""
# Directory structure:
#
# ENV_DIR/
# cross/ cross-python venv
# build/ build-python venv
# lib/ libs for setting up cross-python
# bin/ holds activate scripts.
if os.path.exists(env_dir) and (self.clear_cross or self.clear_build):
subdirs = os.listdir(env_dir)
for sub in subdirs:
if sub in ('cross', 'build'):
continue
utils.remove_path(os.path.join(env_dir, sub))
context = super().ensure_directories(env_dir)
context.lib_path = os.path.join(env_dir, 'lib')
context.exposed_libs = os.path.join(context.lib_path, 'exposed.txt')
utils.mkdir_if_needed(context.lib_path)
return context