Skip to content

Commit

Permalink
Merge pull request alibaba#214 from aliyun/vangie/fix_env
Browse files Browse the repository at this point in the history
change PYTHONUSERBASE if setting
  • Loading branch information
vangie authored May 13, 2019
2 parents 92bcffa + cd2bbbe commit eb3b939
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/install/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ function addEnv(envVars) {
envs['PATH'] = `${customPath}:${defaultPath}`;
}

envs['PYTHONUSERBASE']='/code/.fun/python';
if (!envs['PYTHONUSERBASE']) {
envs['PYTHONUSERBASE']='/code/.fun/python';
}

return envs;
}
Expand Down
8 changes: 8 additions & 0 deletions test/install/env.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,12 @@ describe('install_env', ()=>{

expect(envs).to.have.property('PATH', '/usr/bin:/code/.fun/root/usr/local/bin:/code/.fun/root/usr/local/sbin:/code/.fun/root/usr/bin:/code/.fun/root/usr/sbin:/code/.fun/root/sbin:/code/.fun/root/bin:/code/.fun/python/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/sbin:/bin');
});

it('with_PYTHONUSERBASE', () => {
const envs = addEnv({
'PYTHONUSERBASE': '/mnt/nas/fun/python'
});

expect(envs).to.have.property('PYTHONUSERBASE', '/mnt/nas/fun/python');
});
});

0 comments on commit eb3b939

Please sign in to comment.