Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
sysconfig_name, _ = os.path.splitext(sysconfig_name)
# If this venv is generated from a cross-python still in its
sysname = sys.platform[0]
machine = platform.machine()
else:
sysname = host_info[0]
machine = host_info[-1]
config['uname'] = {
'sysname' : sysname.title(),
'nodename' : 'build',
'release' : '',
'version' : '',
'machine' : machine,
}
context.crossenv_cfg = os.path.join(context.env_dir, 'crossenv.cfg')
with utils.overwrite_file(context.crossenv_cfg) as fp:
config.write(fp)