Skip to content

Commit 0ad0f6a

Browse files
Merge pull request #452 from mayeut/fix-env
Remove duplicate code introduced in #440
2 parents f0bcf8b + 2c9de4e commit 0ad0f6a

File tree

4 files changed

+8
-22
lines changed

4 files changed

+8
-22
lines changed

__tests__/find-pypy.test.ts

+4
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,11 @@ describe('findPyPyVersion', () => {
151151
let spyChmodSync: jest.SpyInstance;
152152
let spyCoreAddPath: jest.SpyInstance;
153153
let spyCoreExportVariable: jest.SpyInstance;
154+
const env = process.env;
154155

155156
beforeEach(() => {
157+
jest.resetModules();
158+
process.env = {...env};
156159
tcFind = jest.spyOn(tc, 'find');
157160
tcFind.mockImplementation((tool: string, version: string) => {
158161
const semverRange = new semver.Range(version);
@@ -214,6 +217,7 @@ describe('findPyPyVersion', () => {
214217
jest.resetAllMocks();
215218
jest.clearAllMocks();
216219
jest.restoreAllMocks();
220+
process.env = env;
217221
});
218222

219223
it('found PyPy in toolcache', async () => {

__tests__/finder.test.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,20 @@ const manifestData = require('./data/versions-manifest.json');
2828
describe('Finder tests', () => {
2929
let spyCoreAddPath: jest.SpyInstance;
3030
let spyCoreExportVariable: jest.SpyInstance;
31+
const env = process.env;
3132

3233
beforeEach(() => {
34+
jest.resetModules();
35+
process.env = {...env};
3336
spyCoreAddPath = jest.spyOn(core, 'addPath');
34-
3537
spyCoreExportVariable = jest.spyOn(core, 'exportVariable');
3638
});
3739

3840
afterEach(() => {
3941
jest.resetAllMocks();
4042
jest.clearAllMocks();
4143
jest.restoreAllMocks();
44+
process.env = env;
4245
});
4346

4447
it('Finds Python if it is installed', async () => {
@@ -66,7 +69,6 @@ describe('Finder tests', () => {
6669
await finder.useCpythonVersion('3.x', 'x64', false);
6770
expect(spyCoreAddPath).not.toHaveBeenCalled();
6871
expect(spyCoreExportVariable).not.toHaveBeenCalled();
69-
expect(spyCoreExportVariable).not.toHaveBeenCalled();
7072
});
7173

7274
it('Finds stable Python version if it is not installed, but exists in the manifest', async () => {

dist/setup/index.js

-9
Original file line numberDiff line numberDiff line change
@@ -64845,15 +64845,6 @@ function useCpythonVersion(version, architecture, updateEnvironment) {
6484564845
`The list of all available versions can be found here: ${installer.MANIFEST_URL}`
6484664846
].join(os.EOL));
6484764847
}
64848-
if (utils_1.IS_LINUX) {
64849-
const libPath = process.env.LD_LIBRARY_PATH
64850-
? `:${process.env.LD_LIBRARY_PATH}`
64851-
: '';
64852-
const pyLibPath = path.join(installDir, 'lib');
64853-
if (!libPath.split(':').includes(pyLibPath)) {
64854-
core.exportVariable('LD_LIBRARY_PATH', pyLibPath + libPath);
64855-
}
64856-
}
6485764848
const _binDir = binDir(installDir);
6485864849
const binaryExtension = utils_1.IS_WINDOWS ? '.exe' : '';
6485964850
const pythonPath = path.join(utils_1.IS_WINDOWS ? installDir : _binDir, `python${binaryExtension}`);

src/find-python.ts

-11
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,6 @@ export async function useCpythonVersion(
7070
);
7171
}
7272

73-
if (IS_LINUX) {
74-
const libPath = process.env.LD_LIBRARY_PATH
75-
? `:${process.env.LD_LIBRARY_PATH}`
76-
: '';
77-
const pyLibPath = path.join(installDir, 'lib');
78-
79-
if (!libPath.split(':').includes(pyLibPath)) {
80-
core.exportVariable('LD_LIBRARY_PATH', pyLibPath + libPath);
81-
}
82-
}
83-
8473
const _binDir = binDir(installDir);
8574
const binaryExtension = IS_WINDOWS ? '.exe' : '';
8675
const pythonPath = path.join(

0 commit comments

Comments
 (0)